Threads HTTP API

You can now create Amp orb threads, read agent responses, and post follow-up messages through the HTTP API.

This makes it easy for any automated system to delegate work to Amp:

  • Investigate alerts. An error tracker or paging webhook starts a thread for each critical alert.
  • Fix CI failures. When CI fails on main, a thread finds the cause and opens a fix PR.
  • Triage on a schedule. Every morning, a job sends the past day's top errors to Amp.
  • Start threads from bots and internal tools. A Slack bot, a support workflow, or an issue-report queue starts a thread, then reads the result or sends a follow-up.

To try it, create a personal access token in Settings → Access Tokens with these scopes:

  • amp.api:threads:write
  • amp.api:threads.meta:read
  • amp.api:threads.contents:read

If you're testing this in the terminal, set AMP_TOKEN to this value.

Then, start a new orb thread:

curl https://ampcode.com/api/v2/threads \
  -H "Authorization: Bearer $AMP_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "project": "my-workspace/my-project",
    "title": "Fix CI on main",
    "labels": ["ci-failure"],
    "message": "Fix this CI failure: https://github.com/org/repo/actions/runs/1"
  }'

Read the agent's response:

curl "https://ampcode.com/api/v2/threads/$THREAD_ID/messages?limit=100" \
  -H "Authorization: Bearer $AMP_TOKEN"

And send a follow-up message:

curl https://ampcode.com/api/v2/threads/$THREAD_ID/messages \
  -H "Authorization: Bearer $AMP_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"message": "Add a regression test for this failure."}'

For organization or team-level automations, we recommend using a service account. Create the service account's access token in Workspace Settings → Service Accounts. Remember to connect the service account to GitHub or your code host, so it can clone repositories.

The Service Accounts table in Workspace Settings with the actions menu open for Review Agent, highlighting Create Access Token… with an arrow pointing to it. The Service Accounts table in Workspace Settings with the actions menu open for Review Agent, highlighting Create Access Token… with an arrow pointing to it.

See the Threads API docs for full details.