Skip to main content
Six things people build with the Agent API. Each one is a complete working program, not a sequence of fragments — copy it, run it, then change the parts that are about your business rather than ours. The quickstart gets you from a token to a completed turn. These go further, and each leans on a different part of the platform, so reading two of them is not reading the same thing twice. Every script here is standard library only. No SDK to install, in any language.

Before any of them

Mint the token in the Console under Settings › Developer access, choosing Agent API · read/write. The default CLI import type holds only the cli scope and is refused by every /v1 route. Then connect a model — POST /v1/model-credentials, or the Console under Settings › LLM models. Gobare is bring-your-own-key: the model bill is yours, the computer is ours. One call proves all three:
A list back means your token is valid, scoped, and has a model to run. The model in it is what goes in agent.model.

Four things that will save you an afternoon

These are not trivia. Each one is a mistake that costs hours because it produces plausible behaviour rather than an error. Wait for artifacts, not for the turn. Files the agent writes under /workspace/outputs are published after the turn settles, so for a moment after status: "completed" the artifact list is legitimately empty — and indistinguishable from a turn that produced nothing. Poll the turn’s artifacts field until it leaves pending. With webhooks you can ignore this: turn.completed is sent once publishing has finished. Subscribe before you send. Open the event stream first, then post the message. The other order loses the opening frames whenever the agent starts quickly — which is to say intermittently, and never on your machine. Tell the agent not to ask questions, if nothing in your product can answer one. An agent that meets ambiguity parks on a question and waits. You can answer it — input.question_answer, see input.md — but an unattended pipeline with nobody to ask is better off never reaching that state. One line in instructions prevents it:
Two 429s mean opposite things. rate_limit_exceeded is worth retrying; project_limit_exceeded means the organization is at its session ceiling and retrying never clears it. Branch on error.code, never on the status alone.

The reference

The guides show a shape; the reference pages have every field. run-session.ts is a TypeScript client that handles the first two afternoon-savers above, plus answering the agent’s calls into your code. It is the same file our own end-to-end tests run against, so it cannot quietly stop working.