run_metis
Processes public health research requests through an 11-stage pipeline: classifies sensitivity, blocks threats, parses intent, allocates resources, and returns a routing decision for specialist agents.
Instructions
Master /metis entry point — runs the 11-stage pipeline and returns a routing decision.
Every /metis invocation passes through here. The pipeline:
1. Bootstraps or resumes the session
2. Classifies content (PUBLIC/INTERNAL/CONFIDENTIAL/SENSITIVE)
3. Data Guardian: blocks SENSITIVE requests outright
4. Cybersecurity: blocks prompt injection and suspicious URLs
5. Parses intent and selects the appropriate agent(s)
6. Allocates model and token budget
7. Assembles minimum surgical context from memory
8. Persists the turn to session_events
9. Returns routing decision — agents execute and then call:
save_session_event(..., 'result', output)
log_agent_run(..., session_id=session_id)
write_reflexion(session_id, agent_slug, ...)
Stages 10 (logging) and 11 (reflexion) are called by the executing agent
after completing their work.
Args:
request: The researcher's request text.
session_id: Existing session ID if resuming. Leave empty to auto-bootstrap.
client: Which Claude client is calling ('code'|'chat'|'cowork'|'dashboard').
max_turns: Maximum pipeline turns before graceful truncation (default 20).
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| request | Yes | ||
| session_id | No | ||
| client | No | code | |
| max_turns | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |