GET STARTED

Core Concepts

A 2-minute tour of the six building blocks in AnySwarm and how a multi-agent run flows from start to finish.

HARNESS (YOUR APP)• Defines role Profiles & stop rules• Registers shared Services• Runs host control loop & policyRUNTIMEControl plane & isolated sandboxesSANDBOX A· Agent (persistent session + files)SANDBOX B· Agent (persistent session + files)SANDBOX C· Agent (persistent session + files)spawn · send · filesonEvent() · receiptsSHARED SERVICES• Host-side shared state & tools• Boards, pools, Git & verifiers• Agent A writes → Agent B readsHOST GATEWAY• Service Bridge (identity & checks)• Model Gateway (host-only keys)• Enforces permissions & forwards repliesRUN TRACES• outputDir/<runtimeId>/• Sessions, model & Service logs• Artifacts · anyswarm trace UIregisters Servicesmanifest + adapterswarm CLI · model APIauthenticated request & responsesessions & filesarchive-before-delete← callreply →traces

Every multi-agent system built on @anyswarm/core combines the six building blocks below around your own Harness application.

The six building blocks

Building block What it does in one sentence Deep dive
Runtime The live control plane (createRuntime()) for one run: manages Agents, syncs files, streams events, and cleans up safely. Runtime
Services Shared host capabilities — boards, task pools, evaluators, or verifiers. Agent A writes through a Service, Agent B reads it, enabling cross-sandbox collaboration. Services
Sandbox Runs each Agent in an isolated OpenSandbox container with its own private workspace and resource limits. Sandboxes
Agent & Profile A Profile defines a role (prompt, model, image, permissions); an Agent is a persistent session created from it that keeps context across turns. Agents & Profiles
Host Gateway The single trusted boundary outside containers: keeps model API keys on the host and checks caller identity, permissions, and schemas on every Service call. Host Gateway
Trace Viewer Records every model call, tool action, Service handoff, and exported file; launch anyswarm trace to scrub and zoom the timeline in your browser. Trace Viewer

Your Harness is simply the host-side TypeScript program you write: it defines the Services, declares the Profiles and permissions, orchestrates when Agents act, and decides when the job is done.

What happens during a typical run

  1. Set up the stage: Your Harness registers shared Services (such as a handoff store or research board), defines role Profiles and Sandbox limits, and calls createRuntime().
  2. Spawn agents and assign work: Call runtime.spawn() to boot isolated Agents and runtime.send() (or runInput()) to give them tasks. Agents start idle and never spend tokens until you send input.
  3. Collaborate across sandboxes: Each Agent works locally inside its own container using file and shell tools. Whenever it needs to share findings, claim work, or submit a candidate, it invokes a host Service via the swarm CLI — Host Gateway verifies its unforgeable ServiceCaller identity and permissions, runs the Service on the host, and returns the result.
  4. Observe, verify, and close cleanly: Your Harness watches progress via runtime.onEvent(), steers or interrupts Agents if needed, runs independent host acceptance checks, and calls runtime.close(). Runtime archives every session, trace, and artifact (Stop → Export → Delete) before deleting containers.

Next: put these concepts into code in Build your first SDK Harness, then explore each building block starting with Runtime.