SDK-first mode lets you define your entire Squad team in TypeScript using strongly-typed builder functions. RunDocumentation 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.
squad build to generate all the .squad/ markdown files automatically — perfect for teams that prefer code over prose configuration, or that want to version-control their team shape as structured data and derive the markdown from it.
The squad.config.ts file
Place asquad.config.ts file at the root of your repository. The file must export a defineSquad(…) call as its default export. Here is the real configuration from the Squad SDK repository itself, trimmed to show the first five agents:
defineSquad({ team, agents, routing, … }). Each section is validated at startup — if you pass a warnAt outside [0, 1] or forget a required name, you get a BuilderValidationError with a clear message before any agent runs.
Builder functions reference
defineSquad(config)
The top-level composition function. Accepts the full SquadSDKConfig object and validates all nested sections by delegating to their respective builders. Your squad.config.ts default export must be the return value of this call.
A semantic version string for the config itself (e.g.
"1.0.0"). Used for
future migration tooling.Team metadata. Pass the return value of
defineTeam(…).Array of agent definitions. Each element must be the return value of
defineAgent(…).Typed routing rules. Pass the return value of
defineRouting(…).Casting configuration. Pass the return value of
defineCasting(…).Governance hook pipeline. Pass the return value of
defineHooks(…).OpenTelemetry configuration. Pass the return value of
defineTelemetry(…).Squad-level defaults applied to all agents unless overridden. Pass the return
value of
defineDefaults(…).Array of reusable skill definitions. Each element must be the return value of
defineSkill(…).defineTeam(config)
Define team metadata, project context, and the member roster.
Human-readable team name shown in the Squad UI and coordinator prompts.
One-sentence description of the team’s purpose.
Markdown string injected into coordinator context at session start. Use it to
describe the stack, owner, and key conventions. Multiline strings are
supported.
Array of agent name strings (without
@ prefix) that make up the team
roster.defineAgent(config)
Define a single agent with its role, charter path, model preference, tools, and capability profile.
Unique agent identifier used for routing, casting, and
@mentions.Short role title shown in the coordinator dashboard and cast display.
One-sentence description of the agent’s personality and focus area.
Path to the agent’s markdown charter file. When set,
squad build copies the
charter content into the generated .squad/agents/{name}/charter.md.Model override for this agent. Pass a string model ID or a
{ preferred, rationale?, fallback? } object for preference-ranked selection.
When omitted the team defaults.model applies.List of Copilot tool names this agent is allowed to use. Omit to inherit the
default tool set.
Structured capability declarations. Each entry is
{ name: string, level: 'expert' | 'proficient' | 'basic' }. Used by the casting engine and skill
matcher.Lifecycle status. Inactive and retired agents are excluded from automatic
casting. Defaults to
'active'.defineRouting(config)
Define typed routing rules that direct incoming requests to the right agent.
Ordered array of routing rules. Rules are matched top-to-bottom; the first
match wins.
Keyword or pattern used to match incoming task descriptions or labels.
Agents (with
@ prefix) to route matching tasks to.Response tier override for tasks matching this rule. Affects model selection
and timeout budgets.
Numeric priority for tie-breaking when multiple rules match. Lower values win.
Human-readable description shown in routing debug output.
Agent that receives tasks when no rule matches. Typically the team lead or
coordinator.
Behavior when the default agent is unavailable.
'ask' prompts the user,
'default-agent' tries the registered default, 'coordinator' escalates to
the team coordinator.defineCasting(config)
Configure which character universes the casting engine may draw from, and how to handle overflow when the preferred universe is exhausted.
Universe names that the casting engine is permitted to draw from. If omitted,
all built-in universes are available.
How to handle a request when all slots in a universe are filled.
'reject'
returns an error, 'generic' assigns a generic persona, 'rotate' wraps
around the roster.Per-universe capacity override. Keys are universe names; values are the
maximum number of cast members drawn from that universe.
defineHooks(config)
Define the governance hook pipeline. See Hooks & Tools for full documentation.
defineTelemetry(config)
Configure OpenTelemetry export for the Squad runtime.
Master switch for OTel export. Defaults to
false.OTLP gRPC exporter endpoint (e.g.
http://localhost:4317). Defaults to the
standard OTLP environment variable OTEL_EXPORTER_OTLP_ENDPOINT if set.Service name tag added to all spans and metrics. Defaults to
'squad'.Trace sample rate between
0.0 (none) and 1.0 (all). Defaults to 1.0.When
true, applies .NET Aspire-compatible defaults (OTLP endpoint from
OTEL_EXPORTER_OTLP_ENDPOINT, resource attributes from OTEL_RESOURCE_ATTRIBUTES).defineDefaults(config)
Define squad-level defaults that apply to every agent unless the agent explicitly overrides them.
Default model for all agents. Accepts a plain string model ID or a
ModelPreference object with preferred, optional rationale, and optional
fallback fields.Default budget applied to all agents. Individual agents may override via their
own
budget field.defineBudget(config)
Define token and cost budgets. Can be used at the squad defaults level or per-agent.
Maximum tokens allowed for a single agent spawn. Must be a finite positive number.
Maximum tokens allowed across all agents in one session. Must be a finite
positive number.
Fraction of the budget at which a warning is emitted. Must be between
0.0
and 1.0 (e.g. 0.8 = warn at 80%).Generating markdown
Once yoursquad.config.ts is in place, run squad build from the repository root:
squad build transpiles your TypeScript config through the SDK’s builder pipeline and writes all .squad/*.md files. The output is semantically identical to what squad init creates interactively — the same agent charters, routing tables, and casting configuration — but derived from code rather than typed prose.
The generated
.squad/ directory should be committed to git. Team members
who do not have the SDK installed can still read the markdown files directly.
Regenerate after every change to squad.config.ts.Model selection
Configure per-agent models insidedefineAgent using either a string shorthand or the full ModelPreference shape:
defaults.model to any agent that does not specify its own. That means you can set one sensible default for the team and only override where it matters.
Budget control
UsedefineBudget to cap token spend at the team level, the individual agent level, or both:
What’s next
Hooks & Tools
Learn how to register pre- and post-tool-use hooks for file-write guards, PII scrubbing, and reviewer lockout.
SDK Overview
See all SDK exports organized by category.