LanternDOCS

Quickstart

Create an agent, run it, and watch the real-time event stream — in 5 minutes.

Verify your stack first: lantern doctor
Before running the steps below, confirm the stack is healthy:
# Build the CLI once, then run the readiness check:
( cd packages/cli && go install ./cmd/lantern )
lantern doctor
All checks must show ✓ before continuing. Need the stack running first? Follow the Installation guide (2 min).

Get a token

The dev stack seeds an admin account. Export a JWT:

export LANTERN_TOKEN=$(curl -s -X POST http://localhost:8080/auth/login \
  -H "Content-Type: application/json" \
  -d '{"email":"admin@lantern.dev","password":"lantern"}' \
  | grep -o '"token":"[^"]*"' | cut -d'"' -f4)

echo $LANTERN_TOKEN   # should print a JWT

Add an LLM provider

Lantern routes all model calls through its model router — add at least one key:

curl -s -X POST http://localhost:8080/v1/settings/llm-providers \
  -H "Authorization: Bearer $LANTERN_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"provider":"anthropic","api_key":"sk-ant-YOUR_KEY_HERE"}'

# Verify
curl -s -X POST http://localhost:8080/v1/settings/llm-providers/anthropic/test \
  -H "Authorization: Bearer $LANTERN_TOKEN"
# → {"ok":true}
OpenAI works too. Use "provider":"openai" with your OpenAI key. Any configured provider is available.

Create an agent

The system prompt field is systemPrompt — not instructions.

curl -s -X POST http://localhost:8080/v1/agents \
  -H "Authorization: Bearer $LANTERN_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "my-first-agent",
    "systemPrompt": "Answer questions clearly and concisely."
  }' | jq .
Model routing is automatic. The router picks the best configured provider. Use "reasoning-large" or "reasoning-small" capability tiers in run input to influence routing. Never hard-code vendor model names.

Run the agent

The run body uses agentName (camelCase):

export RUN_ID=$(curl -s -X POST http://localhost:8080/v1/runs \
  -H "Authorization: Bearer $LANTERN_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "agentName": "my-first-agent",
    "input": {"message": "What are the three laws of thermodynamics?"}
  }' | jq -r '.id')

echo "Run ID: $RUN_ID"

Stream the events

Every run emits live events over SSE — tool calls, model responses, completions:

curl -N http://localhost:8080/v1/runs/$RUN_ID/events \
  -H "Authorization: Bearer $LANTERN_TOKEN" \
  -H "Accept: text/event-stream"

Example output (event kinds emitted by the plain-LLM path):

event: step_started
data: {"seq":1,"kind":"step_started","stepId":"llm:main","attempt":1,"payload":{"name":"llm:main"},"createdAt":"..."}

event: step_completed
data: {"seq":2,"kind":"step_completed","stepId":"llm:main","attempt":1,"payload":{"output":"The three laws..."},"createdAt":"..."}

event: run_completed
data: {"seq":3,"kind":"run_completed","attempt":0,"payload":{"cost_usd":0.0004,"tokens_in":45,"tokens_out":120},"createdAt":"..."}
Dashboard view: open localhost:3001/runs to see the waterfall timeline, cost breakdown, and full event log.

What's next