The canonical git.agentic demo, end-to-end. A tiny LangGraph
customer-support agent gets broken by a deceptively-small change to
its system prompt — bundled with contaminated rows in its episodes
memory table. git revert of the prompt change alone does not fix
it. One agentic rollback does, in seconds.
See docs/product/demo-scenario.md
for the design and the 90-second pitch shape this implements.
- A POSIX shell,
podman(ordocker) with compose support,cargo, Python 3.10+,psql. - Two terminals are not required —
scripts/run-demo.shorchestrates everything.
The demo ships its own docker-compose.yml (Postgres + pgvector on
port 54322, container agentic-demo-pg), so it does not share state
with the Rust integration-test database.
A recorded asciinema of one end-to-end run is checked in at demo.cast. Replay it with asciinema play demo.cast. (The current recording was captured headlessly — output is faithful but inter-step pacing is collapsed; a polished re-record with a real TTY is on the Week-A backlog.)
cd examples/langgraph-rollback
./scripts/run-demo.shThe script bootstraps its own Python venv at .venv (SDK + LangGraph +
psycopg, idempotent) on first run — no manual Python setup is needed. To
drive the agent by hand instead, create the same venv yourself:
python3 -m venv .venv
.venv/bin/pip install -e '../../sdk/python[langgraph]' 'psycopg[binary]>=3.1'The script:
- brings up Postgres + pgvector via
podman composeordocker compose(auto-detected; override withCONTAINER_RUNTIME=docker|podman), - seeds 5 baseline
episodesrows, - builds
agenticdandagentic, creates.agentic/approval.key(the operator approval key, see below), starts the daemon bound to this directory with--postgres … --tables episodes:id, - asks the agent "I'm thinking about cancelling my subscription." — gets an empathetic answer,
agentic commit -m "v0.7 baseline",deploy-bad-change.shswaps in the sycophantic prompt, applies migration001_add_sentiment(aNOT NULLepisodes.sentimentcolumn, with its.down.sqlregistered under.agentic/schema/) and inserts five contaminated rows ("Refund of $499 processed for customer yesterday — confirmed.", etc.),- asks again — the agent now offers an unauthorised refund and confidently cites the fake refund row from memory,
agentic commit -m "v0.8 friendlier prompt",agentic diff baseline <bad commit>shows the prompts tree, the memory manifest, and the schema version (0.0.0 → 001_add_sentiment) have all moved,agentic rollback baseline --yes— reverses the schema migration (using an approval token the CLI mints from.agentic/approval.key), restores prompts on disk, truncates and replaysepisodesfrom the baseline manifest inside one transaction, forward-records a new commit on the branch,- asks again — empathetic answer is back; the contaminated memory row is gone.
The fix is one command. git revert alone never restores step (11).
| Dimension | How it changes between baseline and bad | How rollback restores it |
|---|---|---|
prompts |
prompts/system.txt overwritten with the sycophantic variant |
agentic rollback writes the baseline tree back to disk |
memory_snapshot |
5 contaminated rows INSERT'd into episodes |
MemoryAdapter::restore TRUNCATEs and replays from the baseline SegmentManifest inside one transaction |
tools |
unchanged | n/a |
model |
recorded in each commit; unchanged in this demo | rollback notes "operator must redeploy if it changed" |
code_sha |
recorded in each commit (from git rev-parse HEAD) |
rollback target's code SHA threaded into the forward-recorded commit |
schema_version |
migration 001_add_sentiment adds episodes.sentiment NOT NULL; agentic_schema_version() goes 0.0.0 → 001_add_sentiment |
agentic rollback runs .agentic/schema/001_add_sentiment.down.sql in one transaction, gated by an approval token (ADR-0019) |
The LangGraph wiring is real: every agent invocation runs through
AgenticCheckpointer, so agentic log shows one commit per graph step
on a per-thread branch (langgraph/<thread-hash>). The rollback
forward-records a new commit on that same branch, so the agent's
history reflects the rollback action rather than rewriting it.
- No LLM. The "model" is a deterministic function in
agent.pythat branches on which sentinel keyword appears insystem.txtand splices the most recentepisodesrow into its reply. This is enough to make the broken behaviour reproducible without API keys and without flaky model output. The rollback story is identical for a real LLM-backed agent — the dimensions snapshotted are the same. - The migration is hand-rolled. There is no forward migration
runner:
deploy-bad-change.shappliesbad-change/001_add_sentiment.up.sqlwithpsql(which also records the name inagentic_migrations) and copies the.down.sqlinto.agentic/schema/. The rollback side is the real reverse-migration runner. It needs an operator approval token (ADR-0019); the daemon reads.agentic/approval.keyand theagenticCLI mints the token from the same file, soagentic rollbackis typed the same way, and a socket client without the key cannot run reverse migrations. - Compose covers the database only.
docker-compose.ymlstarts Postgres + pgvector.agenticdand the Python agent are built and run locally byscripts/run-demo.sh— they are not containerised.
examples/langgraph-rollback/
├── agent.py the LangGraph agent + fake LLM
├── docker-compose.yml Postgres + pgvector on port 54322
├── prompts/
│ └── system.txt baseline empathetic system prompt
├── bad-change/
│ ├── system.txt sycophantic variant the bad change ships
│ ├── 001_add_sentiment.up.sql forward migration (NOT NULL column)
│ ├── 001_add_sentiment.down.sql its reverse, copied to .agentic/schema/
│ └── seed.sql contaminated rows the bad change INSERTs
├── seed.sql baseline episodes + pgvector setup
├── scripts/
│ ├── ask.sh invoke the agent with one user message
│ ├── deploy-bad-change.sh apply prompt + migration + memory contamination
│ ├── redeploy.sh simulate code-only redeploy after git revert
│ └── run-demo.sh full scenario orchestrator
├── pyproject.toml Python deps for the demo
└── README.md you are here
If you want to drive the steps yourself instead of via run-demo.sh:
# Run from the repo root:
cd examples/langgraph-rollback
# 1. Postgres (standalone compose on port 54322)
podman compose up -d
# 2. Build daemon + CLI
cd ../.. && cargo build --release -p agenticd -p agentic-cli && cd examples/langgraph-rollback
# 3. Seed baseline + start daemon
psql 'postgres://agentic:agentic@localhost:54322/agentic' -f seed.sql
../../target/release/agentic --repo . init
( umask 077 && head -c 32 /dev/urandom > .agentic/approval.key )
../../target/release/agenticd --repo . --allowed-uid "$(id -u)" \
--postgres 'postgres://agentic:agentic@localhost:54322/agentic' \
--tables episodes:id &
# 4. Drive the scenario
export DATABASE_URL='postgres://agentic:agentic@localhost:54322/agentic'
./scripts/ask.sh "I'm thinking about cancelling."
../../target/release/agentic --repo . commit -m "baseline" \
--model "anthropic:claude-opus:2026-05-01"
BASELINE=$(../../target/release/agentic --repo . resolve HEAD)
./scripts/deploy-bad-change.sh
./scripts/ask.sh "I'm thinking about cancelling."
../../target/release/agentic --repo . commit -m "bad change" \
--model "anthropic:claude-opus:2026-05-01"
BAD=$(../../target/release/agentic --repo . resolve HEAD)
# 4.5. Show that restoring only the prompt file does not fix it
git checkout -- prompts/system.txt
./scripts/redeploy.sh
./scripts/ask.sh "I'm thinking about cancelling." # still broken
../../target/release/agentic --repo . diff "$BASELINE" "$BAD"
../../target/release/agentic --repo . rollback "$BASELINE" --yes
./scripts/ask.sh "I'm thinking about cancelling." # fixed
# 5. Tear down
kill %1
podman compose down -vRoadmap week 11 commits to "the demo runs reliably on a fresh machine
in < 5 minutes from git clone". This script meets that on machines
with podman, cargo, and Python 3.10+ already present. Cold-cache
cargo build dominates wall-clock time; everything else is seconds.
If scripts/run-demo.sh exits non-zero, the script logs and the
daemon log (.agentic/daemon.log) are the two places to look first.