Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Examples gallery

Everything here runs offline. Where a real model is involved, a scripted one stands in unless you add an API key. Commands run from the repository root.

Complete apps

AppWhat it showsTry it
DeepSeek payments agentAccounts payable with a $25,000 spending authority. A deepseek-flash clerk and a deepseek-v4-pro fraud reviewer face bank-detail fraud, a duplicate invoice, and a prompt injection; the bank honors only exact, unused approvalscd apps/deepseek-payments-agent && .venv/bin/python run.py --mock fooled --human approve
Claude ops agentIncident response on Claude Opus 5.5. A prompt-injected shell command is denied, restarts need approval, and leaking a password terminates the agentcd apps/guarded-agent && .venv/bin/python run.py --mock exfil --approvals auto (export GUARD_ADMIN_TOKEN from guard-data/keys/admin.token first)
Governance ops consoleCouncils voting with finite energy, on a live web consolecargo run --manifest-path apps/governance-ops/Cargo.toml

(Create each app’s .venv first: python3 -m venv .venv && .venv/bin/pip install -r requirements.txt.)

Project templates

TemplateWhat it isCreate it
Refund support agent (Python)Looks up orders, refunds with approval, can’t touch accountslineage new refund-bot
Deploy agent (Rust)Tests and staging on its own, production with approval, no drop_databaselineage new deploy-bot --template rust

Lineage Mastery

Ten levels, from a first guarded action to production: start here.

cargo run --example mastery_01_first_actionPolicies, decisions, the signed log
cargo run --example mastery_02_budgetsBudgets that never refill
cargo run --example mastery_03_scarsScars, limits, the kill switch
cargo run --example mastery_04_approvalsPeople in the loop
cargo run --example mastery_05_persistenceNothing resets on restart
cargo run --example mastery_06_auditCatching tampering
python3 examples/python/lesson07_guard_server.py --auto-approveThe guard server
python3 examples/python/lesson08_llm_loop.pyA prompt injection that goes nowhere
python3 examples/python/lesson09_binding.pyA backend that refuses forged approvals

More Rust examples

cargo run --example guarded_agentThe guard and audit log in one run
cargo run --example lifecycle_demoThe original model: identity, energy, scars, death
cargo run --example provenance_chain_demoChain of custody
cargo run --example governance_ws_broadcastGovernance with a web dashboard
cargo run --example arena_with_live_market --releaseTrading agents with finite capital