Subchapter 23.4
references/agentcore-memory-observability.mdMarkdown5 KBView on GitHub
Assets
Kb Shim PyProvides conversation state persistence for agents deployed on AgentCore Runtime.
The key non-obvious behavior: Runtime passes session IDs to the Memory service automatically when configured. You don’t call Memory directly from your agent code — Runtime handles the plumbing.
Configuration:
Session not found (expired TTL): Session expired between invocations. Increase TTL or handle gracefully in agent logic.
Session ID not passed from Runtime:
Agent loses context between requests. Verify Memory service is enabled in Runtime configuration and the client passes sessionId in invocation requests.
Memory capacity exceeded: Session has too much accumulated context. Configure memory capacity limits or implement context summarization in agent logic.
Only the AgentCore-specific parts — agents already know generic OTEL/CloudWatch patterns.
This is the key non-obvious requirement. AgentCore Evaluations service reads specific OTEL trace attributes to score agent quality. Without these, Evaluations can’t work.
Required attributes:
Instrumentation:
AgentCore publishes these metrics automatically (you don’t need to instrument):
| Metric | What It Measures |
|---|---|
| Invocation count | Number of agent invocations |
| Invocation latency | End-to-end response time (p50/p90/p99) |
| Error rate | Percentage of failed invocations |
| Token usage | Input/output tokens consumed |
Recommended alarms:
Create alarms — first discover the exact namespace (CloudWatch namespaces are case-sensitive):
aws cloudwatch list-metrics --namespace "Bedrock-AgentCore" — if no results, try --namespace "Bedrock-Agentcore"aws cloudwatch put-metric-alarm --alarm-name <name> --metric-name <metric> --namespace "<discovered-namespace>" --statistic Average --period 300 --threshold <value> --comparison-operator GreaterThanThreshold --evaluation-periods 3 --dimensions "Name=Resource,Value=<resource-arn>" --alarm-actions "<sns-topic-arn>"
Traces not appearing: OTEL collector not configured for AgentCore Runtime. Verify ADOT configuration in Runtime settings.
Evaluations can’t score: Missing required trace attributes. Verify instrumentation includes input, output, and tool call attributes.
Encryption:
Sensitive data:
IAM — least privilege:
bedrock-agentcore:CreateMemory, bedrock-agentcore:GetMemory) — avoid bedrock-agentcore:*cloudwatch:* or logs:*Alarm notifications:
aws:SourceAccount condition in the SNS topic access policy