Runnable examples of @lousho/build-ai-agent in use. Each directory below
is runnable directly (see its own README for exact instructions); most use
tsx and a free mock provider by default, so nothing here needs an API key
to try.
The examples import the SDK by its package name and public subpaths
(@lousho/build-ai-agent, @lousho/build-ai-agent/testing, ...), exactly as
your app would, so you can copy a file out as it is. Inside this repo the
paths in tsconfig.json (and a resolver in vitest.config.ts) point those
imports at src/, so nothing needs building first.
An agent defined as a directory (instructions.md, tools/, skills/, agent.json) and loaded with loadAgentDir(); runs offline with a mock model.
A coding-agent harness: a broken add() fixture the agent must fix under a guard (test files are refused), with a loop guard, checkpoint rewind and per-family instructions; runs offline with a mock model. kit.test.ts installs the same harness as the coding-kit registry item and builds it into a node-server deployment (H1).
A coding agent driven by deterministic flows whose routing is a typed decision (the "System One" pattern): createAgent({ output }) returns { route, confidence, reason }, low-confidence requests escalate to the careful path, and each route is a phase workflow with a proof gate.
Connecting an agent to external services over MCP — the Claude-connectors shape. Runs fully offline against a mock stdio MCP server (written with serveMcp) exposing fake docs_*/slack_* tools; the README maps real Google Docs, Slack, GitHub and Notion entries.
Chat-with-your-database (the Vanna/Databricks Genie archetype): the agent introspects the schema, writes SQL and answers with real rows — with defense-in-depth read-only enforcement (tool validation plus a permission rule), so DELETE/DROP can never run. node:sqlite-backed; runs offline with a mock model.
The deep-research archetype (Anthropic's multi-agent research shape): a coordinator decomposes a question and fans out parallel task calls to a researcher sub-agent — parallel readers, compressed summaries back — then synthesizes a cited report. Runs offline on an in-memory corpus; proves real fan-out concurrency.
A question-answering agent scoped to a single fixed document.
The evaluator-optimizer pattern (CrewAI's writer/critic shape): a writer drafts, llmCritique() scores the draft against a rubric and returns actionable feedback, and the draft is revised until it passes or maxRounds is hit. Runs offline with mock models.
Deploy an agent to a real Hostinger VPS: verify the VM via the Hostinger API, lousho build --target=docker, ship the image over SSH, run it behind bearer auth, then prove /health + approval pause/resume. Needs a Hostinger API token and a VM; no purchase step.
Runnable snippets showing OpenRouterProvider usage: generation, streaming, tool calling, model listing and more. Needs OPENROUTER_API_KEY.
A flagship end-to-end pipeline: a Grafana/Datadog monitor delegates a fix (behind a real human approval gate, with a Slack "Fix it" button) to a fixer agent, whose patch is guardrail-gated before a GitHub PR is opened.
Phase engineering on FlowBuilder: discuss → spec → plan → implement → proof gate → report, where the gate is a real toolCall check and the bounded retry ladder is a oneOf chain (the executor's runtime shape — no loop node, no early exit).
Plan first, then edit: a coding agent in plan mode reads and proposes, then session.setPermissionMode('acceptEdits') lets it apply the plan; runs offline with a mock model.
A research agent with the built-in http tool wired up.
Turns a raw event description into a short, Slack-ready notification.
A minimal, empathetic customer-support agent.
The production support archetype: a triage agent classifies the request and handoff()s the whole conversation to a billing or tech-support specialist — control transfers, unlike a sub-agent whose result returns. Approval-gated refund tool, structured handoff args, and hand-back routing; runs offline with mock models.
Runnable examples of AgentExecutor.execute() wired to console and OpenTelemetry trace exporters.
Waves — Workers · Aggregate · Verify · Extend: bounded parallel workers in clean contexts, a deterministic aggregate, a typed { verdict, gaps } verifier, and a follow-up wave that runs only on the gaps it names.
An agent that classifies an incoming request into a fixed set of categories.