Want an agent-backed flow built from scratch? Do Build your first flow
instead. It walks through a support-ticket flow with classifier and resolver agents.
Prerequisites
- The
swarmbinary on your PATH (see Installation).
- No database — SQLite at
.swarm/dev.dbis the default; opt into Postgres later with--store postgres. - No LLM credential — the flow has no agents.
- No workspace setup — an empty
.swarm/data/is auto-created next to the SQLite file. - No repository checkout — the platform spec is embedded in the binary.
- No API token — the local runtime uses a built-in dev token on loopback.
1
Create a minimal flow
Four small files in a No
greeting-flow/ directory. A system node creates an entity and
advances it to a terminal state.greeting-flow/package.yaml
greeting-flow/schema.yaml
pins declares what this flow accepts from outside — here, one event.
platform_version is the runtime range the bundle is written against.greeting-flow/events.yaml
greeting-flow/nodes.yaml
agents.yaml: this flow has no agents, just one system node, and the runtime accepts a
bundle that omits it.2
Verify the contracts
verify ok. If a contract has a problem you get a named finding with a
remediation line instead — fix and re-run. The static analyzer runs the same checks the
runtime runs at boot.3
Run it
Write a payload for the trigger event, then run the flow.
swarm run start boots a runtime in
process on loopback, publishes greeting.requested, and streams the run’s trace. It is the
one-shot way to run a flow; for a long-running server you operate, use swarm serve
(see Running the runtime).--data names the read-only reference directory agents can see; the runtime requires one
even when (as here) it is empty.Both payload.json and the runtime’s .swarm/ directory (store + workspace data) are
created in the directory you run from. Use a scratch directory if you don’t want them in
your project.The runtime logs using built-in dev API token on loopback on startup; only non-loopback
binds need an explicit token, supplied via --api-token-file or serve.api_token_file in
config.The trace shows greeting.requested arriving, the greeter node creating an entity, and
the entity advancing to done (a terminal stage). Press Ctrl-C to stop the local runtime
once you have seen it.The in-process runtime binds
127.0.0.1:8081 and MCP on :8082. If another runtime is
already using them, start a server on free ports and connect instead:
swarm serve --contracts ./greeting-flow --data ./data --api-port 8091 then
swarm run start --connect http://127.0.0.1:8091 --event greeting.requested --payload payload.json.What just happened
swarm verifychecked the bundle against the platform specification.swarm runstarted a runtime (SQLite by default, stored under~/.swarm/stores/projects/) and published your event.- The
greeternode handledgreeting.requestedin one transaction: it created an entity and advanced it todone. - Every step was persisted, which is why the trace could stream it and a crash could replay it.
Next steps
Build a flow
A real flow with classifier and resolver agents.
Core concepts
The model behind what you just ran.
Operating Swarm
Trace, inspect, and run in production.
CLI reference
Every
swarm command and flag.For LLM agents helping a human author this: see
Agentic flow authoring for the ranked artifacts to pull, the
iteration loop to run, and anti-patterns to avoid.

