Skip to main content
A session is the Registry’s record of one agent run. It captures who the agent served, the conversation that happened, and how the run ended. This guide shows you how to record a completed session against a registered agent: create the session record, append a transcript, and read the session back to confirm everything is stored.

Before you begin

Before you start, make sure you have:
  • Bearer credential and shell variables: ATLAN_GATEWAY_URL and ATLAN_TOKEN set in your shell. See Connect to Agent Registry.
  • Agent ID: The AGENT_ID of a registered agent. See Register an agent if you do not have one.
  • Workspace ID: The WORKSPACE_ID the agent belongs to.
Confirm AGENT_ID is set before continuing:

Record your session

These calls create the session record, add its transcript, and confirm both are stored. Run them in order: the session must exist before you can append messages to it.
1

Create your session record

A session record holds the metadata for one agent run: which agent ran, in which workspace, when it ran, and how it ended. Use the original execution time for source_created_at, not the current time. The Registry uses this field to represent when the run actually happened.
Copy the session id from the response. You need it for every call in this guide.
2

Append your transcript

Messages are the actual conversation the agent had. sequence_number fixes the order and is zero-based. Send the user turn first, then the assistant reply.
Session and message creates are not retried automatically. A retried create produces a duplicate record. sequence_number orders messages but does not deduplicate them. Read the transcript back before appending more, and retry only when you are certain a message was not recorded.
3

Read your session back

A successful create response confirms the Registry accepted the request. A read back by ID confirms the session and its messages are stored and accessible to your credential.
Confirm the session shows the correct agent, workspace, and status. Confirm the messages list shows both turns in the right order. If either read returns an error, see Errors and retries before continuing.
4

Save your session ID

Export the session ID so it is ready without a lookup later:

See also

Inspect session: list sessions for an agent, read a session by ID, and explore its transcript and metadata. Errors and retries: error codes, causes, and when to retry.