Skip to content
DocsTry Aspire
DocsTry

SquadBuilderExtensions Methods

ClassMethods1 member
Provides fluent extension methods for adding and configuring Squad AI-agent team resources in an Aspire Hosting.IDistributedApplicationBuilder.
AddSquad(IDistributedApplicationBuilder, string, string?)Section titled AddSquad(IDistributedApplicationBuilder, string, string?)extensionIResourceBuilder<SquadResource>
Adds a Squad AI-agent team to the distributed application. The lifecycle hook discovers agents from .squad/team.md (or the default roster when the file does not exist), publishes Spawning to Active state transitions visible in the Aspire dashboard, and injects a custom squad:// descriptor that downstream services can consume as metadata. The Squad resource is a logical dashboard/resource-graph entry; it does not start a server process by itself.
public static class SquadBuilderExtensions
{
public static IResourceBuilder<SquadResource> AddSquad(
this IDistributedApplicationBuilder builder,
string name,
string? teamRoot = null)
{
// ...
}
}
builderIDistributedApplicationBuilderThe Hosting.IDistributedApplicationBuilder to add the resource to.
namestringThe Aspire resource name.
teamRootstring?optional Absolute path to the workspace root - the directory that contains the .squad/ folder. Defaults to Directory.GetCurrentDirectory when not specified.
IResourceBuilder<SquadResource>An ApplicationModel.IResourceBuilder`1 for further configuration.
var builder = DistributedApplication.CreateBuilder(args);
var squad = builder.AddSquad("research-squad",
teamRoot: @"C:\repos\my-project");
builder.AddProject<Projects.IncidentWorkflow>("workflow")
.WithReference(squad);
builder.Build().Run();