

# See your first agent cost in the console

When you have an agent running on AgentCore, you want to see its estimated cost in the console within minutes, so you know the feature is working before you invest in any setup. This page takes you to a first cost figure.

## Prerequisites
<a name="_prerequisites"></a>
+ An agent running on Amazon Bedrock AgentCore in a Region where the feature is available.
+ Telemetry produced by the AWS Distro for OpenTelemetry (ADOT). On the AgentCore managed harness and on AgentCore Runtime, this is the default. If you are not sure, see [Choose your setup path](acv-choose-your-setup-path.md).
+ Amazon CloudWatch Transaction Search turned on for the account and Region. It is **not on by default**: it is per account and per Region, and you must turn it on first. See [Turn on CloudWatch Transaction Search](#acv-turn-on-transaction-search).

Agents on the managed harness and on AgentCore Runtime show cost with no extra configuration. A self-hosted agent needs setup first; see [Self-hosted compute](acv-self-hosted-compute.md).

## Turn on CloudWatch Transaction Search
<a name="acv-turn-on-transaction-search"></a>

CloudWatch Transaction Search is not on by default. It is per account and per Region, and you must turn it on before AgentCore can deliver spans for cost. Use one of the following procedures.

**Example**  

**To turn on CloudWatch Transaction Search in the CloudWatch console**

1. Open the [CloudWatch](https://console.aws.amazon.com/cloudwatch) console.

1. In the navigation pane, expand **Application Signals (APM)** and choose **Transaction search**.

1. Choose **Enable Transaction Search**.

1. Select the checkbox to ingest spans as structured logs.

1. Choose **Save**.

**To turn on CloudWatch Transaction Search using an API**

1. Add a CloudWatch Logs resource policy that lets AWS X-Ray (`xray.amazonaws.com`) write spans to the `aws/spans` log group, with [PutResourcePolicy](https://docs.aws.amazon.com/xray/latest/api/API_PutResourcePolicy.html).

1. Set the trace segment destination to CloudWatch Logs:

   ```
   aws xray update-trace-segment-destination --destination CloudWatchLogs
   ```

**Note**  
After you turn it on, the status can stay `PENDING` for more than 5 minutes. Per-resource tracing deliveries fail until the status is `ACTIVE`.

## Step 1: Open the cost view
<a name="_step_1_open_the_cost_view"></a>

 **To open the cost view (console)** 

1. Open the [AgentCore](https://console.aws.amazon.com/bedrock-agentcore) console and choose **Observability** in the left navigation.

1. Use the **Agent** and **Endpoint** selectors to scope the view, and set the **Date range**. The default is **Last 7 days** on the account-wide Observability page. A single resource’s own Observability tab opens on the last 24 hours.

1. Choose the **Cost** tab to see the **Estimated cost ($)** panel.

The Observability page shows cost summary metrics, including **Total token cost**, **Total cost**, and **Avg cost / session**, and the view tabs **Overview**, **Sessions**, **Traces**, and **Spans**. The **Cost** tab shows estimated cost by session or by resource type, a session-cost-over-time chart, and a cost-by-agent list.

## Step 2: Read the total and one agent
<a name="_step_2_read_the_total_and_one_agent"></a>

 **To read the total and one agent’s cost (console)** 

1. Read the **Total cost** for the range.

1. On the **Cost** tab, in the **Cost by agent** list, find one agent and read its estimated cost. The list is ordered by cost, highest first.

## Step 3: Open one session
<a name="_step_3_open_one_session"></a>

 **To open one session (console)** 

1. Use the **Agent** selector to scope the view to one agent.

1. Choose the **Sessions** view and sort by the **Total cost** column to surface the costliest sessions.

1. Choose a session’s **Session ID**. The view switches to the **Traces** view filtered to that session. There is no separate session page; the session’s total is its **Total cost** value in the **Sessions** view.

To go further into a single session, see [Investigate an agent session’s cost](acv-see-what-one-session-cost.md).

## Why a figure may show a dash
<a name="_why_a_figure_may_show_a_dash"></a>

A missing figure appears as a dash, never as `$0`. A dash can mean the cost could not be priced (for example, a model with no public price, or a non-commercial partition), a dimension that is not covered, or work that ran before you set up cost. See [A cost shows a dash instead of a figure](acv-cost-shows-a-dash.md).

## Next steps
<a name="_next_steps"></a>
+  [Publish cost as CloudWatch metrics](acv-turn-on-cost-metrics.md) 
+  [Set up cost for a less-managed agent](acv-choose-your-setup-path.md) 
+  [How cost estimates are calculated](acv-how-agent-cost-is-calculated.md) 