Create Session
Create a new session to store context blocks.
Request Body
Default agent for invocations in this session
Fork from existing session ID
When forking, only include blocks with these tags
When forking, include pinned blocks
curl -X POST https://api.runtools.ai/v1/aip/sessions \
-H "X-API-Key: rt_live_xxx" \
-H "Content-Type: application/json" \
-d '{
"name": "Auth Feature - Q1",
"defaultAgent": "code-assistant",
"tags": ["project-x", "auth"]
}'
{
"data": {
"id": "sess_abc123",
"name": "Auth Feature - Q1",
"defaultAgent": "code-assistant",
"tags": ["project-x", "auth"],
"metrics": {
"totalTokens": 0,
"tokensRemainingPct": 100,
"compactionCount": 0,
"blockCount": 0
},
"createdAt": "2026-01-21T10:00:00Z"
}
}
List Sessions
List all sessions.
Query Parameters
curl https://api.runtools.ai/v1/aip/sessions?tag=project-x \
-H "X-API-Key: rt_live_xxx"
{
"data": [
{
"id": "sess_abc123",
"name": "Auth Feature - Q1",
"metrics": { "totalTokens": 45000, "blockCount": 34 },
"updatedAt": "2026-01-21T14:30:00Z"
}
],
"meta": {
"hasMore": false
}
}
Get Session
Get session details including metrics and block list.
Path Parameters
curl https://api.runtools.ai/v1/aip/sessions/sess_abc123 \
-H "X-API-Key: rt_live_xxx"
{
"data": {
"id": "sess_abc123",
"name": "Auth Feature - Q1",
"defaultAgent": "code-assistant",
"tags": ["project-x", "auth"],
"metrics": {
"totalTokens": 45000,
"maxTokens": 200000,
"tokensRemainingPct": 77.5,
"compactionCount": 2,
"blockCount": 34,
"invocationCount": 89
},
"blocks": ["blk_001", "blk_002", "blk_003"],
"pinnedBlocks": ["blk_001"],
"createdAt": "2026-01-04T09:00:00Z",
"updatedAt": "2026-01-21T14:30:00Z"
}
}
Fork Session
Create a new session from an existing one with selected context.
Path Parameters
Request Body
Only include blocks with these tags
Exclude blocks with these tags
Include pinned blocks regardless of tags
curl -X POST https://api.runtools.ai/v1/aip/sessions/sess_abc123/fork \
-H "X-API-Key: rt_live_xxx" \
-H "Content-Type: application/json" \
-d '{
"name": "Auth Deep Dive",
"includeByTag": ["authentication", "security"],
"includePinned": true
}'
{
"data": {
"id": "sess_def456",
"name": "Auth Deep Dive",
"forkedFrom": "sess_abc123",
"metrics": {
"totalTokens": 12000,
"blockCount": 8
},
"createdAt": "2026-01-21T15:00:00Z"
}
}
Delete Session
Delete a session and all its blocks.
Path Parameters
curl -X DELETE https://api.runtools.ai/v1/aip/sessions/sess_abc123 \
-H "X-API-Key: rt_live_xxx"
{
"data": {
"deleted": true
}
}
Compact Session
Trigger AI compaction to reduce token usage.
Request Body
Target token count after compaction
Don’t compact pinned blocks
Number of recent blocks to preserve
curl -X POST https://api.runtools.ai/v1/aip/sessions/sess_abc123/compact \
-H "X-API-Key: rt_live_xxx" \
-H "Content-Type: application/json" \
-d '{
"targetTokens": 50000,
"preservePinned": true
}'
{
"data": {
"previousTokens": 150000,
"newTokens": 48000,
"blocksCompacted": 25,
"summariesCreated": 3
}
}