Skip to content

Agent Swarm & Demos

The autosre swarm orchestration layer enables multi-agent collaboration through a unified launcher that abstracts provider differences and execution modes. The system supports two distinct providers - local for on-premise vLLM/llama.cpp backends and anthropic for the online API - while managing environment isolation by purging conflicting ANTHROPIC_* variables 1. Agents are instantiated via pre-defined TaskTemplate configurations that assign specialized roles, such as Security Reviewers or Incident Commanders, to a fixed number of parallel agents 2. Execution occurs in either interactive mode, which replaces the current process for live debugging, or eval mode, which spawns a subprocess to capture structured JSON transcripts for later analysis 1.

Provider Orchestration and Environment Isolation

Section titled “Provider Orchestration and Environment Isolation”

The SwarmLauncher class manages the lifecycle of agent teams by constructing the appropriate environment and command-line arguments for the claude CLI. It supports two provider modes: local and anthropic. In both modes, the launcher purges all ANTHROPIC_* environment variables (such as ANTHROPIC_API_KEY, ANTHROPIC_BASE_URL, and ANTHROPIC_MODEL) to prevent configuration leakage between modes.

For the local provider, the launcher re-applies environment overrides from the configured Backend instance and sets ANTHROPIC_API_KEY to a dummy value (local-vllm), as the local proxy does not validate the key. For the anthropic provider, all override keys remain unset, allowing Claude Code to fall back to its native authentication configuration stored in ~/.claude.

diagram

The launcher supports two execution modes determined by the presence of an EvalLaunchSpec.

Interactive Mode

Eval Mode In eval mode, the launcher spawns a subprocess via subprocess.Popen. It sets the working directory to a read-only snapshot of the target repository (worktree_path) and passes the rendered suite prompt via the --print argument. The subprocess is configured with --output-format=stream-json, --verbose, and --include-partial-messages to capture structured output into a transcript file (transcript.jsonl).

Eval mode uses a restricted settings profile that denies Bash execution and limits permissions to file-inspection tools (Read, Glob, Grep) and limited write/edit capabilities. The actual enforcement of read-only constraints is handled at the filesystem layer by autosre/eval/snapshot.py, which sets worktree files to chmod 0o444. The launcher also injects an x-autosre-run-id header into API requests via ANTHROPIC_CUSTOM_HEADERS to tag logs in the proxy.

Agent swarms are configured using TaskTemplate dataclasses that define the number of agents, their roles, and the initial prompt 2. The SwarmLauncher accepts a TaskTemplate to format the initial prompt with role descriptions.

The repository includes several pre-defined templates:

  • code-review: 4 agents (Security Reviewer, Performance Analyst, Code Quality, Documentation & Tests).
  • architecture-analysis: 3 agents (Scalability Architect, Security Architect, Maintainability Architect).
  • incident-response: 5 agents (Incident Commander, Log Analyst, Metrics Analyst, Root Cause Analyst, Remediation Engineer).
  • content-generation: 3 agents (Researcher, Writer, Editor/Reviewer).
  • data-analysis: 3 agents (Data Explorer, Visualization Specialist, Insights Analyst).

In eval mode, the system prompt is constructed by combining the suite’s specific reviewer persona (if provided) with harness rules that enforce the read-only contract and output file constraints 1.

The autosre.demos package provides an enterprise demo framework for showcasing SRE capabilities 3. It exposes DemoRunner, DemoScenario, and DemoPhase classes to orchestrate live presentations. The framework supports audience-adaptive scenarios via AUDIENCE_PROFILES and AudienceProfile.

The demo framework integrates with the swarm orchestration layer to drive vLLM backends and Claude Code agent swarms during live presentations. This allows for the demonstration of complex SRE tasks, such as incident response simulations, using the multi-agent templates defined in the swarm package 2. The DemoRunner likely coordinates the execution of these scenarios, leveraging the SwarmLauncher to manage the underlying agent processes 3.