Overview
Sessions let your agent remember prior conversation context. Instead of each request being independent, messages within a session build on each other — the agent sees the full conversation history and can reference earlier messages.
Sessions are available to accounts with purchased credits.
How It Works
- Create a session — returns a session ID
- Send messages to the session — each message includes full conversation history automatically
- Session expires after 30 minutes of inactivity, or you can let it expire naturally
The agent sees prior messages as conversation context, enabling multi-turn workflows like iterative document editing, follow-up questions, and progressive refinement.
Create a Session
curl -X POST https://api.stewrd.dev/v1/sessions \
-H "Authorization: Bearer sk-stw_your_key"
Response:
{
"id": "550e8400-e29b-41d4-a716-446655440000",
"object": "session",
"status": "active"
}
Send Messages
Send messages to the session endpoint. The agent automatically receives the full conversation history.
curl -X POST https://api.stewrd.dev/v1/sessions/SESSION_ID/messages \
-H "Authorization: Bearer sk-stw_your_key" \
-H "Content-Type: application/json" \
-d '{"message": "Research the top 5 project management tools"}'
The response has the same shape as the agent endpoint, with an additional session_id field:
{
"id": "request-uuid",
"object": "session.message",
"session_id": "550e8400-e29b-41d4-a716-446655440000",
"message": "Here are the top 5 project management tools...",
"capabilities_used": ["research"],
"files": [],
"usage": { "credits_remaining": 4758, "credits_this_request": 3, "tokens_used": 1847 },
"meta": { "duration_ms": 8200, "project_id": "proj-id", "plan": "scale" }
}
Now send a follow-up — the agent remembers the prior context:
curl -X POST https://api.stewrd.dev/v1/sessions/SESSION_ID/messages \
-H "Authorization: Bearer sk-stw_your_key" \
-H "Content-Type: application/json" \
-d '{"message": "Create a comparison table of those tools as a CSV"}'
The agent references the research from the first message without you needing to repeat it.
Session Lifecycle
| Property | Value |
|---|
| Idle timeout | 30 minutes of inactivity |
| Max active sessions | 10 per project |
| Max history | 50 messages per session |
| Plan requirement | Purchased credits (any pack) |
- Sessions auto-expire after 30 minutes with no messages
- Expired sessions return
410 Gone
- Each message resets the idle timer
- Creating a new session when at the limit returns
429
Session messages accept the same body as the agent endpoint:
| Field | Type | Description |
|---|
message | string | Required. The message to send. |
capabilities | string[] | Filter capabilities for this request. |
files | object[] | Files to include (same format as agent). |
stream | boolean | Enable SSE streaming (default: false). |
Streaming works the same way in sessions as in the agent endpoint. Set stream: true to receive Server-Sent Events.
Plan Requirements
Sessions require purchasing credits (any credit pack). Free accounts cannot create sessions. Attempting to create a session with a free account returns:
{
"error": {
"code": "plan_restricted",
"message": "Persistent sessions require the Scale plan or higher."
}
}
Purchase credits at stewrd.dev/pricing.