Build your first agent
An agent is the top-level unit in Rightbrain. It reasons over an input and calls tools to do real work. This quickstart creates an agent, makes the task you built available to it as a tool, runs it over the API, and streams every step. It reuses the RB_TOKEN, RB_ORG, RB_PROJECT, RB_TASK, and RB_MODEL variables from the previous pages.
Need the task first? Follow Create a task, then come back with its id in RB_TASK.
Step 1: Create the agent
POST to the task-agent endpoint. The instruction is the agent’s standing brief. task_tools attaches your task as a callable tool — with revision_strategy: "follow_active", the tool always runs whatever revision of the task is currently active. Marking a task tool is_output_formatter makes it produce the run’s final structured output.
The 201 response is the agent, created with an active revision that snapshots this wiring. Save its id:
Each task_tool can also carry action_mode: "require_approval" to pause the run for human sign-off before that tool executes. See Approvals (HITL).
Step 2: Run it and stream the events
Running an agent is different from running a task: an agent takes turns and calls tools, so its run streams back as Server-Sent Events rather than a single response body. Send a message, and pass -N to curl so it doesn’t buffer the stream.
Step 3: Follow the stream
Each event is one SSE frame — a data: line with a JSON object, terminated by a blank line. The JSON always carries an event_type. A representative sequence for this agent:
The session_id from the first (and done) event lets you continue the conversation: pass it back as session_id on the next run. A run ends in one of running, waiting_for_human, completed, or failed. See Run agents via the API for multi-turn sessions, file inputs, and approval pauses.
Step 4: Fetch the run afterward
The stream is the live view. Every run is also recorded, so you can read a completed run — or its full event transcript — with a plain GET. This is what you reach for when a client disconnected mid-stream, or you need the record later.
These runs are also visible in your dashboard, but everything you need to run and observe an agent is available over the API.
You’ve created an agent, made a task available to it, run it over the API, streamed its work, and fetched the recorded run. That’s the whole loop: build, run, observe — no UI required.
Where to go next
How agents use the tasks, skills, collections, and connections you make available.
Pause runs on sensitive tool calls and resume after review.
Multi-turn sessions, file inputs, and the full event reference.
Start agent runs from webhooks, schedules, and inbound email.