How aws/bedrock-agentcore-sdk-python works
Bedrock AgentCore SDK is a Python client and serving layer for deploying agents and composing AgentCore services. Its primary workflow is to register an agent handler with the runtime app, receive an invocation, dispatch it to that handler, and stream the response. Separate SDK modules manage memory, gateway tools, knowledge retrieval, identity, policy, payments, and evaluation. The README documents protocol adapters and platform capabilities, while sampled source confirms selected runtime, client, memory, and evaluation behavior; links among unsampled modules are omitted where their wiring is uncertain.
Main entry points: app.py Runtime app · client.py Evaluation client · ag_ui.py AG-UI adapter · a2a.py A2A adapter
Components 26
Agent Runtime
- Runtime app
src/bedrock_agentcore/runtime/app.py - AG-UI adapter
src/bedrock_agentcore/runtime/ag_ui.py - A2A adapter
src/bedrock_agentcore/runtime/a2a.py - Runtime client
src/bedrock_agentcore/runtime/agent_core_runtime_client.py
Agent Services
- Memory client
src/bedrock_agentcore/memory/client.py - Memory sessions
src/bedrock_agentcore/memory/integrations/strands/session_manager.py - Gateway client
src/bedrock_agentcore/gateway/client.py - Gateway tool search
src/bedrock_agentcore/gateway/integrations/strands/plugins/agentcore_tool_search/plugin.py - Knowledge base
src/bedrock_agentcore/knowledge_base/client.py - Web search tool
src/bedrock_agentcore/tools/web_search_client.py - Browser tool
src/bedrock_agentcore/tools/browser_client.py - Code interpreter
src/bedrock_agentcore/tools/code_interpreter_client.py
Controls and Payments
- Identity auth
src/bedrock_agentcore/identity/auth.py - Policy client
src/bedrock_agentcore/policy/client.py - Payment manager
src/bedrock_agentcore/payments/manager.py - Payment integrations
src/bedrock_agentcore/payments/integrations/handlers.py - Config bundles
src/bedrock_agentcore/config_bundle/client.py
Evaluation and Tracing
- Evaluation client
src/bedrock_agentcore/evaluation/client.py - Span collector
src/bedrock_agentcore/evaluation/agent_span_collector/agent_span_collector.py - Span serializer
src/bedrock_agentcore/evaluation/span_to_adot_serializer/strands_converter.py
Other components
- Agent developer
- Agent caller
- Agent handler
- CloudWatch
- AgentCore APIs
- Gateway MCP endpoint
Connections 27
- Agent developer → Runtime app: registers handler
- Agent caller → Runtime app: invokes agent
- Runtime app → Agent handler: dispatches handler
- Agent handler → Runtime app: streams events
- Runtime app → Agent caller: returns response
- Agent developer → AG-UI adapter: serves AG-UI
- AG-UI adapter → Runtime app: adapts protocol
- Agent developer → A2A adapter: serves A2A
- A2A adapter → Runtime app: adapts protocol
- Runtime client → AgentCore APIs: invokes runtime
- Memory client → AgentCore APIs: manages memory
- Memory sessions → Memory client: persists sessions
- Gateway client → AgentCore APIs: manages gateway
- Gateway tool search → Gateway MCP endpoint: discovers tools
- Knowledge base → AgentCore APIs: manages and retrieves
- Web search tool → Gateway MCP endpoint: sends MCP requests
- Browser tool → AgentCore APIs: calls browser service
- Code interpreter → AgentCore APIs: calls execution service
- Identity auth → AgentCore APIs: handles identity
- Policy client → AgentCore APIs: manages policies
- Payment manager → AgentCore APIs: processes payments
- Payment integrations → Payment manager: extracts payment data
- Config bundles → AgentCore APIs: fetches bundles
- Evaluation client → Span collector: collects session spans
- Span collector → CloudWatch: reads traces
- Evaluation client → AgentCore APIs: runs evaluations
- Span serializer → CloudWatch: formats trace data