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
- 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(). - Spawn agents and assign work: Call
runtime.spawn()to boot isolated Agents andruntime.send()(orrunInput()) to give them tasks. Agents start idle and never spend tokens until you send input. - 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
swarmCLI — Host Gateway verifies its unforgeableServiceCalleridentity and permissions, runs the Service on the host, and returns the result. - Observe, verify, and close cleanly: Your Harness watches progress via
runtime.onEvent(), steers or interrupts Agents if needed, runs independent host acceptance checks, and callsruntime.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.