Skip to content

Commit 86c2390

Browse files
feat: Add comprehensive observability CLI for agent telemetry (#360)
Add CLI commands and notebook interface for querying and visualizing OpenTelemetry traces from AgentCore Runtime agents. ## Features ### CLI Commands - `agentcore obs list`: List traces with filtering by session, agent, time range, and errors - `agentcore obs show`: Display detailed trace view with span hierarchy and messages ### Core Components - **CloudWatch Logs Integration**: Query OTEL spans and runtime logs from CloudWatch - **Message Parser**: Multi-framework support with scope-based routing for LangChain, LangGraph, Strands, and generic OTEL - **Trace Processor**: Build span hierarchies, calculate durations, filter errors - **Trace Visualizer**: Rich console rendering with tree views and color coding - **Query Builder**: Time range filtering, batch pagination, multi-field queries ### Framework Support - LangChain: Parse nested JSON with tool calls - LangGraph: Extract input/output messages from instrumentation - Strands: Parse standard input/output structures - Generic OTEL: Extract gen_ai events with fallback patterns ### Testing - Comprehensive E2E tests with real OTEL fixtures - 210+ unit tests covering all components - Integration tests for notebook interface - Mock CloudWatch clients for isolated testing ### Notebook Interface - `ObservabilityNotebook`: Jupyter-friendly interface for programmatic trace analysis - Display traces in tables with IPython.display integration 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude <[email protected]>
1 parent 76dda3a commit 86c2390

40 files changed

+21096
-3
lines changed
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
"""BedrockAgentCore Starter Toolkit."""
22

3-
from .notebook.runtime.bedrock_agentcore import Runtime
3+
from .notebook import Observability, Runtime
44

5-
__all__ = ["Runtime"]
5+
__all__ = ["Runtime", "Observability"]

src/bedrock_agentcore_starter_toolkit/cli/cli.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
gateway_app,
99
)
1010
from ..cli.memory.commands import memory_app
11+
from ..cli.observability.commands import observability_app
1112
from ..utils.logging_config import setup_toolkit_logging
1213
from .identity.commands import identity_app
1314
from .import_agent.commands import import_agent
@@ -43,6 +44,9 @@
4344
# memory
4445
app.add_typer(memory_app, name="memory")
4546

47+
# observability
48+
app.add_typer(observability_app, name="obs")
49+
4650
# import-agent
4751
app.command("import-agent")(import_agent)
4852

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
"""Observability CLI commands."""

0 commit comments

Comments
 (0)