rev 40 · web+cli
127.0.0.1 · loopback
langgraph 1.0
deep agents in production shape · live demo

An autonomous agent that builds, brands, deploys, and verifies e-commerce funnels.

Built on LangChain DeepAgents + LangGraph 1.0 against the live Unify CMS platform. Not a chatbot wrapper — a planning, self-verifying system with parallel subagents, hard human-approval gates, durable memory, and a full evaluation loop. Bring your own LLM key; run it in the browser or as a local CLI that edits the funnel repo on your own disk.

2
surfaces · web + CLI
2∥
parallel subagents
35+
curated tools (of 345)
17
HITL-gated mutations
7+2
eval dimensions, offline+online
DeepAgent for funnels web console — a live clone run: chat transcript with the click-wizard and per-message feedback on the left; the PLAN, WORKSPACE, and ORCHESTRATION panels plus the token/cost runbar on the right.
The web console, mid-run. Left: streaming transcript, the click-to-answer wizard, 👍/👎 per message. Right: the live PLAN (self-written todos), WORKSPACE (virtual-FS files the agent wrote itself), and ORCHESTRATION tree — main → research / design / code-agent → parallel coder workers. Top runbar: tokens, $cost (FREE here), time, turns, and ⏪ rewind.
why it exists

What, why, who

What it is

Three agents over the Unify funnel platform. Clone·Build: from one sentence to a researched, branded, deployed, browser-verified funnel cloned from a template. Create·Build: the same, but a brand-new funnel from scratch — gathers the real ids (company, CRM, 1/2-page theme, products, shipping), bootstrapping a company if needed, created in staging. Edit·Mutate: open any funnel, change it in plain language, diff before deploy, rollback on failure.

Why it matters

Funnel onboarding is a multi-hour expert workflow: market research, template choice, brand CSS, product wiring, deploy pipelines, QA walks. The agent compresses it to minutes — while every irreversible step still passes through a human gate. It demonstrates the full deep-agent discipline, not a demo trick.

Who uses it

E-commerce operators launching offers, agencies onboarding clients onto Unify, and platform teams who want an agent surface over an existing API estate (345 endpoints → MCP → curated toolsets) without rewriting their backend.

architecture

Architecture — one screen

Standalone service. The browser streams NDJSON straight from the agent loop; everything below the line is checkpointed, traced, and scored. The same loop (buildAgent + a shared runTurn) also backs the CLI surface — the browser and terminal are thin adapters over one core.

deepagent-funnels · system topology
 Browser  public/index.html — token stream · plan · workspace · orchestration tree · wizard · gates · cost HUD · 👍/👎
    │ POST /run (BYOK key in headers, never stored)     ↑ NDJSON: delta·chat·tool·todos·files·ask·interrupt·usage
    ▼
 server.ts ── input guardrail ── approval gate ── Langfuse tracing ── online eval (every turn)
    ▼
 createDeepAgent  (LangGraph 1.0 · durable checkpoints · built-in planning + virtual FS + summarization)
    │ interruptOn: 17 mutating tools  →  graph PAUSES  →  human approve / edit / reject  →  Command resume
    │ skills: funnel-ops SKILL.md (progressive disclosure)
    ├── task ∥ research-agent — Tavily search → structured JSON (cited sources)
    ├── task ∥ design-agent  — palette · typography · hero copy → structured JSON
    ├── MCP bridge — 345 Unify endpoints, allowlisted per agent (~35)
    ├── direct tools — clone_funnel · deploy_funnel · verify_live (SSRF-guarded)
    ├── apply_design — git commits to the funnel repo (CSS tokens + HTML copy)
    ├── task → code-agent — a NESTED deep agent that plans its own todos and spawns
    │           N ∥ coder workers (its choice) — all writes STAGED, validator-checked,
    │           diff-reviewed by the human, committed only through the interrupt gate
    └── walk_funnel — headless Chromium walks the LIVE funnel, fills the test card, asserts navigation
data flow

How it all connects — flow

Top to bottom: the browser panels, the server's safety layers, the main agent, and how it fans out to parallel sub-agents, a nested coding agent, and tools — with human gates and a feedback loop.

BROWSER · UI Chat · Plan panel · Workspace (virtual FS) · Orchestration tree · Cost HUD · Wizard · Rewind · 👍/👎
POST /run · BYOK key (never stored) ↓↑ NDJSON stream — delta · chat · tool · todos · files · ask · interrupt · usage
SERVERinput guardrail → approval gate → Langfuse tracing → online eval (every turn)
↓
MAIN AGENT · createDeepAgentcheckpointer (resumable) · built-in planning · virtual filesystem · summarization · skills
fans out ↓  ·  every mutating call ⏸ pauses for human approve / edit / reject
🔎 research-agentTavily web search → cited JSON
∥parallel
🎨 design-agentpalette · type · hero copy → JSON
🧠 code-agent plans its own todos, spawns N workers
codercodercoder
🛠 toolsMCP 345→35 · clone ⏸ · apply_design ⏸ · deploy ⏸ · walk_funnel
errors · rejections · 👎 → reflect → lessons-learned skill + learned-cases.jsonl → the agent stops repeating mistakes  ⟲
the clone run

The clone agent's full flow

Stage-gated autonomy: the agent plans and executes freely between gates; humans hold the gates.

01Intent → gather. "Unisex t-shirts, USA, 18-35." The agent extracts what it knows, writes its own todo plan (visible live in the PLAN panel), and asks only for what's missing — always brand colors + logo.
02Parallel subagents. research-agent (web search, max 2 queries) and design-agent run simultaneously in isolated contexts; only validated JSON returns to the main thread. Research is presented with cited sources — never naked claims.
03Type-filtered template pick. Research says 1-page checkout vs 2-page vs express store → the agent lists only matching template funnels; the user picks.
04Design preview + plan approval. Palette, hero copy, sections, and the full build plan. ⏸ human gate
05Build. clone_funnel → apply_design (real git commits: CSS tokens, uv-design.css, hero/CTA copy applied to the auto-detected real landing page) → code-agent stages section/content edits → diff review → full deploy. Every mutating call pauses at a native interrupt. ⏸ per-mutation gates
06Self-verification. walk_funnel opens the live URL in headless Chromium, clicks through every step, fills the test card on checkout, and reports per-step navigated/filled/console-errors. The agent reads its own QA report and fixes-or-reports.
capabilities

Deep-agent features — all live

①Self-written plans

The agent maintains its own todo list (write_todos); the PLAN panel renders it live — pending ○, in-progress ◐, done ●.

②Native human-in-the-loop

interruptOn pauses the graph at all 17 mutating tools. Approve / edit / reject from the UI; the run resumes from its checkpoint via Command. A second deterministic gate sits underneath — defence in depth.

③Context engineering

Virtual filesystem (WORKSPACE panel) for offloading bulky catalogs; built-in summarization past 60k tokens; subagent isolation; 12k tool-result truncation; 345 tools curated to ~35.

④Durable memory, 3 layers

Checkpoints (threads survive restarts) · virtual files (task-scoped) · long-term save_memory/search_memory across sessions.

⑤Time travel

Every step checkpointed → ⏪ rewind lists history; the next message forks the conversation from any chosen checkpoint.

⑥JSON subagents + skills

Subagents return strict JSON the parent consumes — and they run on any free tool-calling model (no forced-tool_choice dependency that excludes free tiers). Domain knowledge ships as a SKILL.md loaded on demand — progressive disclosure, not prompt bloat.

⑦An agent that spawns agents

The code-agent is a nested deep agent: it gathers business context, writes its own plan, and decides how many parallel coder workers to spawn. Claude-Code-style coding, inside the SaaS.

⑧Staged code, human-reviewed

Coders never touch git. Writes are staged per thread, pass a protected-region validator (builder tags, forms, payment/product markup, shrink limits), surface as a full diff for review, and push only through the interrupt gate.

⑨Live orchestration graph

The ORCHESTRATION panel renders the agent hierarchy in real time — main → research / design / code-agent → coder workers — nodes lighting up as work fans out. The multi-agent structure, visible.

⑩Click-to-answer wizard

The agent never dumps questions as prose — it opens a step-by-step wizard (progress, one question at a time, option cards, free-text, review → submit/cancel). The operator clicks, never re-types.

⑪Cost & budget transparency

Live tokens in/out, wall-time, and an estimated $ cost per session in the runbar — turning red past a budget. On free/cloud models it reads $0: a full autonomous build at zero LLM cost.

⑫Closed feedback→eval loop

A 👎 on any message captures the triggering request straight into the eval dataset (learned-cases.jsonl). Failing scenarios become replayable regression tests — the system learns from its mistakes.

⑬Crash-proof & resumable

Every step is checkpointed; a flaky model can't crash the server (guarded), and a reload auto-resumes the exact thread — history, plan, and files restored. Eight-minute runs survive interruptions.

⑭Compose-your-own agents

The agent kinds are data, not hard-code. A frontend builder lets anyone compose a new Unify V6 agent — pick from the 345 MCP + direct tools, toggle sub-agents, write the instructions — saved as a card, no deploy. Presets for code-only, flowboard-only, tester. Approval gates apply to any composed agent automatically (they key off tool names).

⑮Self-improving — reflective memory

Every failure signal — turn errors, repeated tool calls, rejected gates, 👎 comments — is distilled into a short lesson, deduped and counted per agent-kind + niche, and written to an auto-generated lessons-learned skill the agent reads at the start of each run. Recurring mistakes are flagged ⚠️ so it stops repeating them. Verbal reinforcement — no fine-tuning, works on any BYOK model.

⑯Loop mode — hill-climbing loop

Opt-in via a setup wizard (⟳ loop). Fast loop: every turn is graded; a low-scoring turn auto-retries once with the grader's critique injected — never on turns that ran a mutating tool. Slow loop: after N low turns an engine-analysis agent reads the accumulated scores + feedback and proposes prompt-overlay updates — shown as a diff card, applied only on your approval, revertible anytime. The agent climbs; the human holds the gate.

domain knowledge

Domain knowledge as skills

Platform expertise ships as drop-in SKILL.md files (progressive disclosure — only each skill's name + one-line description sit in the prompt; the full body loads on demand when relevant). New knowledge is added by dropping a folder in skills/ — no code change, no prompt bloat. Two of these were distilled from the platform's 253-page CMS V6 manual into agent-facing rules (field requirements, the payment/CRM model) — not screenshots.

🛠 funnel-ops

The build playbook: exact deploy recipe order, Flow Builder edge metadata, step-settings ids (flowboard_step_version_id + crm_setting_id), theme repo layout, verification recipes, and the protected-region rules coders must never break.

🧱 unify-platform

Platform conventions: theme template ids, CRM/provider types, company/account structure, and the ID semantics for reading MCP responses (what's global vs funnel-scoped, when repo_project_id appears).

🧭 unify-funnel-build from manual

The create-funnel model: Standard vs Express, 1-page/2-page, the Standalone-vs-CRM payment choice (VRIO Connection ID, numeric Campaign ID), URL-path rules, checkout General Settings (allowed countries/states, validation display), payment methods, and Flow Builder step types.

📇 unify-entities from manual

What a valid create/update payload needs for Products, Shipping, Companies, People; the provider/CRM model (5 CRMs, 3 levels — funnel-primary / step-override / backup-failover, billing types); the token system; and "never invent CRM ids — import them."

🧠 lessons-learned auto-generated

The one skill the agent writes for itself. After each failed turn or 👎, the failure is distilled into a deduped, per-kind + per-niche lesson (recurring ones flagged ⚠️) and appended here. Read at the start of every run so known mistakes aren't repeated — progressive disclosure means a growing lesson library never bloats the prompt.

Loaded via createDeepAgent({ skills: [SKILLS_DIR] }); listed at GET /health. The agent pulls a skill's full text only when its description matches the task — domain depth without paying for it every turn.

second surface

Same brain, in your terminal

A second surface over the same agent core — installable as deepagent, runs in any terminal or VS Code's. No hosted backend to pay for. And because it's local, the funnel repo is checked out to your own disk: the agent edits real files, you review/fix them in your editor, then approve the push. A Claude-Code-style coding agent for funnels.

zsh — deepagent clone
$ deepagent clone "premium dog supplement brand, US market, calm clinical tone"

  ⬡ deepagent  autonomous funnel-ops agent
    model: ollama/minimax-m3   ·   coder: ollama/qwen3.5:397b

● research-agent ✓     ● design-agent ✓
● code-agent
   ● coder · landing.html     ● coder · css/uv-design.css
● Update(landing.html)
  ⎿ +12 −3
    12 + <h1>A clinically dosed daily multivitamin…</h1>
    13 + <!-- DEEPAGENT-SECTION:trust -->

 ⏸ approval needed · commit_staged
    ✎ files at ./deepagent-workspace/funnel-4472 — git diff, fix anything, then approve
    [a]pprove · [r]eject · [e]dit on disk then approve

 ⠹ Working… (6s · ↓1.2k tokens · qwen3.5:397b)        code-agent-parallel-workers
 ╭───────────────────────────────────────────────────────────╮
 │ > type a message                                          │
 ╰───────────────────────────────────────────────────────────╯
 clone · minimax-m3 · coder qwen3.5:397b · ^C cancels the turn

①One core, two surfaces

Web and CLI both call the same buildAgent() + runTurn() — same agents, MCP, prompts, guardrails, evals. The CLI is a thin adapter; the stream choreography is shared. Fix the brain once, both inherit it.

②Local-git rectify loop

A pluggable staging backend checks the funnel repo out to ./deepagent-workspace/funnel-<id> as a real git repo. The code-agent edits actual files; you open them in VS Code, git diff, fix what the model got wrong, then approve — your edits are pushed too.

③Two models, by role

A fast model drives the conversation while a dedicated stronger coder runs the code-agent and its parallel workers — --coder-model / config / DEEPAGENT_CODER_*. The hardest reasoning gets the best model; the chatter stays cheap.

④Claude-Code-style TUI

A full-screen ink UI: scrolling ● tool tree, syntax-highlighted line-numbered diffs, a live status footer (spinner · elapsed · tokens · activity pill), a pinned input box, and inline approval / ask-wizard prompts. ^C cancels the turn, not the app.

⑤Workspace sandbox

The OS-filesystem analogue of the approval gate: every repo path the agent names is resolved inside the checkout — ../ traversal and absolute paths are refused on read, stage, and commit. The agent can't touch a file outside its workspace, even under injection.

⑥Local-first, BYOK, honest

Project-local state in ./.deepagent/ (checkpoints, threads, memory); single-user by design — sidestepping multi-tenant auth. No hosted server. It still calls your LLM, Unify, and the repo host over the network: the host tier is gone, not all egress.

Install: npm i && npm link in deepagent-cli/ → deepagent config → deepagent clone "…". Commands: clone · edit · resume <id> · threads · config.

measured, not claimed

Quality is measured, not claimed

Shared evaluators run in two modes; guardrails are deterministic code, and human feedback closes the loop.

LayerMechanismWhere to look
GuardrailsServer-side approval gate on every mutating tool (verified: cross-thread + post-turn blocked) · injection input filter · secret redaction (keys, PATs, bearer tokens) · SSRF allowlist · loopback-only bindsrc/guardrails.ts
Offline evals12-case dataset (happy / edge / adversarial) replayed via npm run eval; LLM-judge optional; safety + approval failures block regardless of average; CI exit codeevals/
Online evalsEvery live turn auto-scored (approval compliance, safety, citations, efficiency) + sampled LLM judgedata/online-scores.jsonl
Human feedback👍/👎 + comment on every message — stored with the turn snippet, mirrored to Langfusedata/feedback.jsonl
Closed loop👎 promotes the triggering request into the eval dataset; npm run eval replays curated + learned cases togetherevals/learned-cases.jsonl
Self-improvingerrors · duplicate calls · rejected gates · 👎 distilled into deduped per-kind/niche lessons (recurring flagged ⚠️), auto-written to a skill the agent reads on its next rundata/lessons.jsonl · skills/lessons-learned/
Loop modeopt-in hill-climbing loop: low-scoring turns auto-retry with critique (mutation-safe); after N low turns an engine-analysis agent proposes prompt-overlay updates — human-approved, size/secret/injection-validated, revertiblesrc/loopMode.ts · data/prompt-overlay/
TracingLangfuse (OTel) — full trace per run: LLM calls, tools, subagent spans; sessions keyed by thread; scores attachedLangfuse UI
TransparencyLive tokens in/out, wall-time, and estimated $ cost per session in the runbar — visible, not hiddenusage HUD
defense in depth

Security — defense in depth

An autonomous agent operating a real CMS and its repo, partly fed by untrusted content (web pages, funnel HTML). Every risk is answered by deterministic code, not prompts — with a human approval gate as the hard backstop. Audited 2026-06-10; details in docs/SECURITY.md.

① Human-gated mutations

Every irreversible tool (clone · create · company/people bootstrap · deploy · apply_design · commit · funnel writes) pauses at a native interrupt AND a server-enforced approval gate. Thread-scoped, per-turn — verified bypass-proof across threads and after the turn. Two independent layers.

② BYOK key isolation

The LLM key lives only in the request's memory — never written to disk, traces, history, or the event stream. Output is secret-redacted (OpenAI/Anthropic/Gemini/Groq/OpenRouter/Tavily keys, repo access tokens, JWTs, bearer tokens).

③ Untrusted content = data, not instructions

Fetched page titles and repo files are wrapped in <untrusted-data> envelopes and injection-neutralized; prompts forbid acting on instructions found inside them. Indirect prompt injection can't steer the agent past the approval gate.

④ Input & SSRF guards

Operator input is screened for injection / pasted keys / oversized payloads before the model. LLM-supplied URLs (verify · walk) are restricted to public http(s) — loopback, private, IPv6, cloud-metadata, and encoded-IP hosts blocked.

⑤ Safe code changes

Coders only stage edits; a deterministic validator blocks any change to forms, payment, product/shipping markup, or builder tags, and refuses file-shrink. Nothing reaches git until the human reviews a diff and approves the commit.

⑥ Contained & resilient

Loopback-only bind · token cache & DB at 0o600 · MCP surface allowlisted (≈30 of 345) · per-request timeout · crash guards so a flaky model can't take down the server · npm audit clean.

Honest scope: single-operator / loopback by design. Multi-tenant auth, rate limiting, and per-user scoping are documented prerequisites before any public deployment — see docs/SECURITY.md.

benchmark

Eval report — benchmark

How quality is reported. sample data — illustrative Real numbers are produced by npm run eval (curated + learned-from-feedback cases) and written to evals/results-<ts>.json; this page auto-loads the latest run from GET /evals.

0.86
overall score
13
cases run
12 / 13
passed ≥ 0.70
0
safety / approval fails
~6s
avg / case
approval_compliance1.00
safety1.00
citation_presence0.92
tool_correctness0.88
task_completion0.84
gather_quality0.81
efficiency0.74
CaseTagsScore
clone-happy-1happy-path · gather0.93
clone-multi-skuedge · express-store0.88
inject-1adversarial · injection1.00 (refused)
key-leak-1adversarial · secrets1.00 (no echo)
clone-approval-gate-1adversarial · approval1.00 (held gate)
fb-… (from 👎)from-feedback0.71
shipped & ahead

Roadmap — shipped & ahead

A production-shaped v1 is built; the path beyond it is mapped. Full detail in docs/ROADMAP.md.

40
capabilities shipped
2
surfaces · web + CLI
~95%
input-token cut (projection)
1
gap to v1: a full recorded run

Agents & autonomy

  • Clone·Build + Create·Build + Edit·Mutate agents
  • Fresh-from-scratch create (bootstraps company/CRM)
  • Parallel research ∥ design sub-agents
  • Nested code-agent → coder workers
  • Staged edits → diff → gated commit
  • Self-verifying browser walk
  • 4 domain skills (2 distilled from the CMS manual)
  • Click-wizard intake

Human control & safety

  • Approval gate on every mutation (2-layer)
  • Injection filter · secret redaction · SSRF
  • Indirect prompt-injection defense
  • Protected-region code validator
  • Loopback bind · token/DB 0o600

Memory & resume

  • Durable checkpoints (survive restart)
  • 3-layer memory + long-term recall
  • Time-travel rewind
  • Thread history (resume / delete)
  • Auto-resume · crash-guarded

Transparency & UX

  • Token streaming
  • Live plan · workspace · orchestration tree
  • Cost/$ + time + turns HUD
  • Per-message 👍/👎 feedback
  • Showcase + flow diagram

Quality & observability

  • Offline evals + CI exit code
  • Online per-turn scoring
  • Closed feedback→eval loop
  • Reflective lessons-learned loop (self-improving)
  • Loop mode: graded auto-retry + human-gated prompt self-tuning
  • Langfuse tracing

Models & cost

  • 6 providers, BYOK
  • Field projection (~95% smaller results)
  • Lean MCP schemas
  • Opt-in prompt caching (OpenAI/Anthropic)
  • Intent-reuse cache (skip sub-agents on repeats)
  • Per-request timeout · graceful tool errors

CLI surface

  • Installable deepagent CLI · shared core
  • Ink TUI · tool tree · line-numbered diffs
  • Local-git rectify loop on your disk
  • Dedicated coder model (two-model)
  • Workspace sandbox (path-traversal guard)
  • Project-local state · runs in VS Code
Where it's headed
Now
close v1
  • One verified end-to-end run recorded as proof
  • Harden the deploy → walk tail
Later
productization
  • Per-user auth + tenant scoping
  • Live /metrics dashboard
  • Model router (cheap↔strong)
  • Self-healing deploy · remote approval
Vision
differentiators
  • Logo / hero-image generation
  • A/B design variants
  • Scheduling · team workspaces
  • Semantic memory / RAG over past funnels
see it run

See it run

A full recorded session — clone → research ∥ design → approval gates → design + code → deploy → live walk.

Open the full recorded session (PDF, 54 MB) ↗ — clone → research ∥ design → approval gates → design + code → deploy → live walk, captured end to end.

90-second script

90-second demo script

  1. Open / → pick Clone · Build (BYOK modal if no server key) → send: "Unisex t-shirt store, USA, audience 18-35 — find me the right template."
  2. Point at the PLAN panel filling itself, the parallel sub-agent dispatch rows, and tokens streaming live.
  3. Research lands with cited sources; templates are filtered to the researched funnel type. Answer the brand question.
  4. The agent asks to clone → ⏸ gate card pops with the exact tool args. Hit Reject once — show it re-plans. Then Approve.
  5. Open the WORKSPACE tab — files the agent wrote for itself. Mention 3-layer memory + 60k summarization.
  6. Show ⏪ rewind: fork the conversation from any checkpoint. Then the usage HUD: exact tokens + time this session cost.
  7. Close with the quality story: tail -f data/online-scores.jsonl scoring the demo you just gave, the 👍 button writing eval data, and npm run eval as the CI gate.
← Back to case study · abhisekbose.me