Skip to main content
POST
/
v1
/
agents
/
sessions
Create Session
curl --request POST \
  --url https://api.mixpeek.com/v1/agents/sessions \
  --header 'Content-Type: application/json' \
  --data @- <<EOF
{
  "agent_config": {
    "model": "gpt-4o-mini",
    "temperature": 0.7,
    "max_tokens": 4096,
    "system_prompt": "You are a helpful AI assistant with access to Mixpeek's data infrastructure.",
    "available_tools": [
      "<string>"
    ]
  },
  "quotas": {
    "max_messages": 100,
    "max_tokens_total": 100000,
    "max_tool_calls": 50,
    "rate_limit_messages_per_minute": 10
  },
  "user_id": "<string>",
  "user_memory": {},
  "metadata": {},
  "enable_memory": true
}
EOF
{
  "session_id": "<string>",
  "namespace_id": "<string>",
  "internal_id": "<string>",
  "status": "active",
  "created_at": "2023-11-07T05:31:56Z",
  "expires_at": "2023-11-07T05:31:56Z",
  "session_name": "<string>"
}

Headers

Authorization
string

REQUIRED: Bearer token authentication using your API key. Format: 'Bearer sk_xxxxxxxxxxxxx'. You can create API keys in the Mixpeek dashboard under Organization Settings.

X-Namespace
string

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'

Body

application/json

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_config
AgentConfig · object
required

Agent configuration (REQUIRED)

quotas
SessionQuotas · object

Session quotas and rate limits (OPTIONAL)

Example:
{
"max_messages": 100,
"max_tokens_total": 100000,
"max_tool_calls": 50,
"rate_limit_messages_per_minute": 10
}
user_id
string | null

User identifier (OPTIONAL)

user_memory
User Memory · object

Initial user memory/preferences (OPTIONAL)

metadata
Metadata · object

Session metadata (OPTIONAL)

enable_memory
boolean
default:true

Enable semantic memory for conversation context (OPTIONAL, default: True)

Response

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) )

session_id
string
required

Unique session identifier

namespace_id
string
required

Namespace identifier

internal_id
string
required

Organization internal ID

status
enum<string>
required

Session status

Available options:
active,
idle,
archived,
terminated
created_at
string<date-time>
required

Session creation timestamp

expires_at
string<date-time>
required

Session expiration timestamp

session_name
string | null

Auto-generated session name based on first conversation (set after first message)