---
title: Monitor coding agent activity
description: Monitor coding-agent activity, model usage, and traces in Unity Gateway with the usage dashboard, usage tracking, and the unified trace table.
canonical_url: https://docs.databricks.com/aws/en/ai-gateway/coding-agent-observability
---

# Monitor coding agent activity

Monitor coding-agent adoption, token usage, and session spend with Unity Gateway. Query usage records for custom analysis, use the built-in dashboard to compare agents and investigate sessions, or inspect traces for detailed agent activity.

<a id="check-usage-in-ug-cli" />

## Check usage in ug CLI

Check your personal and shared Unity Gateway spend limits from your terminal:

```bash
ug usage
```

Example output:

```text
Your Unity Gateway spend limits

[█████████████████████████░░░░░] 85% used
Monthly personal limit (budget 8f3c2a91)
$85.00 of $100.00 used · $15.00 remaining this month

[██████████████████░░░░░░░░░░░░] 60% used
Monthly shared limit (budget 4d7b9e02)

[███████░░░░░░░░░░░░░░░░░░░░░░░] 25% used
Daily personal limit (budget 8f3c2a91)
$5.00 of $20.00 used · $15.00 remaining today
```

The output shows up to five applicable limits and the percentage used for each, ordered from highest to lowest percentage used. Run `ug usage --all` to see all applicable limits.

For more information, see the [ug CLI reference](https://docs.databricks.com/aws/en/ai-gateway/coding-agent-ug-cli.md#check-your-usage).

<a id="usage-tracking" />

## Usage tracking

Unity Gateway records model and MCP requests in `system.ai_gateway.usage`, including the requesting user, workspace, service, and status. Model requests also include model, token usage, and latency information.

The table also includes the following session metadata for coding-agent activity:

* **Session and subagent IDs**: Connect requests to a coding session and its subagents.
* **Coding agent and agent version**: Identify the agent and its reported version.
* **Surface**: A space-delimited list of surfaces representing the full client stack.
* **Reasoning effort and smart router name**: Describe the request’s reasoning configuration and reported routing recipe.

For access requirements and the complete schema, see [Track model usage](https://docs.databricks.com/aws/en/ai-gateway/usage-tracking.md). For session fields, see [Session metadata](https://docs.databricks.com/aws/en/ai-gateway/usage-tracking.md#session-metadata).

<a id="usage-dashboard" />

## Usage dashboard

Open **Unity Gateway > Govern > Usage Dashboard**, then select **Coding Agents**.

Use this tab to:

* **Track adoption**: Compare active users and sessions across coding agents.
* **Understand workflows**: See which agent harnesses developers use and which coding agents they pair them with.
* **Compare usage**: Examine average daily sessions per user, tokens per session, and subagents per session.
* **Explore model usage**: See which models are used in coding-agent sessions. A session can use more than one model.
* **Investigate session spend**: Review **Top 1000 Sessions by Est. Spend** to identify high-spend sessions and examine their users, models, services, token usage, and subagents.

Use the **Coding Agents** selector to focus on specific agents. Session metrics reflect activity within the selected dates. Session duration includes idle time between recorded calls; it does not measure active coding time.

![Coding agent dashboard](https://docs.databricks.com/aws/en/images/ai-gateway/coding-agent-dashboard.png)

If a dashboard has not been created, an account admin can create it from **Govern > Create Usage Dashboard**. See [Built-in usage dashboard](https://docs.databricks.com/aws/en/ai-gateway/usage-tracking.md#built-in-usage-dashboard).

<a id="smart-routing-dashboard" />

### Smart Routing tab

> [!NOTE]
> **Beta**
>
> [Smart Routing](https://docs.databricks.com/aws/en/ai-gateway/coding-agent-costs.md#understand-smart-routing) is in [Beta](https://docs.databricks.com/aws/en/release-notes/release-types.md). An account admin must enable the **Enhanced Unity Gateway** preview from the account console **Previews** page. See [Manage Databricks previews](https://docs.databricks.com/aws/en/admin/workspace-settings/manage-previews.md).

Open **Unity Gateway > Govern > Usage Dashboard**, then select **Smart Routing**.

Use this tab to:

* **Track savings**: See how much spend Smart Routing saved in total, as a percentage, and by week.
* **Measure adoption**: Compare the daily sessions and users that are fully smart routed against those that are not.
* **Monitor opt-outs**: See the percentage of sessions in which the user opted out of Smart Routing at least one time.
* **Compare model mix**: Compare the share of tokens by model family for smart-routed and non-smart-routed requests, and see how the mix changes over time.

Savings are estimates. The dashboard compares the list-price cost of smart-routed requests against the cost of running the same requests on a baseline model: GPT-6.1 Sol for Codex and Claude Opus 5.5 for Claude Code. Estimated savings subtract the cost of the routing calls themselves. If the baseline model costs less than the models Smart Routing selected, estimated savings can be negative.

If the **Smart Routing** tab doesn't appear, an account admin can update the dashboard to the latest template. See [Update the dashboard](https://docs.databricks.com/aws/en/ai-gateway/usage-tracking.md#update-the-dashboard).

![Smart Routing dashboard](https://docs.databricks.com/aws/en/images/ai-gateway/smart-routing-dashboard.png)

<a id="tracing" />

## Tracing

> [!NOTE]
> **Beta**
>
> The unified trace table is in [Beta](https://docs.databricks.com/aws/en/release-notes/release-types.md). An account admin must enable the **Enhanced Unity Gateway** preview from the account console **Previews** page. See [Manage Databricks previews](https://docs.databricks.com/aws/en/admin/workspace-settings/manage-previews.md).

The unified trace table stores gateway request traces and client-side agent traces in the same Unity Catalog table:

* **Gateway traces** capture model and MCP requests handled by Unity Gateway. Collection starts when you enable unified tracing.
* **Client-side traces** capture activity emitted by the coding agent on the developer's machine. Enable them through the Unity Gateway CLI to add agent execution details to the same table.

<a id="unified-tracing" />

### Set up unified tracing

With the **Enhanced Unity Gateway** preview enabled, a metastore admin creates the trace table once for workspaces attached to the metastore:

1. Open **Unity Gateway > Observability > Traces** and click **Configure tracing**.
2. Select the catalog and schema for the trace table.
3. Click **Save**.

Traces are stored at the Unity Catalog location selected during setup: `<catalog>.<schema>.<table>`. Open **Observability > Traces** to inspect them, or query the table in Databricks SQL. The table owner must grant access before other users can query it.

![Traces view showing Claude Code and model requests in the same unified trace table](https://docs.databricks.com/aws/en/images/ai-gateway/coding-agent-tracing.png)

For access controls and query examples, see [Monitor all AI activity using the unified trace table](https://docs.databricks.com/aws/en/ai-gateway/unified-trace-table.md). For columns and span attributes, see the [Unified trace table schema reference](https://docs.databricks.com/aws/en/ai-gateway/unified-trace-table-reference.md).

During Beta, the unified trace table has some limitations. See [Limitations](https://docs.databricks.com/aws/en/ai-gateway/unified-trace-table.md#limitations).

<a id="client-side-tracing" />

### Enable client-side tracing

The Unity Gateway CLI configures Claude Code, Codex, and GitHub Copilot (CLI and Visual Studio Code) to send their traces to the unified trace table you set up above.

In your [coding agent configuration](https://docs.databricks.com/aws/en/ai-gateway/coding-agent-configure-govern.md#publish-a-configuration), add the following setting inside each supported agent's existing `config` object, then publish the update:

```json
{
  "tracing": {
    "enabled": true
  }
}
```

Developers launch the agent through `ug claude`, `ug codex`, or `ug copilot`. The CLI applies the tracing setting and configures the export endpoint and authentication. For GitHub Copilot in Visual Studio Code, developers run `ug configure` and restart Visual Studio Code. To apply an update immediately, see [Sync configuration updates](https://docs.databricks.com/aws/en/ai-gateway/coding-agent-configure-govern.md#apply-the-configuration).

To send client-side traces from your own applications to the unified trace table, see [Send client-side traces from your application](https://docs.databricks.com/aws/en/ai-gateway/unified-trace-table.md#send-client-side-traces).

<a id="next-steps" />

## Next steps

* [Configure coding agents centrally](https://docs.databricks.com/aws/en/ai-gateway/coding-agent-configure-govern.md)
* [Manage budgets](https://docs.databricks.com/aws/en/ai-gateway/budgets.md)
