Skip to main content
Let’s get an agent running. You’ll create one with its model, instructions, and tools, then start a thread with your first prompt. Grab an API key from Matrices: create a workspace, then create a key for it. You’ll also need curl and jq for the commands below. Copy the key and export it to your shell:
That one key authenticates every call below.

1. Create an agent

An agent gets its tools from the roles in its profile. Every new workspace comes with an Administrator role that grants all tools (tool:*). Grab its ID:
Now create the agent and its profile together:
That’s a complete agent:
  • identity is who it acts for, and it never changes. See Identities.
  • roleIds is where every tool comes from. See Roles.
  • models lists the models it may use, in order, as exact IDs or wildcards. See Models.
  • systemPrompt is the instructions it always carries. See Profiles.
Passing profile inline creates a profile just for this agent. Create profiles separately when several agents should share one.
To call your own tools, register a client or MCP toolset, then grant its names in a role, such as tool:workspace:billing.lookup_invoice.

2. Start a thread

Start a thread by sending the agent its first user prompt as a text content block:
The response also includes a turnId and a status. The turn runs in the background.

3. Stream the result

Connect to the thread’s event stream to watch the agent reply:
The stream is Server-Sent Events, and it’s for watching the turn as it happens. The durable record is the log at GET /v1/threads/{threadId}/events, which you can read back any time. See Threads.

What’s next

How it fits together

Every noun, and what owns what.

Build a real agent

Roles, profiles, and identity, in the order they matter.

Narrow the permissions

Cut an agent down to the tools it should have.

Connect a service

Give an agent credentials without showing the model a secret.