Interaction modes

RavenClaws offers 17 distinct ways to interact — from one-shot CLI commands to long-running servers, autonomous agents, and library embedding. This guide covers every mode with examples.

1. CLI flags overview

All modes are accessed via the ravenclaws binary. Every flag can also be set via environment variable (see §15).

FlagEnv varDefaultDescription
-c, --configRAVENCLAWS_CONFIGConfig file path
-v, --verboseRAVENCLAWS_VERBOSEfalseEnable debug logging
--modesingleAgent mode: single, swarm, supervisor, orchestrate, debate, review-loop, research-synthesize, voting
-e, --execOne-shot command prompt
-R, --replfalseInteractive REPL
--providerRAVENCLAWS_PROVIDEROverride LLM provider
--endpointRAVENCLAWS_ENDPOINTOverride LLM endpoint
--modelRAVENCLAWS_MODELOverride model name
--system-promptRAVENCLAWS_SYSTEM_PROMPTOverride system prompt
--require-approvalRAVENCLAWS_REQUIRE_APPROVALfalseHuman-in-the-loop for sensitive tools
--max-iterationsRAVENCLAWS_MAX_ITERATIONS10Max agent loop iterations
--token-budgetRAVENCLAWS_TOKEN_BUDGETMax tokens per run
--retry-maxRAVENCLAWS_RETRY_MAX3Max retry attempts
--retry-base-delay-msRAVENCLAWS_RETRY_BASE_DELAY100Retry base delay (ms)
--fallback-chainRAVENCLAWS_FALLBACK_CHAINComma-separated provider fallback chain
--mcp-commandRAVENCLAWS_MCP_COMMANDMCP server command (stdio)
--mcp-argsRAVENCLAWS_MCP_ARGSMCP server arguments
--mcp-envRAVENCLAWS_MCP_ENVMCP server env vars (KEY=VALUE,...)
--mcp-serverRAVENCLAWS_MCP_SERVERfalseRun as MCP server (stdio)
--mcp-sse-serverRAVENCLAWS_MCP_SSE_SERVERfalseRun as MCP SSE server
--mcp-sse-hostRAVENCLAWS_MCP_SSE_HOST0.0.0.0MCP SSE server host
--mcp-sse-portRAVENCLAWS_MCP_SSE_PORT8081MCP SSE server port
--serveRAVENCLAWS_SERVEfalseRun as HTTP server
--server-hostRAVENCLAWS_SERVER_HOSTHTTP server host override
--server-portRAVENCLAWS_SERVER_PORTHTTP server port override
--otel-endpointRAVENCLAWS_OTEL_ENDPOINTOTLP gRPC endpoint
--otel-service-nameRAVENCLAWS_OTEL_SERVICE_NAMEOTel service name
--otel-disabledRAVENCLAWS_OTEL_DISABLEDfalseDisable OTel tracing
--backgroundRAVENCLAWS_BACKGROUNDfalseSubmit background task
--task-statusRAVENCLAWS_TASK_STATUSCheck background task status
--task-listRAVENCLAWS_TASK_LISTfalseList all background tasks
--task-cancelRAVENCLAWS_TASK_CANCELCancel a background task
--task-resumeRAVENCLAWS_TASK_RESUMEfalseResume incomplete tasks
--schedulerRAVENCLAWS_SCHEDULERfalseRun scheduler with triggers
--webhook-portRAVENCLAWS_WEBHOOK_PORT9090Webhook server port
--evalRAVENCLAWS_EVALRun eval suite from config
--eval-jsonRAVENCLAWS_EVAL_JSONfalseOutput eval results as JSON
--heartbeatRAVENCLAWS_HEARTBEATfalseAutonomous heartbeat mode
--heartbeat-goalRAVENCLAWS_HEARTBEAT_GOALHeartbeat goal prompt
--heartbeat-tick-intervalRAVENCLAWS_HEARTBEAT_TICK_INTERVAL300Heartbeat tick interval (s)
--heartbeat-max-ticksRAVENCLAWS_HEARTBEAT_MAX_TICKS0Max heartbeat ticks (0=unlimited)
--heartbeat-sessionRAVENCLAWS_HEARTBEAT_SESSIONResume heartbeat session ID
--swarm-topologyRAVENCLAWS_SWARM_TOPOLOGYstarSwarm topology
--swarm-max-depthRAVENCLAWS_SWARM_MAX_DEPTH3Max swarm recursion depth
--swarm-max-workersRAVENCLAWS_SWARM_MAX_WORKERS100Max swarm workers
--swarm-dynamic-rolesRAVENCLAWS_SWARM_DYNAMIC_ROLESfalseEnable dynamic role assignment
--swarm-profilesRAVENCLAWS_SWARM_PROFILESWorker profiles JSON file
--swarm-communicationRAVENCLAWS_SWARM_COMMUNICATIONfalseEnable inter-agent communication
--swarm-health-monitoringRAVENCLAWS_SWARM_HEALTH_MONITORINGfalseEnable swarm health monitoring
--no-final-requiredRAVENCLAWS_NO_FINAL_REQUIREDfalseDon't require FINAL: marker
--require-finalRAVENCLAWS_REQUIRE_FINALfalseRequire FINAL: marker
-I, --imageRAVENCLAWS_IMAGEAttach image(s) to message
--pattern-max-roundsRAVENCLAWS_PATTERN_MAX_ROUNDS3Max debate rounds
--pattern-max-reviewRAVENCLAWS_PATTERN_MAX_REVIEW3Max review-loop iterations
--pattern-research-agentsRAVENCLAWS_PATTERN_RESEARCH_AGENTS3Number of research agents
--pattern-votersRAVENCLAWS_PATTERN_VOTERS3Number of voters
--pattern-verboseRAVENCLAWS_PATTERN_VERBOSEfalseShow verbose pattern results

2. Agent modes (--mode)

2a. Single agent (default)

One agent, one conversation. Reads a prompt from stdin, sends it to the LLM, prints the response.

shell
ravenclaws
ravenclaws --mode single

2b. Swarm mode

Multiple parallel agents with different personas working on the same task. Supports 4 topologies: star, mesh, hierarchical, hybrid.

shell
ravenclaws --mode swarm
ravenclaws --mode swarm --swarm-topology mesh --swarm-max-workers 50

2c. Supervisor mode

A supervisor agent decomposes a task, spawns sub-agents, and aggregates results.

shell
ravenclaws --mode supervisor

2d. Orchestrate mode

Full swarm orchestration with self-provisioning sub-agents, dynamic role assignment, and recursive supervision.

shell
ravenclaws --mode orchestrate
ravenclaws --mode orchestrate --swarm-dynamic-roles --swarm-communication

3. Multi-agent patterns (--mode)

Four built-in collaboration strategies, available in both single-provider and multi-model variants.

3a. Debate

Multiple agents debate a topic over several rounds, refining their positions.

shell
ravenclaws --mode debate
ravenclaws --mode debate --pattern-max-rounds 5 --pattern-verbose

3b. Review loop

An agent produces output, a reviewer critiques it, and the agent iterates.

shell
ravenclaws --mode review-loop
ravenclaws --mode review-loop --pattern-max-review 5

3c. Research & synthesize

Multiple research agents gather information, then a synthesizer combines findings.

shell
ravenclaws --mode research-synthesize
ravenclaws --mode research-synthesize --pattern-research-agents 5

3d. Voting

Multiple agents vote on the best answer, with configurable voter count.

shell
ravenclaws --mode voting
ravenclaws --mode voting --pattern-voters 5

4. One-shot execution (--exec)

Run a single prompt and print the response to stdout. Ideal for scripting and piping. The agent loop runs with tool-use enabled — the agent can call tools, browse the web, execute shell commands, etc.

shell
ravenclaws --exec "What is the capital of France?"
echo "Summarize this text" | ravenclaws --exec
ravenclaws --exec "Analyze this image" --image photo.jpg

5. Interactive REPL (--repl)

Full interactive conversation with streaming token-by-token output. Type messages line by line. Ctrl+C or Ctrl+D to exit.

shell
ravenclaws --repl
ravenclaws --repl --image diagram.png

6. HTTP server (--serve)

Long-running HTTP server with REST API endpoints for chat, background tasks, tools, health checks, and Prometheus metrics.

shell
ravenclaws --serve
ravenclaws --serve --server-host 0.0.0.0 --server-port 8080

Endpoints

MethodPathDescription
GET/healthLiveness probe — always 200 when server is running
GET/readyReadiness probe — 200 when initialized, 503 during startup
GET/metricsPrometheus-style metrics (requests, tokens, tool calls, errors, load)
GET/health/deepDeep health check — verifies LLM connectivity
POST/chatSend a message, get an agent response (JSON or SSE streaming)
POST/executeSubmit a background task, returns task ID immediately
GET/tasks/{id}Poll background task status and result
GET/toolsList available tools with JSON schemas
GET/tools/{name}Get details of a specific tool
POST/tools/{name}Execute a specific tool by name
POST/reloadReload configuration (distroless-friendly SIGHUP alternative)

Example usage

shell
# Chat
curl -X POST http://localhost:8080/chat \
  -H "Content-Type: application/json" \
  -d '{"message": "Hello!"}'

# Background task
curl -X POST http://localhost:8080/execute \
  -H "Content-Type: application/json" \
  -d '{"prompt": "Analyze this data"}'

# List tools
curl http://localhost:8080/tools

# Execute a tool
curl -X POST http://localhost:8080/tools/web_fetch \
  -H "Content-Type: application/json" \
  -d '{"url": "https://example.com"}'

# Health & metrics
curl http://localhost:8080/health
curl http://localhost:8080/ready
curl http://localhost:8080/metrics

# Reload config
curl -X POST http://localhost:8080/reload

7. MCP server (--mcp-server)

Expose RavenClaws' built-in tools over stdio via the Model Context Protocol (MCP). Any MCP client (Claude Desktop, VS Code, etc.) can discover and call RavenClaws tools.

shell
ravenclaws --mcp-server

The server speaks JSON-RPC 2.0 over stdio, supporting initialize, tools/list, and tools/call. All tool calls are policy-checked and audited.

8. MCP SSE server (--mcp-sse-server)

Same as MCP server but over HTTP with Server-Sent Events (SSE) transport.

shell
ravenclaws --mcp-sse-server
ravenclaws --mcp-sse-server --mcp-sse-host 0.0.0.0 --mcp-sse-port 8081

9. MCP client (--mcp-command)

Connect to external MCP servers and register their tools into the agent's tool registry. The agent can then call those tools alongside built-in tools.

shell
ravenclaws --mcp-command "npx -y @modelcontextprotocol/server-filesystem /tmp"
ravenclaws --mcp-command "python mcp-server.py" --mcp-args "--port 9000"
ravenclaws --mcp-command "my-server" --mcp-env "API_KEY=sk-..."

Multiple MCP servers can also be configured in the TOML config file (see §14).

10. Background tasks (--background)

Submit a task and get an ID immediately. The task runs asynchronously and can be polled later. Tasks persist to disk and survive process restarts.

shell
# Submit a task
TASK_ID=$(ravenclaws --background --exec "Analyze this data")
echo "Task ID: $TASK_ID"

# Check status
ravenclaws --task-status "$TASK_ID"

# List all tasks
ravenclaws --task-list

# Cancel a task
ravenclaws --task-cancel "$TASK_ID"

# Resume incomplete tasks on restart
ravenclaws --task-resume

11. Scheduler (--scheduler)

Run configured triggers (cron, webhook, file-watch) for proactive 24/7 agents.

shell
ravenclaws --scheduler
ravenclaws --scheduler --webhook-port 9090

Configure triggers in ravenclaws.toml:

toml
[scheduler]
triggers = [
  { type = "cron", schedule = "0 */6 * * *", prompt = "Daily system health check" },
  { type = "webhook", endpoint = "/webhook/github", prompt = "Process GitHub event" },
  { type = "file_watch", path = "/data/incoming", prompt = "Process new file" },
]

12. Heartbeat mode (--heartbeat)

Autonomous long-running agent that runs a persistent assess → plan → act → persist → sleep loop. The agent works independently over hours, days, or weeks. State is persisted to disk and survives restarts.

shell
ravenclaws --heartbeat --heartbeat-goal "Monitor system health and report anomalies"
ravenclaws --heartbeat \
  --heartbeat-goal "Watch for security threats" \
  --heartbeat-tick-interval 60 \
  --heartbeat-max-ticks 100

# Resume a previous session
ravenclaws --heartbeat --heartbeat-session "session-uuid"

13. Eval mode (--eval)

Run evaluation suites to test agent quality and behavior. Eval configs define assertions, run traces, and produce text or JSON reports.

shell
ravenclaws --eval tests/eval/basic-suite.toml
ravenclaws --eval tests/eval/security-suite.toml --eval-json

14. Configuration file

RavenClaws uses TOML configuration files. By default it looks for ravenclaws.toml in the current directory, or you can specify a path with -c.

shell
ravenclaws -c /etc/ravenclaws/config.toml

See the full configuration reference for every section, key, and default.

15. Environment variables

Every config field can be overridden via environment variables using the RAVENCLAWS__ prefix (double underscore for nested fields):

shell
export RAVENCLAWS__LLM__PROVIDER=openai
export RAVENCLAWS__LLM__ENDPOINT=https://api.openai.com
export RAVENCLAWS__LLM__API_KEY=sk-...
export RAVENCLAWS__LLM__MODEL=gpt-4o
export RAVENCLAWS__SECURITY__REQUIRE_TLS=false
export RAVENCLAWS__RUNTIME__HOST=0.0.0.0
export RAVENCLAWS__RUNTIME__PORT=8080

CLI-specific env vars use a flat naming convention like RAVENCLAWS_PROVIDER, RAVENCLAWS_ENDPOINT, etc. (see the table in §1).

16. Docker

Production (distroless)

shell
docker build -t ravenclaws:latest .
docker run --rm ravenclaws:latest --version
docker run --rm -p 8080:8080 ravenclaws:latest --serve

The production image uses gcr.io/distroless/cc-debian12:nonroot — no shell, no package manager, runs as UID 65532.

Development (with LiteLLM)

shell
docker compose up
# RavenClaws at http://localhost:8080
# LiteLLM at http://localhost:4000

Slim (with MCP client support)

shell
docker build -f Dockerfile.slim -t ravenclaws:slim .
docker run --rm ravenclaws:slim --mcp-command "npx -y @modelcontextprotocol/server-filesystem /tmp"

The slim image is Debian-based and includes nodejs, npm, and curl.

17. Kubernetes

Quick deploy

shell
kubectl apply -f k8s/deployment.yaml

Helm chart

shell
helm install ravenclaws charts/ravenclaws/

The Helm chart supports 11 configurable resources including ConfigMap, Secrets, Service, Ingress, NetworkPolicy, PDB, PVC, ServiceMonitor, and RBAC.

18. Library usage

RavenClaws is available as a library crate on crates.io:

toml
[dependencies]
ravenclaws = "1.1"

Basic chat

rust
use ravenclaws::config::Config;
use ravenclaws::llm::{create_client, ChatMessage, LLMProviderTrait};

let config = Config::load(None)?;
let llm = create_client(&config.llm)?;
let response = llm.chat(vec![
    ChatMessage::new("user", "Hello!"),
]).await?;
println!("{}", response.choices[0].message.content);

Agent loop with tools

rust
use ravenclaws::config::Config;
use ravenclaws::llm::create_client;
use ravenclaws::agent::{run_agent_loop, AgentLoopConfig};
use ravenclaws::tools::ToolRegistry;

let config = Config::load(None)?;
let llm = create_client(&config.llm)?;
let tool_registry = ToolRegistry::with_config(&config);
let loop_config = AgentLoopConfig::default();
let response = run_agent_loop(
    llm,
    "Analyze this data",
    &config.llm.system_prompt,
    loop_config,
    None,
    Some(tool_registry),
).await?;
println!("{}", response);

Full examples

See the examples/ directory in the repository for runnable programs:

shell
cargo run --example basic_chat
cargo run --example agent_loop
cargo run --example swarm
cargo run --example mcp_client -- "npx @modelcontextprotocol/server-filesystem /tmp"
cargo run --example heartbeat

19. Multi-model mode

When multiple [[llms]] sections are defined in config, RavenClaws enters multi-model mode. All agent modes have multi-model variants that round-robin across providers. Fallback chains are automatically built — if one provider fails, the next is tried.

shell
# Uses all configured providers in rotation
ravenclaws --mode single
ravenclaws --mode debate

20. Multi-modal input (--image)

Attach images to your message (supported formats: PNG, JPEG, GIF, WebP). Works in --exec, --repl, and HTTP server modes.

shell
ravenclaws --exec "Describe this image" --image photo.jpg
ravenclaws --repl --image diagram.png --image chart.png
ravenclaws --exec "Compare these images" -I img1.jpg -I img2.jpg

21. Graceful shutdown

All long-running modes (server, heartbeat, scheduler, REPL) support graceful shutdown via SIGTERM or SIGINT (Ctrl+C). The shutdown sequence:

  1. Signal received → shutdown flag set
  2. In-progress operations complete (with configurable timeout)
  3. State is persisted (checkpoints, heartbeat state, background tasks)
  4. Clean shutdown logged

Quick reference

shell
# One-shot
ravenclaws --exec "Hello"

# Interactive
ravenclaws --repl

# HTTP server
ravenclaws --serve

# MCP server
ravenclaws --mcp-server

# Background task
ravenclaws --background --exec "Long task"

# Autonomous agent
ravenclaws --heartbeat --heartbeat-goal "Monitor system"

# Swarm
ravenclaws --mode swarm

# Multi-agent patterns
ravenclaws --mode debate
ravenclaws --mode review-loop
ravenclaws --mode research-synthesize
ravenclaws --mode voting

# Eval
ravenclaws --eval tests/eval/basic-suite.toml

# Scheduler
ravenclaws --scheduler

# With images
ravenclaws --exec "Describe" --image photo.jpg

# Docker
docker run --rm ravenclaws:latest --exec "Hello"

# Kubernetes
kubectl apply -f k8s/deployment.yaml