

# Trace sources

 AWS Context learns from two sources of traces: the agents built into AWS Context, and the traces that your own agents submit with the `PutTrace` API.

Your agents can submit traces in the following formats:
+  `OTEL` – OpenTelemetry traces in OTLP/JSON.
+  `ANTHROPIC` – Claude Code session logs.
+  `BEDROCK_CONVERSE` – Amazon Bedrock Converse messages.
+  `KIRO` – Kiro IDE or Kiro CLI session logs.

 `BEDROCK_CONVERSE` also works as a general format. Any conversation works in this format if each message is a JSON object with a `role` and a `content` field, sent as one trace document per message. The role is `user` or `assistant`, and the content is a plain string or a list of text blocks. For example, a conversation of one user turn and one assistant turn is the following two trace documents, shown one per line:

```json
{"role": "user", "content": "How many units can we still sell from Atlanta?"}
{"role": "assistant", "content": "48,510 units."}
```

## AWS Context agent traces
<a name="feedback-agentic-traces"></a>

Trace analysis can learn from the agents built into AWS Context, such as the Context retrieval agent that answers your agentic retrieval requests (`AgenticRetrieve` and `AgenticRetrieveStream`). AWS Context records these traces itself, so your agents don’t submit anything.

 AWS Context records an agent trace for a request when all of the following are true:
+  **Include AWS Context agent traces** is selected for your Agent Context, with trace analysis turned on. For more information, see [Turn on trace analysis](feedback-turn-on.md).
+ The request is made for an end user (see [End-user identity propagation](identity-propagation.md)). AWS Context doesn’t record a trace for a request without a user identity. For more information, see [Readers of AWS Context agent traces](feedback-visibility.md#feedback-visibility-agent-traces).
+ The request doesn’t turn off its own trace (see [Agentic retrieval](agentic-retrieval.md)).
+ The request isn’t part of a context evaluation (see [Evaluating context](evaluating-context.md)).

To group the traces of related requests into one session, set the same `sessionId` on each request (see [Sessions](feedback-how-it-works.md#feedback-sessions)).

Learnings from these traces are proposed like any other change. They pass through your curation policies before any agent sees them (see [Review proposals and quality signals](review-proposals.md)).

## Traces from your agents
<a name="feedback-puttrace"></a>

Your agent submits its own execution traces with the `PutTrace` API so that trace analysis can learn from them. Each request carries one or more *trace documents*, such as the records of the agent’s session log. The request names the target Agent Contexts in `agentContextArns` and declares the format of the trace documents in `format`, which is one of the supported trace formats. A request without a user identity must also name the readers of its learnings in `accessControlConfig` (see [Who can see learnings from your traces](feedback-visibility.md)).

Turn on trace analysis for each Agent Context that the request names (see [Turn on trace analysis](feedback-turn-on.md)). Submitting traces doesn’t change an Agent Context directly. The learnings from the feedback loop arrive as proposed changes, and your curation policies govern them like any other change.

For more information about the request fields, see [`PutTrace`](https://docs.aws.amazon.com/context/latest/APIReference/API_PutTrace.html) in the * AWS Context API Reference*.

The following example submits two trace documents of a Kiro session and lets every reader of the Agent Context see the learnings.

```bash
aws context put-trace --cli-input-json '{
  "agentContextArns": ["arn:aws:context:us-east-1:111122223333:agent-context/ac-EXAMPLE11111"],
  "format": "KIRO",
  "sessionId": "my-session-1",
  "traceDocuments": ["<base64-encoded-document-1>", "<base64-encoded-document-2>"],
  "accessControlConfig": {
    "accessControlList": [ { "access": "ALLOW", "principalId": "*" } ]
  }
}'
```

Replace the Region, the account ID, the Agent Context ID, the session ID, and the two documents with your own values.