> For the complete documentation index, see [llms.txt](https://docs.otari.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.otari.ai/guides/observe/sessions.md). Agents can also search and read this documentation through its [MCP server](https://docs.otari.ai/~gitbook/mcp).

# Sessions

A session is one run of an agent: its turns, the model requests and the tools it ran, with how long each took and what it cost. Otari records one for the requests it serves, so you can see what an agent did, not only what one call did.

## Look at a session

1. Open **Sessions**.

   ![Sessions, listing a support-agent session with its last activity, user and latency.](https://3767611443-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxhXE3CfJCVXiSVyn0KRC%2Fuploads%2Fgit-blob-63c7624425d21663974b4e60ef9b94cf40634474%2Fsessions-list.png?alt=media)
2. Click a session to open it.

   ![A session open in its side panel, with the agent's turn and its search\_docs tool call.](https://3767611443-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxhXE3CfJCVXiSVyn0KRC%2Fuploads%2Fgit-blob-e01bb8d5ce03d2f4cf8fff4a7913858fb2b3699e%2Fsessions-panel.png?alt=media)

Where Otari has a logo for the agent that ran a session, it shows it beside the session's name, in the list and at the top of its panel. A session sent by an SDK or a plain HTTP library instead shows the logo of the language it was written in (Python, JavaScript, Go, Java, Rust or Ruby), where Otari can tell it, and its panel names the client with its version where the client gives one, such as `openai 2.30.0`.

The **Sessions** and **Requests** views share one time range and the user, API key, model and status filters. A session opens on **At a glance**, which splits its time and cost, and shows what filled the model's context window. Pick a span to see its details, or switch to the timeline or the flat log. From the **Requests** view, **View trace** on a request opens its session on that call.

## Collect sessions

Otari records sessions for the completions it serves, which is on by default. On a deployment you run, [Store agent traces](https://docs.otari.ai/self-hosting/operations/trace-storage) says how to turn it off or change how long sessions are kept.

* **Claude Code, Codex, opencode, Amp, goose, Kilo Code, Crush, pi, Roo Code, Mistral Vibe and OpenHands** are recognized automatically when they route through Otari, by the session id each one sends ([the full list](https://docs.otari.ai/reference/gateway/sessions-reference#what-makes-a-session)). oh-my-pi sends one only on the Anthropic API, from version 18.1.6; on other APIs each of its requests is a session of its own. Hermes Agent and OpenClaw send one once it is turned on ([how](https://docs.otari.ai/reference/gateway/sessions-reference#agents-that-send-a-session-id-when-asked)). Claude Code can also send its sessions without routing its model traffic; see [Send Claude Code sessions to Otari](https://docs.otari.ai/guides/integrations/claude-code.md#send-claude-code-sessions-to-otari).
* **Your own agent** sends the same `Otari-Conversation-Id` header on every request of one run, tool-result follow-ups included. Give each run, and each subagent, its own id. A request without the header is a session of its own.

  ```bash
  curl https://api.otari.ai/api/v1/chat/completions \
    -H "Authorization: Bearer $OTARI_API_KEY" \
    -H "Otari-Conversation-Id: support-chat-1042" \
    -H "User-Agent: support-agent/1.0" \
    -H "Content-Type: application/json" \
    -d '{"model": "anthropic:claude-sonnet-4-6", "messages": [{"role": "user", "content": "Where is my order?"}]}'
  ```

  The first product token of `User-Agent` names the agent in the list.
* **An agent instrumented with OpenTelemetry** exports its spans to Otari; see [Import usage from outside Otari](https://docs.otari.ai/guides/observe/external-usage.md#opentelemetry).

Every signal that groups requests into a session is in [What makes a session](https://docs.otari.ai/reference/gateway/sessions-reference#what-makes-a-session).

## Keep what a session was about

By default a session keeps no prompt, command or file path. A workspace owner or admin, or an organization owner or admin, can turn that on where the deployment allows it:

1. Open **Workspaces** and click the workspace.
2. On its **General** tab, turn on **Keep what agent sessions were about**.

Where the deployment also keeps tool output, a second switch, **Keep what tools returned**, is shown, on by default. The client has to send content too: a routed request sends the header `Otari-Trace-Content: keep`, and Claude Code sends it with `OTEL_LOG_USER_PROMPTS=1` and `OTEL_LOG_TOOL_DETAILS=1`. Content is stored encrypted.

What is kept is private to the session's user. They can share a session with their organization's admins from the session itself; who else can read it, and when, is in [Who reads content](https://docs.otari.ai/reference/gateway/sessions-reference#who-reads-content).


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.otari.ai/guides/observe/sessions.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
