Skip to content

[FEATURE] Multi-Agent Session Manager for Graph and Swarm Patterns #867

@yonib05

Description

@yonib05

Problem Statement

Strands builders working with multi-agent patterns are requesting session management capabilities that extend beyond single-agent scenarios. Based on community feedback, developers need:

  • Multi-Agent Session Persistence: Builders want to maintain conversation history and state across all agents in complex multi-agent patterns (Swarms, Graphs, Handoffs, Agents-as-Tools)
  • Cross-Agent Context Sharing: The community is asking for shared session state that enables agents to access context from other agents within the same multi-agent execution
  • Pattern-Aware Session Management: Developers want session managers that understand multi-agent coordination events like handoffs, swarm interactions, and graph transitions
  • Unified Session Recovery: Requests for the ability to restore entire multi-agent workflows with all agent states and inter-agent relationships intact

Proposed Solution

We propose extending the existing session management system to support multi-agent pattern sessions, enabling builders to persist and restore complex multi-agent workflows with full context preservation.

Multi-Agent Session Management

from strands.multiagent import Swarm, GraphBuilder
from strands.session.file_session_manager import FileSessionManager

# Session manager automatically handles multiple agents
session_manager = FileSessionManager(session_id="research-team-session")

# All agents in swarm share session context
research_swarm = Swarm(
    agents=[researcher, analyst, writer],
    session_manager=session_manager
)

# Cross-agent context is automatically preserved
result = research_swarm.execute("Analyze market trends")
# All agent interactions, handoffs, and shared context persisted

Graph Pattern Session Persistence

from strands.session.s3_session_manager import S3SessionManager

# Session manager tracks graph execution state
session_manager = S3SessionManager(
    session_id="workflow-session-456",
    bucket="multi-agent-sessions"
)

builder = GraphBuilder()
builder.add_node(analyzer_agent, "analyze")
builder.add_node(processor_agent, "process")
builder.add_node(reviewer_agent, "review")
builder.set_session_manager(session_manager)

workflow = builder.build()

# Graph execution state and node transitions persisted
result = workflow.execute("Process customer feedback")
# Can resume from any point if interrupted

Handoff Session Continuity

from strands.multiagent import handoff_to_agent
from strands.session.file_session_manager import FileSessionManager

session_manager = FileSessionManager(session_id="support-session")

sales_agent = Agent(
    name="sales",
    session_manager=session_manager,
    tools=[handoff_to_agent]
)

technical_agent = Agent(
    name="technical", 
    session_manager=session_manager,
    tools=[handoff_to_agent]
)

# Handoff context automatically preserved in shared session
# technical_agent can access full conversation history from sales_agent

Agents-as-Tools Session Integration

# Specialist agents share session with orchestrator
research_assistant = Agent(
    name="research_assistant",
    session_manager=session_manager,
    tools=[web_search, memory]
)

orchestrator = Agent(
    name="orchestrator",
    session_manager=session_manager,
    tools=[research_assistant, product_assistant]
)

# All agent interactions stored in unified session
result = orchestrator("Plan a trip to Amsterdam")
# Specialist consultations preserved for future reference

Use Case

Workflow Resumption

  • Interrupted Execution: Resume complex multi-agent workflows from the exact point of interruption
  • Deployment Continuity: Maintain session state across application restarts and deployments
  • Error Recovery: Restore multi-agent state after system failures or timeouts

Distributed Multi-Agent Systems

  • Cloud Persistence: Store multi-agent sessions in S3 for distributed deployments
  • Session Sharing: Multiple application instances access the same multi-agent session
  • Scalable State Management: Handle large-scale multi-agent systems with persistent state

Long-Running Processes

  • Multi-Day Workflows: Persist complex research or analysis tasks that span multiple sessions
  • Iterative Refinement: Agents build upon previous work across multiple interactions
  • Progressive Enhancement: Add new agents to existing workflows while preserving context

Alternatives Solutions

No response

Additional Context

  • Multi-agent sessions extend the existing Session, SessionAgent, and SessionMessage data models
  • New SessionPattern model will track multi-agent coordination state and relationships
  • Cross-agent message access will be controlled through session-scoped permissions
  • Backward compatibility maintained with existing single-agent session management

Sub-issues

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    Status

    Coming Soon

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions