Skip to main content

Quickstart: Your First Agentic Workflow

Run an AI agent in a Jetty sandbox in 5 minutes.

Prerequisites

  • A Jetty API token (set as JETTY_API_TOKEN)
  • curl or any HTTP client

1. Upload a File

Upload a file that your agent will work with:

curl -X POST "https://flows-api.jetty.io/api/v1/files/upload" \
-H "Authorization: Bearer $JETTY_API_TOKEN" \
-F "file=@example.csv" \
-F "collection=my-org"

The response includes a file_path you'll reference in the next step.

2. Run an Agent

Send a runbook request to the chat completions endpoint:

curl -X POST "https://flows-api.jetty.io/v1/chat/completions" \
-H "Authorization: Bearer $JETTY_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"model": "claude-sonnet-4-6",
"messages": [
{
"role": "system",
"content": "You are a data analyst. Read the uploaded CSV file. Produce a summary report with key statistics, trends, and anomalies. Write your report to /app/results/report.md. Write any charts to /app/results/."
},
{
"role": "user",
"content": "Analyze the dataset"
}
],
"stream": true,
"jetty": {
"runbook": true,
"collection": "my-org",
"task": "analyze-data",
"agent": "claude-code",
"file_paths": ["uploads/example.csv"]
}
}'

Jetty will:

  1. Provision an isolated sandbox
  2. Install Claude Code
  3. Upload your CSV
  4. Run the agent with your instructions
  5. Stream progress back via SSE
  6. Persist all files written to /app/results/

3. Check the Trajectory

The response includes a trajectory_id. Use it to check status and retrieve artifacts:

curl "https://flows-api.jetty.io/api/v1/trajectories/$TRAJECTORY_ID" \
-H "Authorization: Bearer $JETTY_API_TOKEN"

The trajectory contains:

  • Status: pending, running, completed, or failed
  • Artifacts: URLs for all files the agent produced
  • Logs: Full execution history
  • Usage: Token counts, timing, cost

What Just Happened

Next Steps