Skip to main content
A referenced session is an earlier session that a new or running session may read. Pass its id in referenced_session_ids, and the agent gets read-only tools to search that session’s transcript, review its spend and grading, and open its deliverables. Use references to debug a failed run, pick up where earlier work stopped, or compare several attempts at the same task. The agent reads the earlier sessions directly, so you do not paste transcripts into prompts. The TypeScript samples assume the rl client from Client setup.

Before you begin

  • You need the organization developer or admin role to start a session or send it messages. See Organizations and roles and API keys.
  • You must be able to read every session you reference. References never give an agent access that you do not have.
  • Referenced sessions must be in the same organization as the session that reads them.
  • There is no console action to add a reference. Use the API. The console shows references that were added.

How references work

  • The whole tree is granted. Each id grants the session tree it belongs to: the root session and every subagent, teammate, and grading pass under it. You can pass the id of any session in the tree.
  • All or nothing. If you cannot read one of the ids, the whole request fails and nothing is recorded: no reference, no message, no new session.
  • Read-only and live. The agent cannot change a referenced session. It reads current data, so a referenced session that is still running shows its latest events.
  • Checked on every read. If a referenced session is deleted, or its access is restricted after it was added, the agent’s reads of it stop working.
  • Inherited, never widened. Subagents and teammates of the reading session can read the same sessions. They cannot add references of their own.
  • Kept for the session. You can’t remove a specific reference. Once a session holds 10, adding another drops the oldest. To drop a reference on purpose, start a new session.

Start a session with references

Send referenced_session_ids in the start request. The agent can use the read tools from its first turn.
The API answers 202 Accepted with the new session’s id:
Name the task in the message. A reference only makes the earlier session readable; the agent decides what to read based on what you ask.

Add references to a running session

Send referenced_session_ids with a user message on sendSessionEvents. The reference is recorded before the message, so the turn that the message starts can already read it. interruptAndSendSessionMessage accepts the same field.
See Session operations for delivery_state and the other message options. What success means: the session’s timeline gets a status event that names the new references, such as “This session was given read access to prior session b7e1c9a4-3d62-4f15-8a07-5c2e9f6d1b38.” A request that adds several says how many, such as “This session was given read access to 2 prior sessions.” Naming a session that is already referenced adds nothing and records no event. In the console, open the session and look under Referenced sessions on the Session tab of the details panel.

What the agent can read

When a session has at least one reference, its agent gets these read-only tools. A session with no references does not have them. When a session has more than one reference, the agent names the one it wants on each call. list_referenced_sessions gives it the ids.
Referenced transcripts can contain text written by users, tools, and websites. Treat what the agent concludes from them with the same care as any other untrusted input, and only reference sessions whose contents you are willing to show the agent.

What can go wrong

The full list of codes is in Errors.

Limits

Other limits are on Limits.

Next steps

Session operations

Send messages, interrupt, and resume sessions.

Outcomes

Read how earlier sessions were graded.

Usage and cost

Compare what earlier sessions cost.

Deliverables and artifacts

See which files a session keeps.