Skip to main content
Let’s get an agent running from the command line. You’ll create a profile with its model, instructions, and tools, create an agent on it, then start a thread with your first prompt.

Get a key

Matrices is in early access, so there’s no self-serve sign-up yet. Once your workspace exists, its owner creates API keys in the console under Workspace → API keys. Keys belong to the workspace: one reaches every agent in it, unless the owner scoped it to a single agent. This walkthrough creates things, so use a key that isn’t scoped to an agent. You’ll also need curl and jq. Export the key:
That one key authenticates every call below.

1. Pick a role

An agent gets its tools from the roles in its profile. Every workspace starts with an Administrator role that allows every tool (tool:*). Grab its ID:
If that comes back empty, someone renamed or deleted the role. Pick another from GET /v1/roles, or create one that allows everything:

2. Create a profile

A profile is the configuration agents run on:
  • models lists the models it may use, in order: exact IDs, aliases like matrices/auto, or wildcards. See Models.
  • instructions is what the agent carries into every turn. See Profiles.
  • roleIds is where every tool comes from. See Roles.
Leaving out hooks gives the profile the default approval hooks, so risky calls like sending email wait for a person. See Hooks.

3. Create the agent

identity is who the agent acts for, and it never changes. See Identities. Several agents can share one profile. You can also send the configuration inline as profile instead of profileId, which creates a profile just for this agent.
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.

4. 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.

5. 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.