agentcore-investigation
Skill9.8k starsChanged 3 months agoApache-2.0View on GitHub
Investigate Bedrock AgentCore runtime sessions via CloudWatch Logs Insights — resolve session/trace IDs, query OTEL spans, filter noise, build timelines. Use when debugging AgentCore agent sessions, tracing tool calls, or analyzing latency.
Trending
More talk lately.about the whole repository
Who's talking about awslabs/mcp
- A Hacker News story“Vibe coding tips and tricks”Hacker News · Aug 18, 2025 · 227 points
- @wernervogels.bsky.social“A collection of open source #AWS MCP servers is available at #awslabs github.com/awslabs/mcp”Bluesky · Apr 4, 2025 · 25 likes
- A Hacker News story“AWS MCP Servers”Hacker News · Jul 29, 2025 · 22 points
- @danilop.bsky.social“🔗 Check out AWS MCP Servers – A suite of specialized MCP servers that bring AWS best practices directly to …”Bluesky · Apr 1, 2025 · 13 likes
- A Hacker News story“AWS MCP Servers”Hacker News · Apr 3, 2025 · 11 points
The biggest 5 of 32 mentions linking to the repository that our crawl found. Each line is their own headline.
See all 32
Talked about on GitHub, Bluesky and Hacker News (32 times).
On GitHub · 21
- Jun 10, 2025[FEATURE REQUEST] Add local MCP Compatability — aws-samples/bedrock-engineer4 reactions
- Oct 7, 2025[FEATURE]Generic tool which supports all OpenSearch API — opensearch-project/opensearch-mcp-server-py3 reactions · 2 comments
- Sep 3, 2025[COMMUNITY] Auto generate CHANGELOG, including adding contributors for each release — microsoft/mcp2 reactions · 4 comments
- Jul 14, 2025[Server Submission]: awslabs.aws-api-mcp-server — cline/mcp-marketplace2 reactions
- Apr 11, 2025bug: MCP server to aded to q-cli — aws/amazon-q-developer-cli2 reactions · 4 comments
16 more on GitHub
- Apr 1, 2025[Server Submission]: awslabs-cdk-mcp-server — cline/mcp-marketplace2 reactions · 1 comment
- Oct 1, 2026check-links: ask each URL once per run, and let a probe surface that says nothing fall through to the pair every other URL gets — PublicAgents/public-agents1 reaction · 4 comments
- Sep 18, 2026check-links: a machine endpoint (surfaces.mcp, surfaces.api) that answers GET with an off-host redirect is alive (refiled on current main, replaces #42) — PublicAgents/public-agents1 reaction · 3 comments
- Aug 21, 2026fix(vscode): remote config MCP settings — cline/cline1 reaction · 2 comments
- Jan 16, 2026`uv` Used to Group Now it Doesn't — dependabot/dependabot-core1 reaction · 2 comments
- Dec 22, 2025Incomplete configuration for awslab mcp servers executed by MCP Toolkit? — docker/mcp-registry1 reaction · 1 comment
- Sep 13, 2025記事の校閲エージェントを作成する — onc-limb/knowledge-hub1 reaction
- Sep 18, 2026AWS API MCP is entering End of Development. Need to be migrated to AWS MCP Server. — HolmesGPT/holmesgpt0 reactions
- Jul 6, 2026pre-commit: check-vcs-permalinks fails on non-permalink GitHub URLs in docs — awslabs/agent-plugins0 reactions · 2 comments
- Dec 10, 2025Review tools present on Kubernetes MCP's — kagent-dev/tools0 reactions · 2 comments
- Nov 9, 2025Check trending repo: awslabs/mcp — uibm/trending-watcher0 reactions · 1 comment
- Nov 8, 2025Check trending repo: awslabs/mcp — uibm/trending-watcher0 reactions · 1 comment
- Sep 3, 2025add Cosmos DB Datamodeling Prompt to Azure /Cosmos MCP as a tool — AzureCosmosDB/cosmosdb-agent-hub0 reactions
- Aug 13, 2025"Connection to rekor.sigstore.dev timed out" — pypa/gh-action-pypi-publish0 reactions · 5 comments
- Jun 28, 2025Diagram-as-Code — alkanoic/AspNetCoreSample0 reactions
- May 12, 2025[azsdk-cli] Investigate prompt understanding approach for azsdk tools — Azure/azure-sdk-tools0 reactions
On Bluesky · 6
- Apr 4, 2025A collection of open source #AWS MCP servers is available at #awslabs github.com/awslabs/mcp — @wernervogels.bsky.social25 likes and reposts · 1 reply
- Apr 1, 2025🔗 Check out AWS MCP Servers – A suite of specialized MCP servers that bring AWS best practices directly to your development workflow. Get… — @danilop.bsky.social13 likes and reposts · 2 replies
- Nov 7, 2025📦 awslabs / mcp ⭐ 6,966 (+14) 🗒 Python AWS MCP Servers — helping you get the most out of AWS, wherever you use MCP. — @github-trending.bsky.social1 likes and repost
- Aug 19, 2025🔥 Hot Repo! 🔥 (100+ new stars) 📦 awslabs / mcp ⭐ 5,550 (+132) 🗒 Python AWS MCP Servers — helping you get the most out of AWS, wherever… — @github-trending.bsky.social1 likes and repost
- Apr 2, 2025GitHub - awslabs/mcp: AWS MCP Servers — specialized MCP servers that bring AWS best practices directly to your development workflow… — @tech-trending.bsky.social1 likes and repost
1 more on Bluesky
- Nov 6, 2025If you didn't know, AWS offers many official MCP servers 🪄 This includes AWS knowledge, infrastructure automation, database management,… — @tpschmidt.com0 likes and reposts · 1 reply
On Hacker News · 5
- Aug 18, 2025Vibe coding tips and tricks227 points · 93 comments
- Jul 29, 2025AWS MCP Servers22 points · 3 comments
- Apr 3, 2025AWS MCP Servers11 points · 4 comments
- Apr 4, 2025A collection of open source AWS MCP servers is available at awslabs3 points
- Jul 16, 2025AWS Pricing MCP Server2 points
In this repository7 other files it gives its agents.
- src/dynamodb-mcp-server/AGENTS.mdAGENTS.md
- amazon aurora dsqlSkill
- aurora dsqlSkill
- aws dsqlSkill
- distributed postgresSkill
- distributed sqlSkill
- dsqlSkill
The file
We split this skill into the rules it gives an agent
11 rules. About 0 are common, 6 are distinctive, and 5 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈6
Distinctive · estimate
This author's own choices. Worth a look.
5
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 25
When: ALWAYS load before starting an investigation — ensures CloudWatch and Application Signals MCP servers are configured
- Distinctive: line 33
When: ALWAYS load before querying or filtering OTEL spans
- Distinctive: line 40
When the user provides a sessionId, resolve it to traceId(s) first.
- Very specific: line 76
Use describe_log_groups with logGroupNamePrefix /aws/bedrock-agentcore/runtimes to find all runtime log groups.
- Very specific: line 94
If a dedicated otel-rt-logs group exists, prefer it for structured queries.
- Very specific: line 98
When using parse @message on combined log groups, prefer glob-style parse — it is simpler and avoids escaping issues:
- Very specific: line 110
Run all 6 query types for a complete investigation.
- Very specific: line 114
Every query MUST include | limit to prevent context window overflow:
- Distinctive: line 279
After retrieving query results:
- Distinctive: line 281
Remove entries matching DROP patterns (count removed)
- Distinctive: line 282
Keep entries matching KEEP patterns
≈ “Common” is an estimate: at least 1 in 5 of the 213,897 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
AgentCore Runtime Session Investigation
Investigate AgentCore runtime sessions by querying CloudWatch Logs Insights, filtering OpenTelemetry noise, and producing structured investigation output.
Key capabilities:
- Session-to-trace resolution via OTEL span correlation
- Structured and glob-style parse queries for both dedicated and combined log groups
- OpenTelemetry noise filtering with AgentCore-specific heuristics
- Timeline construction with T+offset format
- Error, tool invocation, token usage, and latency analysis
Reference Files
Load these files as needed for detailed guidance:
MCP:
mcp-setup.md
When: ALWAYS load before starting an investigation — ensures CloudWatch and Application Signals MCP servers are configured Contains: MCP server configuration for CloudWatch Logs and Application Signals, with setup instructions for Claude Code, Gemini, Codex, and Kiro CLI
.mcp.json
When: Load when setting up MCP servers for the first time Contains: Sample MCP configuration with both CloudWatch and Application Signals servers
otel-span-schema.md
When: ALWAYS load before querying or filtering OTEL spans Contains: Field extraction priorities, known instrumentation scopes, noise filtering heuristics (DROP/KEEP patterns)
Phase 0: SessionId-to-TraceId Resolution
When the user provides a sessionId, resolve it to traceId(s) first. If user provides traceId directly, skip this phase.
Discovery Query (structured fields)
fields traceId, @timestamp
| filter attributes.session.id = "SESSION_ID"
| stats count(*) as spanCount, min(@timestamp) as firstSeen, max(@timestamp) as lastSeen by traceId
| sort firstSeen ascDiscovery Query (combined log group — glob-style parse)
fields @timestamp, @message
| parse @message '"traceId":"*"' as traceId
| parse @message '"session.id":"*"' as sessionId
| filter sessionId = "SESSION_ID" or @message like "SESSION_ID"
| stats earliest(@timestamp) as firstSeen, latest(@timestamp) as lastSeen, count(*) as spanCount by traceId
| sort firstSeen asc
| limit 50Latest Interaction Only
fields traceId
| filter attributes.session.id = "SESSION_ID"
| sort @timestamp desc
| limit 1Store discovered traceId(s) and use them in ALL subsequent queries.
Phase 1: Discover Log Groups
Use describe_log_groups with logGroupNamePrefix /aws/bedrock-agentcore/runtimes to find all runtime log groups.
Log group naming patterns (in priority order):
- /aws/bedrock-agentcore/runtimes/<agent_id>-<endpoint_name>/otel-rt-logs (structured OTEL spans)
- /aws/bedrock-agentcore/runtimes/<agent_id>-<endpoint_name>/[runtime-logs] (stdout/stderr)
- /aws/bedrock-agentcore/runtimes/<agent_id>-<endpoint_name>-DEFAULT (single combined group)Log Group Layouts
AgentCore runtimes always emit OTEL spans. Some deployments split logs into a dedicated otel-rt-logs sub-group; others write everything into a single combined log group. Both are normal.
| Log Group Layout | Query Strategy |
Dedicated otel-rt-logs exists | Use structured field queries (traceId, attributes.session.id, etc.) |
| Single combined log group | Try structured fields first — if they return 0 results, use glob-style parse @message |
If a dedicated otel-rt-logs group exists, prefer it for structured queries.
Parse Syntax Guidance
When using parse @message on combined log groups, prefer glob-style parse — it is simpler and avoids escaping issues:
| parse @message '"name":"*"' as spanName
| parse @message '"traceId":"*"' as traceId
| parse @message '"startTimeUnixNano":"*"' as startNanoRegex parse (/pattern/) is valid CloudWatch Logs Insights syntax but requires careful escaping of quotes and special characters inside JSON. If glob-style parse extracts the field you need, use it.
Phase 2: Query CloudWatch Logs Insights
Run all 6 query types for a complete investigation. Each query has a structured version (for dedicated otel-rt-logs) and a glob-style parse version (for combined log groups).
Query Size Limits
Every query MUST include | limit to prevent context window overflow:
- Session overview:
| limit 50 - Span details:
| limit 100 - Errors:
| limit 50 - Tool invocations:
| limit 100 - Token usage:
| limit 50 - Latency outliers:
| limit 20
Query 1: Session Overview
Structured:
fields @timestamp, traceId, spanId, parentSpanId, name, scope.name,
attributes.session.id, attributes.gen_ai.operation.name, attributes.gen_ai.agent.name,
startTimeUnixNano, endTimeUnixNano
| filter traceId = "TRACE_ID"
| sort startTimeUnixNano asc
| limit 50Combined log group:
fields @timestamp, @message
| filter @message like "TRACE_ID"
| parse @message '"name":"*"' as spanName
| parse @message '"traceId":"*"' as traceId
| parse @message '"spanId":"*"' as spanId
| parse @message '"startTimeUnixNano":"*"' as startNano
| parse @message '"endTimeUnixNano":"*"' as endNano
| sort @timestamp asc
| limit 50Query 2: Span Details with Duration
Structured:
fields @timestamp, traceId, spanId, parentSpanId, name, scope.name,
startTimeUnixNano, endTimeUnixNano,
(endTimeUnixNano - startTimeUnixNano) / 1000000 as durationMs,
status.code, attributes.gen_ai.operation.name
| filter traceId = "TRACE_ID"
| filter ispresent(startTimeUnixNano)
| sort startTimeUnixNano asc
| limit 100Combined log group:
fields @timestamp, @message
| filter @message like "TRACE_ID"
| parse @message '"name":"*"' as spanName
| parse @message '"spanId":"*"' as spanId
| parse @message '"parentSpanId":"*"' as parentSpanId
| parse @message '"startTimeUnixNano":"*"' as startNano
| parse @message '"endTimeUnixNano":"*"' as endNano
| parse @message '"statusCode":"*"' as statusCode
| sort @timestamp asc
| limit 100Query 3: Errors
Structured:
fields @timestamp, traceId, spanId, name, status.code, status.message,
attributes.error.message, attributes.exception.message, attributes.exception.type
| filter traceId = "TRACE_ID"
| filter status.code = 2 OR ispresent(attributes.error.message) OR ispresent(attributes.exception.message)
| sort @timestamp asc
| limit 50Combined log group:
fields @timestamp, @message
| filter @message like "TRACE_ID"
| filter @message like /ERROR|exception|Exception|fault|STATUS_CODE_ERROR/
| parse @message '"name":"*"' as spanName
| parse @message '"statusCode":"*"' as statusCode
| parse @message '"startTimeUnixNano":"*"' as startNano
| sort @timestamp asc
| limit 50Query 4: Tool Invocations
Structured:
fields @timestamp, traceId, spanId, name, scope.name,
attributes.gen_ai.operation.name, attributes.tool.name,
startTimeUnixNano, endTimeUnixNano,
(endTimeUnixNano - startTimeUnixNano) / 1000000 as durationMs
| filter traceId = "TRACE_ID"
| filter attributes.gen_ai.operation.name = "execute_tool" OR ispresent(attributes.tool.name) OR name like /tool/
| sort startTimeUnixNano asc
| limit 100Combined log group:
fields @timestamp, @message
| filter @message like "TRACE_ID"
| filter @message like /tool|execute_tool|function_call/
| parse @message '"name":"*"' as spanName
| parse @message '"startTimeUnixNano":"*"' as startNano
| parse @message '"endTimeUnixNano":"*"' as endNano
| parse @message '"statusCode":"*"' as statusCode
| sort @timestamp asc
| limit 100Query 5: Token Usage
Structured:
fields @timestamp, traceId, spanId, name,
attributes.gen_ai.usage.input_tokens, attributes.gen_ai.usage.output_tokens,
attributes.gen_ai.usage.total_tokens, attributes.gen_ai.agent.name
| filter traceId = "TRACE_ID"
| filter ispresent(attributes.gen_ai.usage.total_tokens)
| sort @timestamp asc
| limit 50Combined log group:
fields @timestamp, @message
| filter @message like "TRACE_ID"
| filter @message like /input_tokens|output_tokens|usage/
| parse @message '"name":"*"' as spanName
| parse @message '"gen_ai.usage.input_tokens"' as hasTokens
| sort @timestamp asc
| limit 50Query 6: Latency Outliers
Structured:
fields @timestamp, traceId, spanId, name,
(endTimeUnixNano - startTimeUnixNano) / 1000000 as durationMs
| filter traceId = "TRACE_ID"
| filter ispresent(endTimeUnixNano)
| sort durationMs desc
| limit 20Combined log group:
fields @timestamp, @message
| filter @message like "TRACE_ID"
| parse @message '"name":"*"' as spanName
| parse @message '"startTimeUnixNano":"*"' as startNano
| parse @message '"endTimeUnixNano":"*"' as endNano
| sort @timestamp asc
| limit 50Queries are async — use get_logs_insight_query_results to poll until status is Complete.
Phase 3: Filter OTEL Noise
See otel-span-schema.md for extraction rules, known scopes, and DROP/KEEP heuristics.
After retrieving query results:
- Count total results received
- Remove entries matching DROP patterns (count removed)
- Keep entries matching KEEP patterns
- Log: "Filtered: {total} → {kept} spans ({removed} noise entries dropped)"
Phase 4: Build Timeline
Compute relative offsets from the earliest span's startTimeUnixNano:
[T+0ms] Session started — traceId: abc123
[T+45ms] LLM inference — model: anthropic.claude-v3 — 1,200ms
[T+1,250ms] Tool call: search_documents — 340ms
[T+1,600ms] Tool result: 3 documents found
[T+1,650ms] LLM inference — model: anthropic.claude-v3 — 890ms
[T+2,550ms] Response generated — 200 OK
[T+2,600ms] Session ended — total: 2,600msError Handling
| Situation | Action |
| No log groups found | Ask user for log group name or AWS region |
| Query returns 0 results | Widen time range to ±24h, retry. If still empty, try alternate ID fields |
| Session ID not found | Try filtering by requestId, invocationId, traceId variants |
| Query timeout | Use cancel_logs_insight_query, reduce time range, retry |
| Partial results | Note in output, suggest narrower time window |
| Structured field queries return 0 results | Switch to glob-style parse @message queries (see Parse Syntax Guidance) |
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

