Skip to main content

Overview

Sessions enable multi-turn conversations with context retention. The agent remembers previous messages, generated media, and user preferences.

Using Sessions

Include session_id in your requests:
Sessions are created automatically on first use.

Session Scoping

Sessions are scoped by API key + session_id:
  • Different API keys cannot access each other’s sessions
  • Same session ID with different keys = different sessions

Multi-Turn Example

Context Retention

The agent retains within a session:
  • Previous user messages and responses
  • Generated media URLs
  • Tool call history
  • User preferences

Session Lifecycle

Inactive sessions can be reactivated with any new request using the same session_id.

Best Practices

Use meaningful IDs:
Clear sessions when done:
Handle session expiry:
Last modified on May 28, 2026