Skip to main content
This example brings everything together: a translator sandbox that processes files from S3, exports results, and forks to try multiple languages.

The sandbox

FROM python:3.12-slim

RUN apt-get update \
    && apt-get install -y translate-shell

COPY skills/ /skills/

CMD ["sh", "-c", "while true; do \
    if [ -f /shutdown/terminate ]; then exit 0; fi; \
    sleep 1; \
done"]
Build and push:
export IMAGE=agents.trelent.com/translator:latest

docker build -t $IMAGE .
docker push $IMAGE

The script

from trelent_agents import Client, LocalImporter, S3Exporter

client = Client()

sandbox = "translator:latest"

# Create a run that translates files to Spanish
run = client.runs.create(
    sandbox=sandbox,
    model="claude-sonnet-4-5",
    prompt="""
Read /skills/translate.md to learn your tools.
Translate all files in /mnt/ to Spanish.
Save translations to /output/.
""",
    imports=[
        LocalImporter(path="./input"),
    ],
    exports=[
        S3Exporter(),
    ],
)

# Wait for completion
while run.status != "complete":
    run.refresh()

print("Spanish translations:", run.result)

# Fork to translate to French as well, reusing the same import from before
french_run = run.fork(
    prompt="Now translate the same files to French.",
    imports=[
        LocalImporter(path="./input"),
    ],
    exports=[
        S3Exporter(),
    ],
)

while french_run.status != "complete":
    french_run.refresh()

print("French translations:", french_run.result)

What happens

  1. The run imports files from ./input/ to /mnt/
  2. The agent reads /skills/translate.md to learn the trans CLI
  3. It translates each file to Spanish using bash
  4. Results export to s3://agent-outputs/
  5. The fork inherits the sandbox and model
  6. It translates to French and exports to s3://agent-outputs/ as well