Create a new agent session.
A session represents a stateful conversation with an AI agent that can call tools to search data, filter results, and perform multi-step reasoning.
Args: request: FastAPI request with tenant context payload: Session creation request
Returns: CreateSessionResponse with session metadata
Example:
curl -X POST http://localhost:8000/v1/agents/sessions \
-H "Authorization: Bearer {api_key}" \
-H "X-Namespace: {namespace_id}" \
-H "Content-Type: application/json" \
-d '{
"agent_config": {
"model": "claude-3-5-sonnet-20241022",
"temperature": 0.7,
"available_tools": ["search_retrievers", "execute_retriever"]
},
"quotas": {
"max_messages": 100,
"max_tokens_total": 100000
}
}'
REQUIRED: Bearer token authentication using your API key. Format: 'Bearer sk_xxxxxxxxxxxxx'. You can create API keys in the Mixpeek dashboard under Organization Settings.
REQUIRED: Namespace identifier for scoping this request. All resources (collections, buckets, taxonomies, etc.) are scoped to a namespace. You can provide either the namespace name or namespace ID. Format: ns_xxxxxxxxxxxxx (ID) or a custom name like 'my-namespace'
Request payload for creating a new agent session.
Attributes: agent_config: Agent configuration (model, temperature, tools, etc.) quotas: Optional session quotas and rate limits user_id: Optional user identifier user_memory: Optional initial user memory/preferences metadata: Optional session metadata
Example:
python request = CreateSessionRequest( agent_config=AgentConfig( model="claude-3-5-sonnet-20241022", temperature=0.7, available_tools=["search_retrievers", "execute_retriever"] ), quotas=SessionQuotas( max_messages=100, max_tokens_total=100000 ), user_id="user_123", user_memory={"preferences": {"language": "en"}} )
Agent configuration (REQUIRED)
Session quotas and rate limits (OPTIONAL)
{
"max_messages": 100,
"max_tokens_total": 100000,
"max_tool_calls": 50,
"rate_limit_messages_per_minute": 10
}User identifier (OPTIONAL)
Initial user memory/preferences (OPTIONAL)
Session metadata (OPTIONAL)
Enable semantic memory for conversation context (OPTIONAL, default: True)
Successful Response
Response for session creation.
Attributes: session_id: Unique session identifier namespace_id: Namespace identifier internal_id: Organization internal ID session_name: Auto-generated session name (null until first message) status: Session status created_at: Session creation timestamp expires_at: Session expiration timestamp
Example:
python response = CreateSessionResponse( session_id="ses_abc123", namespace_id="ns_xyz789", internal_id="int_abc123", session_name=None, # Will be set after first message status="active", created_at=datetime.utcnow(), expires_at=datetime.utcnow() + timedelta(days=7) )
Unique session identifier
Namespace identifier
Organization internal ID
Session status
active, idle, archived, terminated Session creation timestamp
Session expiration timestamp
Auto-generated session name based on first conversation (set after first message)