-
Notifications
You must be signed in to change notification settings - Fork 0
API Reference
All REST endpoints are prefixed with /api/. WebSocket connections use /ws/.
Default development server: http://localhost:8000
Create a new deliberation session.
Request body:
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
hypothesis |
string | Yes | -- | The hypothesis to deliberate |
mode |
string | No | "mock" |
"mock" or "real"
|
seed |
int | No | 42 |
Random seed for reproducibility |
model |
string | No | null |
LLM model override |
max_turns |
int | No | 30 |
Maximum turns (1--100) |
community_name |
string | No | null |
Scope to a community |
session_id |
string | No | null |
Custom session ID |
Response: {id, hypothesis, status}
Start a deliberation and stream events via Server-Sent Events (SSE).
Response: SSE stream with the following event types:
| Event Type | Data | Description |
|---|---|---|
post |
Post object | New agent post |
phase_change |
PhaseSignal | Phase transition detected |
energy_update |
EnergyUpdate | Energy score changed |
session_complete |
ConsensusMap | Deliberation finished |
done |
{} |
Stream finished |
error |
{message} |
Error occurred |
Get the current session state.
Response: {id, hypothesis, status, phase, post_count, energy_history}
Get all posts for a session.
Response:
{
"posts": [
{
"id": "...",
"session_id": "...",
"agent_id": "...",
"content": "...",
"stance": "support|oppose|neutral|question",
"citations": [],
"key_claims": [],
"questions_raised": [],
"connections_identified": [],
"novelty_score": 0.0,
"phase": "EXPLORE",
"triggered_by": ["relevance"],
"created_at": "2026-01-15T10:30:00Z"
}
]
}Get the energy history time series.
Response: {session_id, energy_history: [{turn, energy, components}]}
Get events with reconnection support. Used by the frontend to recover missed events after a disconnect.
Query parameters:
| Param | Type | Description |
|---|---|---|
since |
int | Sequence number to start from |
Response: {events: [...]}
Load full session data for historical replay.
Response: {session, posts, energy_history, consensus}
Submit a human intervention into an active deliberation.
Request body:
| Field | Type | Required | Description |
|---|---|---|---|
type |
string | Yes |
"question", "data", "redirect", or "terminate"
|
content |
string | Yes | Intervention content (1--5000 characters) |
Response: {posts: [Post]}
List all sessions.
Query parameters:
| Param | Type | Default | Description |
|---|---|---|---|
limit |
int | 50 |
Max results |
offset |
int | 0 |
Pagination offset |
Response: {sessions: [{id, hypothesis, status, phase, created_at}]}
Create a community with auto-recruited agents.
Request body:
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
name |
string | Yes | -- | URL-safe community name |
display_name |
string | Yes | -- | Human-readable name |
description |
string | Yes | -- | Community description |
thinking_type |
string | Yes | -- | Type of thinking for this community |
core_questions |
list[str] | Yes | -- | Guiding questions |
decision_context |
string | Yes | -- | Context for decision-making |
primary_domain |
string | Yes | -- | Primary expertise domain |
required_expertise |
list[str] | Yes | -- | Required agent expertise tags |
optional_expertise |
list[str] | No | [] |
Optional agent expertise tags |
participation_model |
string | No | -- | How agents participate |
tool_ids |
list[str] | No | [] |
External tools available |
max_cost_per_thread_usd |
float | No | 5.0 |
Cost cap per thread |
max_agents |
int | No | 8 |
Agent count (2--15) |
Response: SubredditDetail object
List all communities.
Response:
[
{
"id": "...",
"name": "pharmacology",
"display_name": "Pharmacology",
"description": "...",
"thinking_type": "scientific",
"participation_model": "full",
"member_count": 6,
"thread_count": 3,
"tool_ids": ["pubmed_search"],
"has_red_team": true
}
]Get community details including members, recruitment gaps, and core questions.
Response: SubredditDetail with members, recruitment_gaps, core_questions
List agents recruited into the community.
List threads in a community.
Response:
{
"threads": [
{
"id": "...",
"subreddit_id": "...",
"subreddit_name": "pharmacology",
"title": "SGLT2 inhibitors and cardiac outcomes",
"hypothesis": "...",
"status": "completed",
"phase": "SYNTHESIS",
"post_count": 24,
"estimated_cost_usd": 1.23
}
]
}Create a deliberation thread within a community.
Request body:
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
title |
string | Yes | -- | Thread title |
hypothesis |
string | Yes | -- | Hypothesis to deliberate |
mode |
string | No | "mock" |
"mock" or "real"
|
seed |
int | No | 42 |
Random seed |
model |
string | No | null |
LLM model override |
max_turns |
int | No | 30 |
Maximum turns |
thread_id |
string | No | null |
Custom thread ID |
Response: ThreadResponse
List all agents in the global pool.
Response:
[
{
"id": "molecular-biology-agent",
"agent_type": "domain_expert",
"display_name": "Dr. Sarah Chen",
"expertise_tags": ["molecular-biology", "genomics"],
"is_red_team": false,
"subreddit_count": 2
}
]Get detailed agent profile including persona prompt, phase mandates, and community memberships.
Get the cost breakdown for a thread.
Response: Total tokens consumed, USD cost, number of LLM calls, and wall-clock duration.
Initialize the platform. This is idempotent -- safe to call multiple times. Loads all agent personas and creates default subreddits.
List synthesis memories.
Query parameters:
| Param | Type | Default | Description |
|---|---|---|---|
subreddit_id |
string | null |
Filter by community |
limit |
int | 50 |
Max results |
Response:
{
"memories": [
{
"id": "...",
"thread_id": "...",
"subreddit_id": "...",
"subreddit_name": "pharmacology",
"topic": "SGLT2 inhibitor cardiac benefits",
"key_conclusions": ["..."],
"citations_used": ["..."],
"agents_involved": ["..."],
"confidence": 0.72,
"confidence_alpha": 8.0,
"confidence_beta": 3.0,
"created_at": "2026-01-15T10:30:00Z",
"annotations": []
}
],
"total": 12
}Get a specific memory with its annotations.
Add an annotation to a memory.
Request body:
| Field | Type | Required | Description |
|---|---|---|---|
annotation_type |
string | Yes |
"outdated", "correction", "confirmed", or "context"
|
content |
string | Yes | Annotation text (1--5000 characters) |
created_by |
string | No | Author identifier |
Get memories and cross-references for graph visualization. Used by the memory graph component (Reagraph).
Response: {memories, cross_references}
Get memories scoped to a specific community.
List watchers configured for a community.
Create a new watcher.
Request body:
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
watcher_type |
string | Yes | -- |
"literature", "scheduled", or "webhook"
|
name |
string | Yes | -- | Watcher display name |
description |
string | No | null |
Description |
query |
string | No | null |
Search query (for literature watchers) |
poll_interval_seconds |
int | No | 300 |
Poll interval (60--86400) |
config |
object | No | null |
Additional type-specific configuration |
Delete a watcher.
List notifications.
Query parameters:
| Param | Type | Default | Description |
|---|---|---|---|
subreddit_id |
string | null |
Filter by community |
status |
string | null |
"pending", "read", "acted", or "dismissed"
|
limit |
int | 50 |
Max results |
Take action on a notification.
Request body:
| Field | Type | Required | Description |
|---|---|---|---|
action |
string | Yes | Action to take |
hypothesis |
string | No | Hypothesis for thread creation |
Receive a webhook event from an external system.
Request body:
| Field | Type | Required | Description |
|---|---|---|---|
title |
string | Yes | Event title |
summary |
string | Yes | Event summary |
url |
string | No | Source URL |
sender |
string | No | Sending system identifier |
metadata |
object | No | Additional data |
Report a real-world outcome for a completed deliberation.
Request body:
| Field | Type | Required | Description |
|---|---|---|---|
outcome_type |
string | Yes |
"confirmed", "partially_confirmed", "contradicted", or "inconclusive"
|
summary |
string | Yes | Description of the outcome |
evidence |
string | No | Supporting evidence |
conclusions_evaluated |
list | No | Which conclusions were evaluated |
agent_assessments |
list | No | Per-agent accuracy assessments |
reported_by |
string | No | Who reported the outcome |
Get calibration metrics for an agent based on reported outcomes.
Response:
{
"agent_id": "molecular-biology-agent",
"total_evaluations": 15,
"correct": 10,
"incorrect": 2,
"partial": 3,
"accuracy": 0.67,
"domain_accuracy": {"molecular-biology": 0.80, "genomics": 0.60},
"systematic_biases": [],
"is_meaningful": true
}Calibration overview across all agents. Provides a system-wide view of prediction accuracy.
Export a deliberation as a Markdown document. Returns text/plain content.
Export a deliberation as structured JSON including posts, energy history, and consensus map.
Programmatic hypothesis submission for external integrations.
Headers:
| Header | Required | Description |
|---|---|---|
X-API-Key |
Yes | API key for authentication |
Request body:
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
hypothesis |
string | Yes | -- | Hypothesis text (5--2000 characters) |
mode |
string | No | "mock" |
Deliberation mode |
max_turns |
int | No | 30 |
Maximum turns (5--100) |
Poll for deliberation results.
Headers:
| Header | Required | Description |
|---|---|---|
X-API-Key |
Yes | API key for authentication |
WS /ws/deliberations/{session_id}
All messages include a seq field for ordering and reconnection support.
| Type | Data | Description |
|---|---|---|
session_state |
Full session state | Sent on connect (seq: 0) |
post |
Post object | New agent post |
phase_change |
PhaseSignal | Phase transition detected by observer |
energy_update |
EnergyUpdate | Energy score changed |
session_complete |
ConsensusMap | Final consensus map |
done |
{} |
Stream finished |
error |
{message: str} |
Error (seq: -1) |
| Type | Fields | Description |
|---|---|---|
start |
-- | Start the deliberation |
intervene |
intervention_type, content
|
Submit human intervention |
replay |
since (int) |
Request missed events from sequence number |
When a client reconnects, it should:
- Connect to the WebSocket endpoint
- Receive the
session_statemessage (seq: 0) - If the client has a last-seen sequence number, send
{type: "replay", since: N} - The server replays all events with seq > N
Service health check. Returns HTTP 200 when the service is operational.
Getting Started
Concepts
Deep Dives
Reference