> ## Documentation Index
> Fetch the complete documentation index at: https://www.truefoundry.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Observability

> Inspect every agent session on TrueFoundry with cost, tokens, turns, tool calls, and end-to-end traces in one place.

Observability is one of the layers TrueFoundry adds on top of the open-source [TrueForge](https://trueforge.dev/introduction) harness (see [What TrueFoundry Adds](/docs/agent-platform/agent-harness/what-truefoundry-adds) for the rest, including [governance](/docs/agent-platform/agent-harness/what-truefoundry-adds#governance)). Every agent session runs through the AI Gateway, so each turn, tool call, and model call is captured with cost, tokens, and latency — no extra instrumentation in your agent code.

This gives you a single place to answer three questions: who is using an agent, how much each run costs, and where a run went wrong.

## Agent Sessions

Open **Agents > Sessions** in the sidebar to see every session across all your agents. Each row is one conversation, with the agent it ran against, who created it, and the cost, turns, and duration for the whole session.

<Frame caption="Agent Sessions lists every conversation across all agents, with the agent, creator, cost, turns, and duration per session">
  <img src="https://mintcdn.com/truefoundry/NBBsOgyQxZXJihpe/images/agent-sessions-list.png?fit=max&auto=format&n=NBBsOgyQxZXJihpe&q=85&s=5b187753adecd2a93a3c39082c5a390f" alt="Agent Sessions table showing sessions across agents with columns for message, agent, created by, cost, turns, and duration, filtered by agent and last 30 days" width="1024" height="584" data-path="images/agent-sessions-list.png" />
</Frame>

From this view you can:

* **Filter by agent** — narrow to a single agent to see how it is being used.
* **Filter by time range** — scope to the last 24 hours, 7 days, 30 days, or a custom window.
* **See who is using each agent** — every session shows the user or virtual account that created it.
* **Gauge cost and complexity** — turn count and dollar cost are visible per session without opening anything.

<Tip>
  You can also open the sessions scoped to a single agent from the **Agent Sessions** tab on that agent's [detail page](/docs/agent-platform/agent-harness/getting-started#saved-agent).
</Tip>

## Session detail

Click any session to open its detail view. The header summarizes the whole session, and the transcript below shows every turn in order.

<Frame caption="Session detail showing per-session metrics, the event-type timeline, and the full turn-by-turn transcript">
  <img src="https://mintcdn.com/truefoundry/NBBsOgyQxZXJihpe/images/agent-session-detail.png?fit=max&auto=format&n=NBBsOgyQxZXJihpe&q=85&s=7b24c2b6248e6108a3dd13308bb1b550" alt="Agent session detail with summary metrics for turns, duration, cost, tokens, context, tool calls, sub-agents, and errors, an event-type timeline, and the turn-by-turn conversation" width="1024" height="583" data-path="images/agent-session-detail.png" />
</Frame>

The summary metrics cover the whole session:

| Metric         | What it tells you                                                                                                       |
| -------------- | ----------------------------------------------------------------------------------------------------------------------- |
| **Turns**      | Number of request/response turns in the session                                                                         |
| **Duration**   | Total wall-clock time across all turns                                                                                  |
| **Cost**       | Total dollar cost, aggregated from every model and tool call                                                            |
| **Tokens**     | Total tokens consumed across the session                                                                                |
| **Context**    | Size of the active context, useful for spotting when [compaction](https://trueforge.dev/key-features/overview) kicks in |
| **Tool calls** | How many MCP or sandbox tools the agent invoked                                                                         |
| **Sub-agents** | How many [subagents](https://trueforge.dev/key-features/subagents) the run spawned                                      |
| **Errors**     | Count of failed steps in the session                                                                                    |

The **event-type timeline** breaks the session down by what the harness was doing at each moment — `System`, `User`, `Model`, and `Waiting on human` — so you can see at a glance where time went, including any pauses for [tool approval or user questions](https://trueforge.dev/key-features/overview).

Each turn in the transcript shows its own tokens, duration, and cost. From a turn you can open the corresponding span in [AI Monitoring](/docs/ai-gateway/analytics) to debug the underlying tool calls, reasoning steps, and latency.

## One pane of glass across the stack

Because Agent Harness runs in the same gateway plane as model and MCP traffic, agent sessions are not a separate silo — they inherit the full AI Gateway observability surface:

<CardGroup cols={2}>
  <Card title="Analytics" icon="chart-line" href="/docs/ai-gateway/analytics">
    Model, MCP, and agent traffic in one analytics view, filterable by user, team, and agent.
  </Card>

  <Card title="Request logging" icon="list" href="/docs/ai-gateway/request-logging">
    Full request and response logs for every model and tool call, subject to your redaction policy.
  </Card>

  <Card title="Export to OpenTelemetry" icon="share-nodes" href="/docs/ai-gateway/export-opentelemetry-data">
    Stream traces and metrics to your own observability backend.
  </Card>

  <Card title="Prometheus and Grafana" icon="gauge" href="/docs/ai-gateway/prometheus-grafana-integration">
    Scrape gateway metrics and build dashboards and alerts.
  </Card>
</CardGroup>

For programmatic access to aggregated agent metrics, see [Fetch Agent Metrics](/docs/ai-gateway/fetch-agent-metrics).
