Documentation 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.Agents.AI is a preview NuGet package that exposes a Squad team as a Microsoft Agent Framework AIAgent. It wraps the Squad CLI through the GitHub Copilot SDK, delegates MAF sessions, runs, and streaming to the inner Copilot-backed agent, and gives .NET consumers a DI-friendly wrapper instead of hand-rolling CLI process setup. SquadAgent extends DelegatingAIAgent — so it fits naturally anywhere that AIAgent is expected, including Semantic Kernel pipelines and ASP.NET Core minimal API endpoints.
Prerequisites
| Prerequisite | Details |
|---|---|
| .NET 10 SDK | dotnet --version must print 10.x.x |
GitHub Copilot CLI on PATH | Install from github.com/github/copilot-cli; verify with copilot --version |
| Squad CLI and initialized team root | Follow the Squad install guide; run squad init in your team directory |
| GitHub authentication | Run gh auth login or copilot auth login once before starting the app |
Installation
Five-line quickstart
RegisterSquadAgent in DI, resolve it, and call RunAsync — that is all you need to send a prompt to your Squad team:
AddSquadAgent registers both SquadAgent and the base AIAgent type in the service container so you can inject either in your application code.
Streaming
SquadAgent supports streaming via the MAF RunStreamingAsync method. Response fragments arrive as AgentResponseUpdate items the moment the CLI process emits them:
Keyed DI
Register multiple Squad teams in the same DI container using .NET 8+ keyed services. Keyed and non-keyed registrations coexist without conflict.- AddSquadAgent (non-keyed)
- AddKeyedSquadAgent
BYOK / ConfigureCopilotClient
Use theConfigureCopilotClient delegate to customize the underlying CopilotClientOptions after Squad applies its standard values. This is the extension point for injecting a BYOK token from Key Vault, adding custom environment variables, or tuning SDK settings:
SquadAgentOptions reference
All configuration lives onSquadAgentOptions. Fields marked [JsonIgnore] are excluded from JSON serialization to prevent accidental credential leakage.
| Option | Type | Default | Purpose |
|---|---|---|---|
SquadFolderPath | string? | — | Required. Path to the initialized Squad team root. PATH connection strings set this and Cwd. |
CliPath | string? | PATH | Override the Copilot CLI executable. When unset, the SDK resolves the default CLI from PATH. |
CliArgs | IList<string> | [] | Additional CLI arguments appended when the process starts. |
Cwd | string? | SquadFolderPath | Working directory for the CLI process. Defaults to SquadFolderPath. |
Environment | IDictionary<string, string?> | {} | Additional environment variables for the CLI process. [JsonIgnore]; token-pattern keys are redacted in ToString(). |
GitHubToken | string? | — | Direct token escape hatch. [JsonIgnore] and always shown as [REDACTED] in logs. Use GitHubTokenProvider for production. |
GitHubTokenProvider | Func<CancellationToken, ValueTask<string?>>? | — | Async callback for secure token retrieval. Takes precedence over GitHubToken. [JsonIgnore]. |
ConfigureCopilotClient | Action<CopilotClientOptions>? | — | Advanced delegate to customize CopilotClientOptions. Subject to routing guard. [JsonIgnore]. |
ConfigureSession | Action<SessionConfig>? | — | Advanced delegate to customize the inner SessionConfig after Squad applies its defaults. [JsonIgnore]. |
TraceEvents | bool | false | Enables verbose Copilot SDK logging. Emits a startup warning when enabled. |
AgentName | string | "Squad" | Display name for the resulting AIAgent. |
AgentFileName | string? | "squad" | Name of the agent definition under .github/agents/{name}.agent.md loaded via --agent. Set to null to skip auto-injection. |
Instructions | string? | — | Optional system instructions appended to the inner Copilot agent’s system message. |
EmitSubagentActivities | bool | true | Opens one OTel Activity per subagent dispatch with lifecycle events. Set to false to handle telemetry from OnSubagentTrace only. |
OnSubagentTrace | Action<SquadAgentTraceEvent>? | — | Callback invoked for every subagent lifecycle event. Independent of EmitSubagentActivities. [JsonIgnore]. |
Connection strings
AddSquadAgent() reads the connection string ConnectionStrings:squad through IConfiguration. In environment variables use ConnectionStrings__squad.
Supported connection-string formats:
teamRoot, cliPath, cwd, cliArgs (semicolon-separated), and env (key=value;key2=value2).
Named registrations support two conventions:
| Style | Example | Looks up |
|---|---|---|
| Aspire-style direct (tried first) | AddSquadAgent("research-squad") | ConnectionStrings:research-squad |
| Legacy prefixed fallback | AddSquadAgent("research") | ConnectionStrings:squad-research |
.WithReference(researchSquad), the consumer can resolve the agent with a single builder.Services.AddKeyedSquadAgent("research-squad") — the Aspire-injected connection string is found automatically.
OpenTelemetry
Squad.Agents.AI emits one OpenTelemetry Activity per subagent dispatch with no additional configuration. Wire it up in two lines:
squad.subagent {Name} span tagged with:
squad.subagent.name— the agent’s identifiersquad.subagent.display_name— the agent’s display namesquad.subagent.sdk_agent_id— the Copilot SDK agent IDsquad.subagent.reply_preview— first 120 characters of the reply
squad.subagent.start, squad.subagent.message, squad.subagent.completed, squad.subagent.failed.
To handle observability yourself and suppress the built-in spans:
The
OnSubagentTrace callback fires regardless of EmitSubagentActivities.
Both can be active simultaneously — Squad’s built-in spans and your custom
callback are independent.Security
Squad.Agents.AI applies several protections by default:Credential redaction
GitHubToken is always shown as [REDACTED] in ToString() output. Environment variable values whose keys contain TOKEN, KEY, SECRET, HMAC, PASSWORD, or CREDENTIAL are also redacted.JSON safety
GitHubToken, GitHubTokenProvider, Environment, and ConfigureCopilotClient are all marked [JsonIgnore] and will never appear in JSON serialization output.Routing guard
The
ConfigureCopilotClient delegate cannot change Cwd, CliPath, or CliArgs. Any changes are silently restored to prevent routing the agent to an unintended CLI process.TraceEvents warning
Enabling
TraceEvents emits a startup warning because verbose SDK traces may include sensitive operational details. Keep it disabled in production.What’s next
SDK Overview
Explore all
@bradygaster/squad-sdk exports — state backends, casting engine, and cross-squad coordination.Observability Guide
Connect Squad’s OpenTelemetry spans to Aspire, Jaeger, Zipkin, or Application Insights.