Skip to content

Run headless (API + A2A, no UI) ​

Run protoAgent as a service and drive it through the OpenAI-compatible API or A2A. Configure a model connection first; Headless setup covers that step.

Choose a deployment; the browser is a client in each case. Desktop app / local browser → Local server + instance data → Native or HTTP model connection; Browser via host port → Container + persistent volume → Native or HTTP model connection; Remote browser / A2A client → Private server behind auth + proxy → Native or HTTP model connection
Protect remote access with authentication. Keep storage beside the server; back up its instance data.

Run it ​

bash
protoagent serve --ui none
# Source checkout:
uv run python -m server --ui none

This binds to loopback and serves the APIs and metrics without a console. To accept remote traffic, set an auth token before selecting a network bind; see Auth.

UI tiers (ADR 0010) ​

One flag picks how much UI is served; the API + A2A always run.

--uiServesFor
console (default)React console + API + A2Alocal dev, the desktop sidecar
noneAPI + A2A + /metrics onlyheadless servers, fleets, CI

full is still accepted as a deprecated alias for console (it logs a deprecation warning and behaves as console) — the old Gradio chat tier it once named has been removed.

bash
A2A_AUTH_TOKEN="$PROTOAGENT_TOKEN" protoagent serve --ui none --host 0.0.0.0 --port 7870
# or: PROTOAGENT_UI=none python -m server

(--host 0.0.0.0 to accept non-localhost traffic in a container; set an auth token first — see Auth.)

Headless setup ​

Locate the instance with protoagent config explain and provision <instance_root>/config/langgraph-config.yaml plus credentials in the same directory's secrets.yaml, then validate and serve:

bash
protoagent serve --setup    # validate the live config + mark setup, then exit
protoagent serve --ui none  # serve

In a source checkout, replace protoagent serve with uv run python -m server.

Sign in to a Claude or ChatGPT subscription, headless ​

A headless agent can hold a durable subscription credential (ADR 0097) — no console required. Codex uses a device code, and the Claude PKCE flow displays a code instead of needing a redirect listener on the box. You approve on any device and hand the result back.

bash
# 1. start a flow (token-gated operator API, so pass your bearer token)
curl -sX POST http://localhost:7870/api/config/oauth/start \
  -H "Authorization: Bearer $PROTOAGENT_TOKEN" -H "Content-Type: application/json" \
  -d '{"provider":"anthropic-oauth"}'
# → {"flow_id":"…","mode":"redirect","authorize_url":"https://platform.claude.com/oauth/authorize?…"}
#   openai-codex instead → {"mode":"device","user_code":"ABCD-…","verification_uri":"…"}

# 2. approve in a browser anywhere, then hand the code back
curl -sX POST http://localhost:7870/api/config/oauth/complete \
  -H "Authorization: Bearer $PROTOAGENT_TOKEN" -H "Content-Type: application/json" \
  -d '{"provider":"anthropic-oauth","flow_id":"…","code":"…"}'
#   device flows poll /api/config/oauth/poll instead

The credential lands in protoAgent's own store and is refreshed on use. Logins can still expire or be revoked; monitor credential status for unattended jobs.

Prefer this to CLAUDE_CODE_OAUTH_TOKEN. That variable is a bootstrap/override: it is never refreshed and cannot be inspected, so it reads healthy right up until it 401s.

Monitoring. GET /api/config/oauth-status reports each provider's expires_at (epoch seconds), refreshable, and durability — alert on those rather than waiting for a failed job to be the first signal:

durabilityMeans
managedour store, our refresh token — renews itself on use
borroweda vendor CLI's login; alive only while that person keeps using the CLI
statican env token: never refreshed, never inspectable

An idle agent may need to sign in again if its refresh credential expires. See Model connections for connection and login management.

Drive it via the OpenAI API ​

A drop-in POST /v1/chat/completions (+ GET /v1/models). Point any OpenAI client at the base URL; the "model" is the agent itself.

bash
curl http://localhost:7870/v1/chat/completions \
  -H "Authorization: Bearer $PROTOAGENT_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"messages":[{"role":"user","content":"summarize today’s PRs"}]}'

Pass "stream": true for an SSE token stream (OpenAI chunk shape). With the OpenAI SDK: set base_url to http://<host>:7870/v1 and api_key to your bearer token.

Drive it via A2A ​

protoAgent is a first-class A2A 1.0 server — the way fleets of agents talk to each other.

  • Agent card: GET /.well-known/agent-card.json (capabilities, skills, extensions).
  • JSON-RPC: POST /a2a (message/send, message/stream, tasks/* lifecycle, push notifications).

Point another protoAgent (or any A2A client) at http://<host>:7870 and it can delegate to this one — see Delegates.

Auth ​

Set an auth token and the API/A2A require Authorization: Bearer <token>:

yaml
# config/secrets.yaml
auth:
  token: "your-strong-token"

Localhost with no token is open for dev convenience; always set a token when binding to 0.0.0.0 or exposing the agent.

Pair a phone with a headless agent ​

A phone can use the console of an agent that has no screen of its own. Serve the console (the default --ui console, not --ui none) on a reachable address with a token, then run protoagent pair --device on the same machine:

bash
A2A_AUTH_TOKEN="$PROTOAGENT_TOKEN" protoagent serve --host 0.0.0.0 --port 7870
# in another shell on the same machine:
protoagent pair --device

The command prints a terminal QR, a ten-character code and the console URL. Scan the QR with the phone, or open the URL on the phone, tap Have a pairing code? and type the code.

With --ui none there is no console for the phone to open, so the agent refuses to make a phone code: protoagent pair --device prints This agent runs with --ui none, so it serves no console for a phone to open. Restart it with --ui console (the default) to pair a phone and exits 1. Agent pairing (protoagent pair) still works on a --ui none agent. The phone gets its own revocable token, so you never copy $PROTOAGENT_TOKEN onto it. See Pair a phone from a headless box.

What else runs headless ​

Everything non-UI: /metrics (Prometheus), the reactive inbox (POST /api/inbox for webhooks/cron/sister agents), the scheduler, goals, plugins, and managed MCP servers. The agent is fully operational without a screen.

See ADR 0010, Delegates, ADR 0003 (reactive inbox).

Part of the protoLabs autonomous development studio.