[FEATURE] Maintain consistent session ID across multi-agent execution flows
Problem Statement
Dynamically spawned agents in multi-agent scenarios may have different session IDs. This breaks tracing, debugging, and conversation history coherence when agents spawn sub-agents or delegate to other agents.
Proposed Solution
Provide a mechanism to propagate session ID across agent boundaries:
- Automatic session ID inheritance when spawning sub-agents
- A context propagation mechanism for multi-agent scenarios
- Configuration option to maintain or isolate session IDs
Use Case
In multi-agent orchestration:
- A coordinator agent receives a request (session ID: abc123)
- It spawns specialist agents to handle subtasks
- All agents should share session ID abc123 for:
- End-to-end request tracing
- Unified conversation history
- Correlated logging and observability
- Debugging complex multi-agent flows
Alternatives Solutions
We currently manually propagate session IDs, but this is error-prone and requires modifying agent instantiation patterns.
Additional Context
No response
/strands
I've analyzed the Strands Agents SDK repository structure and session/multi-agent architecture to understand the scope of this feature request. I have several clarifying questions before this can be refined into an implementable task. Session Architecture: Multi-Agent Patterns: Telemetry/Tracing: The issue mentions "session ID" but the SDK has two distinct concepts that could be relevant: Which aspect is the primary concern? Both? Or specifically one? Which multi-agent patterns does this feature target? Note: Graph and Swarm already have orchestrator-level session manager support but explicitly block individual agent session managers. Can you clarify what "dynamically spawned agents" means in your use case? Specifically: The proposal mentions "Configuration option to maintain or isolate session IDs." What does the ideal API look like? For example: OpenTelemetry already propagates trace context (parent/child spans) across agent boundaries. Is the existing span hierarchy insufficient for your tracing/debugging needs? Or do you specifically need a "Unified conversation history" — does this mean: Based on my analysis, this feature could be quite broad. It potentially touches: Should this be broken down into smaller sub-tasks? For example: Does this feature require any new CI/CD workflows or changes to existing ones? If workflows are needed, they would need to be created under a Please respond when you have a chance. Your answers will help me scope this feature properly and create a clear implementation plan.Repository Analysis & Clarifying Questions
Repository Context
session_id is currently a property of SessionManager (specifically RepositorySessionManager), not of the Agent class itselfAgent has an agent_id but no session_id attributeSessionManager is passed to Agent.__init__() via the session_manager parameter, with session_id being set during SessionManager constructionSession data model (types/session.py) contains session_id and session_type
as_tool()): Sub-agents are independent Agent instances — no session manager inheritance or propagation occursGraphBuilder.set_session_manager() sets the session manager at the orchestrator level. Individual agent nodes are explicitly blocked from having their own session managers: "Session persistence is not supported for Graph agents yet."
trace_api.get_current_span()ThreadingInstrumentor propagates trace context across threadssession_id attribute is currently added to any trace spansClarifying Questions
1. Core Problem Definition
SessionManager/session_id for conversation history and state storage)2. Multi-Agent Patterns in Scope
as_tool()) — sub-agents as tools for a parent agent3. "Dynamically Spawned Agents"
as_tool()?4. Expected API / Configuration
session_id parameter on Agent.__init__()?as_tool() (sub-agent inherits parent's session_id)?invocation_state?5. Tracing vs. Session Persistence
session_id attribute on trace spans for correlation in your observability backend?6. Conversation History Sharing
7. Scope Concerns
Agent.__init__() (adding session_id as a first-class concept)SessionManager (session sharing/inheritance)_AgentAsTool (propagating session context to sub-agents)Graph/Swarm (lifting the restriction on individual agent session managers, or propagating session context)Tracer (adding session_id to trace spans)
session_id as a first-class attribute on Agent8. GitHub Workflows
.github_temp directory since I don't have permission to push to .github.