pub async fn spawn_agent(
__arg0: State<AppState>,
__arg1: Path<String>,
principal: Option<Extension<Principal>>,
__arg3: Json<SpawnBody>,
) -> Result<(StatusCode, Json<SpawnedResponse>), ApiError>Expand description
POST /api/workspaces/{workspace}/agents — spawn an agent (worktree by default).
Routed through the FleetProvider seam: LocalFleet::ensure_agent
delegates to the same FleetManager::spawn_agent this handler called
directly before, so behavior is unchanged.
unattended (#238) runs the agent with no permission gate, so it takes the
admin scope (ADR-0010) rather than the operate a spawn otherwise needs —
a per-field rule the route-level scope table can’t express. The principal is
absent only when auth is disabled entirely, which is already a trusted
loopback deployment, so that case is allowed and still audited.