Skip to content

Usage Guide

Commands

lantern lint [project] [--strict] [--format text|json|sarif]

Analyzes an agent project for design issues without using an LLM.

bash
# From the project root
cd my-agent-project
lantern lint

# From anywhere
lantern lint /path/to/my-agent-project

# Exit with code 1 on any finding (CI-friendly)
lantern lint --strict

# Machine-readable output for CI pipelines and integrations
lantern lint --json
lantern lint --format sarif > agentlantern.sarif

See the Linter reference for all rules and codes.

lantern inspect [project]

Outputs the full project model as JSON for integrations and debugging.

bash
lantern inspect /path/to/my-agent-project

lantern play [project] [--ws-port PORT] [--http-port PORT] [--name NAME] [--command CMD]

Runs a supported agent project and opens the live animated Play UI.

bash
# From the project root
cd my-agent-project
lantern play

# From anywhere
lantern play /path/to/my-agent-project

# Custom ports
lantern play /path/to/my-agent-project --ws-port 8790 --http-port 8791

# Save the run for replay and auto-start it
lantern play /path/to/my-agent-project --name demo-run

# Override entrypoint auto-detection without invoking a shell
lantern play . --command "uv run my-agent-command"

The browser UI starts in a ready state. If --name is omitted, the UI asks for a run name before START. Use STOP to terminate the active run.

The Play UI includes dynamic 1-10 agent layouts, a central Tool Hub for tool calls, timeline/thoughts/tools/comms/log panels, clickable agent history, and final report.md display when available.

See the Play reference.

lantern replay NAME [--speed FLOAT]

Replays a saved lantern play --name run.

bash
lantern replay demo-run
lantern replay last
lantern replay demo-run --speed 2.0
lantern replay /path/to/.lantern_replays/demo-run.jsonl

lantern compare BEFORE AFTER [--json]

Compares runtime, errors, agents, tools, token usage, and cost fields recorded in two replays.

bash
lantern compare baseline candidate
lantern compare baseline candidate --json > replay-diff.json

lantern docs [project] [-o OUTPUT_DIR] [--dry-run] [--force] [--clean]

Generates documentation for an agent project.

bash
# From the project root
cd my-agent-project
lantern docs

# From anywhere
lantern docs /path/to/my-agent-project

# Custom output directory
lantern docs /path/to/my-agent-project -o /path/to/output

# Safe preview and one-time adoption of output from AgentLantern < 0.2
lantern docs --dry-run
lantern docs --force --clean

lantern web [project]

Generates (unless --no-generate) and serves the documentation for an agent project over local HTTP.

bash
# From the project root
cd my-agent-project
lantern web

# From anywhere
lantern web /path/to/my-agent-project

# Custom port
lantern web --port 9000

# Serve without regenerating
lantern web --no-generate

# Accessible on the local network
lantern web --host 0.0.0.0

By default, lantern web serves http://localhost:9000 over local HTTP, so the browser should not show a certificate warning.

Supported Frameworks

AgentLantern detects the framework automatically from pyproject.toml dependencies or project structure.

FrameworkDetection signalAnalysis level
CrewAIcrewai dep or crew.py + @CrewBaseFull — agents, tasks, diagrams, env vars
LangGraphlanggraph dep or StateGraph usageFull — graphs, nodes, routes, tools, lint
AutoGendependency or AutoGen importsFull — agents, teams, tools, runs, lint
Smolagentsdependency or Smolagents importsFull — agents, managed agents, tools, runs, lint
Google ADKgoogle-adk depFull — agents, tools, hierarchy, workflows
OpenAI Agents SDKopenai-agents dep or agents importsFull — agents, handoffs, tools, runners, lint
PydanticAI, LlamaIndex, Semantic Kernel, Agnodependency or SDK importsDedicated agents, tools, teams/workflows and runs
LangChain, Haystack, Strands, CAMEL-AIdependency, imports or factoriesDedicated agents, tools, workflows and invocations
MetaGPT, BeeAI, OpenAI Swarmdependency or SDK importsDedicated roles/agents, teams and runs
Mastra, Vercel AI SDK Agentsnpm dependency and agent APIJavaScript/TypeScript agents, tools, workflows and scripts
Semantic Kernel .NET/Javaproject dependency or agent APIAgent initializers, instructions and invocations
Other Python or JS/TS frameworkscommon constructors/factoriesGeneric agents, tools, relationships and entrypoints

For frameworks with full analysis, AgentLantern parses agents, tasks, tools, environment variables, and generates Mermaid diagrams.

The generic fallbacks cover conventional Python and JavaScript/TypeScript agent APIs. Additional analyzers can be installed through the agentlantern.analyzers entry-point interface.

Generated Files

FileContent
overview.mdProject snapshot, entrypoints, high-level flow
architecture.mdSystem map, key files, dependencies, environment variables
diagrams.mdMermaid diagrams: agent-task graph, execution flow, sequence
agents.mdAgent roles, goals, tools, backstories
tasks.mdTask descriptions, agents assigned, expected outputs
runbook.mdInstall, configure, run, static checks, troubleshooting
contact.mdProject contacts from pyproject.toml
index.htmlDocsify site — publishable to GitHub Pages
_sidebar.mdNavigation menu
agentlantern-docs.htmlSingle-file HTML bundle; Mermaid rendering uses a CDN

Typical Workflow

bash
# 1. Navigate to (or point at) your agent project
cd my-agent-project

# 2. Generate and view documentation
lantern web

# 3. Open http://localhost:9000
# 4. Press Ctrl+C to stop the server

Multiple Projects

bash
# Terminal 1
lantern web ~/projects/crew-project --port 9000

# Terminal 2
lantern web ~/projects/adk-project --port 9001

Sharing Documentation

The generated docs/ folder is a static site. To share it:

  • GitHub Pages — push docs/ and enable GitHub Pages in repository settings
  • Single-file share — send docs/agentlantern-docs.html (no server; diagram rendering requires network access)
  • Any web serverdocs/ works on Nginx, Vercel, Netlify, etc.

Next Steps

Released under the MIT License.