The .env file is created when you download your agent code:
Copy
Ask AI
xpander init
This downloads your agent code from the platform with the .env file pre-configured with your keys.
session_management_example.py
Copy
Ask AI
from dotenv import load_dotenvload_dotenv()from xpander_sdk import Backendfrom agno.agent import Agentbackend = Backend()agno_agent = Agent(**backend.get_args())# Tom's first sessionagno_agent.print_response( message="Tell me a 5 second short story about a robot.", user_id="tom", session_id="tom_session1")# Jerry's sessionagno_agent.print_response( message="How many b in rabbit?", user_id="jerry", session_id="jerry_session1")# Tom recalls his sessionagno_agent.print_response( message="who am I, What did I ask you?", user_id="tom", session_id="tom_session1")
This example shows user-specific memory where each user maintains separate conversation history, session isolation with clear boundaries between different contexts, and flexible access patterns. Tasks automatically include user sessions, making it seamless to maintain context in background processing without manual session management.