"""
Example: Multi-agent collaboration with Supabase Session Manager

This example demonstrates how multiple agents can share session state
through Supabase, enabling distributed agent systems.
"""

from strands import Agent
from supabase_strands import SupabaseSessionManager


def main():
    session_id = "multi-agent-demo"
    
    # Agent 1: Information Gatherer
    print("=== Agent 1: Information Gatherer ===")
    manager1 = SupabaseSessionManager(session_id=f"{session_id}-agent1")
    agent1 = Agent(session_manager=manager1)
    
    response1 = agent1("I need to plan a trip to Tokyo. What should I know?")
    print(f"Agent 1: {response1}\n")
    
    # Agent 2: Budget Planner (separate session)
    print("=== Agent 2: Budget Planner ===")
    manager2 = SupabaseSessionManager(session_id=f"{session_id}-agent2")
    agent2 = Agent(session_manager=manager2)
    
    response2 = agent2("What's a reasonable budget for a week in Tokyo?")
    print(f"Agent 2: {response2}\n")
    
    # Resume Agent 1's session
    print("=== Resuming Agent 1 Session ===")
    manager1_resume = SupabaseSessionManager(session_id=f"{session_id}-agent1")
    agent1_resume = Agent(session_manager=manager1_resume)
    
    response3 = agent1_resume("What did we discuss about Tokyo?")
    print(f"Agent 1 (Resumed): {response3}")
    
    print("\n✅ Multi-agent sessions persisted independently!")


if __name__ == "__main__":
    main()
