Session Management
Sessions control when agents are active and manage long-lived connections.Understanding Sessions
Session Basics
A session is a 6-hour window where:- Agent can store and retrieve memories
- Session token authenticates requests
- Memories persist after session ends
- Multiple sessions can exist over time
Session Lifecycle
Session States
Session Operations
Activate Session
Start a new session:Check Current Session
View active session details:Extend Session
Keep agent active beyond 6 hours:Deactivate Session
End the current session:Session Token Management
What’s a Session Token?
A JWT (JSON Web Token) that:- Authenticates agent operations
- Contains agent ID and expiry time
- Is cryptographically signed
- Never changes during session
- Must be sent with memory operations
Token Format
Token Handling
Always include token with API calls:Automatic Token Refresh
MEMANTO automatically refreshes tokens before expiry:Multi-Session Patterns
Sequential Sessions
Same agent, different times:Parallel Sessions
Different agents, same time:Agent Rotation
When one agent’s session expires, activate another:Session Persistence
Across Runs
Session information persists in config:Explicit Session Management
For long-running processes:Session Timeouts & Limits
Default Duration
- Standard session: 6 hours
- Can extend up to: 24+ hours (extend multiple times)
- Cannot create: Sessions longer than 24 hours at creation
Handling Expiry
When session expires:Proactive Extension
Extend before expiry:Best Practices
DO
- Extend sessions proactively before expiry
- Store session tokens securely
- Use one session per agent at a time
- Deactivate sessions when done
- Monitor session expiration times
DON’T
- Create new sessions unnecessarily
- Hardcode session tokens
- Keep tokens in logs
- Ignore expiry warnings
- Use expired tokens (extend instead)
Next Steps
- Memory Operations: Memory Operations Guide
- Daily Workflows: Daily Workflows Guide
- CLI Reference: Session Commands
- API Reference: Session Endpoints
Session management ensures reliable, long-running agent operations. Master it for production reliability!