agent-swarm.devagent-swarm.dev
GuidesProvider Auth

Amp

Run Agent Swarm workers on Sourcegraph's Amp CLI, get an AMP_API_KEY, and understand modes and cost

The amp harness runs Amp's CLI in execute mode (amp -x --stream-json --stream-json-input). Amp picks the model for each mode on its own servers and bills the thread to your Amp account. This page covers setup and the access token. The adapter internals are in Harness Providers § Amp.

Every Amp thread is stored on ampcode.com. Prompts, tool calls and tool output leave your infrastructure. Threads start with --visibility private, but Amp has no local-only mode. Amp's licence is proprietary (terms).

Get an access token

The CLI accepts an access token, not the session that amp login stores. The session token expires within an hour and cannot be refreshed from an environment variable, so the CLI rejects it in AMP_API_KEY.

  1. Sign in at ampcode.com.
  2. Open Settings → Security (ampcode.com/settings/security#access-token).
  3. Create an access token and copy it. It starts with sgamp_.
  4. Make sure the account or workspace has credits. Amp's pricing page explains tiers and paid credits. Without credits a session fails after it starts.

Source: Amp's execute mode docs, checked 2026-10-05.

Configure the worker

VariableRequiredWhat it does
HARNESS_PROVIDER=ampYesSelects the Amp adapter for the worker.
AMP_API_KEYYesThe sgamp_ access token. Store it as a secret in agent-scoped or global config, or in the worker environment.
AMP_BINARYNoPath to another trusted amp executable. Defaults to the one on PATH.

The full worker image ships the pinned CLI (@ampcode/cli@0.0.1791187719-g319a37, SHA-512 verified, auto-update off). The slim image does not include it.

To check the key, open the agent's Credentials tab or restart the worker. The live test runs amp usage, which reads the credit balance and runs no inference. A bad key fails with Invalid or missing API key. A missing key parks the worker in the credential wait.

Modes and models

Amp has no model flag. A task's modelTier picks one of Amp's four modes, and Amp chooses the model behind it. Measured with amp threads usage --details on 2026-10-05, and matching ampcode.com/modes:

modelTierAmp modeAgent model
smollowGLM-5.3 Flash
regularmediumClaude Opus 5.5
smarthighGPT-6 Astra
ultraultraClaude Fable 5.1

Amp re-routes modes as models change. A concrete model such as anthropic/claude-haiku-4-5-20251001 or openai/gpt-5-nano pins that model on top of the medium mode's prompt and tools. Reasoning effort applies only to a pinned model.

Cost tracking

The swarm records, in this order:

  1. What Amp billed (costSource: 'harness'). After the session the adapter runs amp threads usage <id> --details, which runs no inference. Amp's recorded cost covers the whole thread, including subagent threads and the title requests that token counts miss. It is used only when every request was billed through Amp.
  2. Token price (costSource: 'pricing-table'). When Amp's cost is missing, or a request went through a linked provider such as a ChatGPT subscription (Amp records $0 for those and the provider bills outside Amp), the API prices the per-model tokens from amp threads export <id>.
  3. Estimate (costSource: 'estimated'). When the export is empty too, as after some cancels, the stream's token totals are priced at the mode's model from the table above. The row is never $0, so budget admission still counts it.

On short live threads the token price came out at 30 to 70% of what Amp billed, mostly because the export leaves out title requests. Prefer the harness figure when you compare spend.

On this page