The Squad repository ships self-contained TypeScript samples that take you from your firstDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/bradygaster/squad/llms.txt
Use this file to discover all available pages before exploring further.
resolveSquad() call all the way to production-ready patterns like autonomous agent pipelines, governance hooks, and cloud storage backends. Every sample includes its own package.json, a Vitest test suite, and a detailed README — clone the repo and you can run any of them in minutes.
Hello Squad
Beginner. Resolve a
.squad/ directory, cast a themed team from The Usual Suspects universe, onboard each agent with a charter, display the team roster, and verify deterministic names with CastingHistory. The recommended first sample.Autonomous Pipeline
Advanced. Full showcase of the Squad runtime:
CastingEngine, CostTracker, TelemetryCollector, SkillRegistry, StreamingPipeline, response-tier selection, and OpenTelemetry observability. Agents autonomously pick up tasks, route follow-up work with squad_route, record decisions with squad_decide, and accumulate learnings with squad_memory — all visualized in a live terminal dashboard.Cost-Aware Router
Intermediate. Demonstrates how
selectResponseTier() routes tasks to the cheapest model that meets complexity requirements — from direct (no model) for trivial edits to full (premium) for security audits. CostTracker accumulates per-agent spend and fires budget warnings at 70 % and 90 % of the configured limit.Hook Governance
Intermediate. Four governance hook demos in one script: file-write guards (block writes outside safe paths), PII scrubbing (auto-redact emails from tool output), reviewer lockout (deny edits after a rejection), and ask-user rate limiting (cap interruptions per session). Rules run as deterministic code — not prompts — so they can’t be overridden or misinterpreted.
Streaming Chat
Intermediate. Interactive multi-agent chat that routes user messages to the right agent by keyword and streams token-by-token responses via
StreamingPipeline. Supports live GitHub Copilot sessions or a self-contained demo mode (no auth required). Uses SquadClientWithPool, EventBus, and CastingEngine.Rock Paper Scissors
Fun / Advanced. Nine agents with distinct strategies — always rock, always scissors, cycle, pure random, copy opponent, and more — compete in an endless tournament. Sherlock, the learning agent, analyzes per-pairing match history to predict and counter moves. A tenth scorekeeper agent streams live commentary. Demonstrates
SessionPool, parallel session management, EventBus, and strategy prompts.Storage Provider: Azure
Advanced. A complete
StorageProvider implementation backed by Azure Blob Storage. Maps all 24 interface methods to blob operations: read/write use BlockBlobClient, append uses a read-modify-write cycle, rename uses copy-then-delete, and list uses listBlobsByHierarchy. Works with Azurite locally or a real Azure account in production.Storage Provider: SQLite
Advanced. A portable
StorageProvider backed by SQLite via sql.js (SQLite compiled to WebAssembly — no native binaries). Files are stored as rows in a files(path, content, updated_at) table with virtual path keys. Demonstrates persistence across provider instances, making it ideal for testing and embedded deployments.Prerequisites
All samples require Node.js 20 or later. Build the SDK from the repository root before running any sample:streaming-chat, rock-paper-scissors) support a live mode that requires a GITHUB_TOKEN with GitHub Copilot access. Check each sample’s README for details — every sample runs in demo or offline mode without any token.
Running a sample
Each sample is a standalone project. The general pattern is:npm start script (which runs npx tsx index.ts). Some also provide npm run dev for watch mode:
Sample structure
Every sample follows a consistent layout so you can find your way around quickly:| File / Directory | Purpose |
|---|---|
index.ts | Main application — the entry point you run |
package.json | Dependencies, scripts, and metadata |
tsconfig.json | TypeScript configuration (ESM, strict) |
tests/ | Vitest test suite covering the sample’s key behaviors |
README.md | Setup, expected output, and key concepts |
Recommended learning path
Work through the samples in order of difficulty: Beginner — start here:hello-squad— Casting, onboarding, andCastingHistory
hook-governance — Security and governance hooks
3. streaming-chat — Real-time session routing and streaming
4. cost-aware-router — Tier selection and budget tracking
5. rock-paper-scissors — Multi-session pooling and learning agents
Advanced — integrate everything:
6. autonomous-pipeline — All core APIs in one working showcase
7. storage-provider-azure / storage-provider-sqlite — Custom storage backends