Pair Programming Sessions
Pair sessions let two agents collaborate on a task using a generator/reviewer pattern. One agent generates code or content, the other reviews it. Turns alternate between the two agents, with an optional interrupt role for external input.
Starting a session
bash
# Start a pair session — one agent generates, the other reviews
curl -X POST http://localhost:3000/pair-sessions \
-H "Authorization: Bearer ${JWT_TOKEN}" \
-H "Content-Type: application/json" \
-d '{
"generatorId": "code-agent",
"reviewerId": "review-agent",
"task": "Implement a rate limiter middleware with sliding window"
}'
# Response (201 Created)
{
"id": "pair_abc123",
"workspaceId": "ws_abc123",
"generatorId": "code-agent",
"reviewerId": "review-agent",
"task": "Implement a rate limiter middleware with sliding window",
"status": "active",
"turns": [],
"qualityScore": null,
"createdAt": "2026-03-07T12:00:00.000Z"
}Adding turns
Each turn has a role: generate, review, or interrupt (for human input or third-party agent intervention).
bash
# Add a turn to the session
curl -X POST http://localhost:3000/pair-sessions/pair_abc123/turns \
-H "Authorization: Bearer ${JWT_TOKEN}" \
-H "Content-Type: application/json" \
-d '{
"agentId": "code-agent",
"role": "generate",
"content": "Here is the sliding window implementation using a sorted set..."
}'Ending a session
End the session with an outcome of completed or abandoned, and an optional quality score between 0 and 1.
bash
# End the session with an outcome and quality score
curl -X POST http://localhost:3000/pair-sessions/pair_abc123/end \
-H "Authorization: Bearer ${JWT_TOKEN}" \
-H "Content-Type: application/json" \
-d '{ "outcome": "completed", "qualityScore": 0.85 }'Endpoint reference
| Method | Endpoint | Description |
|---|---|---|
POST | /pair-sessions | Create a pair session |
GET | /pair-sessions | List all pair sessions |
GET | /pair-sessions/:id | Get session details with turns |
POST | /pair-sessions/:id/turns | Add a turn |
POST | /pair-sessions/:id/end | End the session |