How fleets work and how to get the most out of the fleet API for deployment.
Work from a project directory you care about. Fleet
data is written to .dal/fleets.json under
the current working directory (see File
layout). That path is typically gitignored (many
apps add .dal/ to .gitignore).
From a directory that contains your Worker mold file (paths are examples; use your own):
dal agent fleet create assistant-workers --from-mold mold/worker.mold.dal --count 2
dal agent fleet list -v
dal agent fleet deploy assistant-workers "Smoke test task"
dal agent fleet run assistant-workers
dal agent fleet health assistant-workersmold/worker.mold.dal).dal agent fleet delete assistant-workers
when you are done (fleet metadata only; see Reality check below).Option A — empty fleet (name only; add members later
with add-from-mold or add-member):
dal agent fleet create my-fleetOption B — fleet from a mold (spawns N agents and records their IDs):
dal agent fleet create my-fleet --from-mold mold/worker.mold.dal --count 3Molds are .mold.dal files; see MOLD_FORMAT.md.
dal agent fleet list
dal agent fleet list -v
dal agent fleet show my-fleetdeploy stores the task string on the
fleet (what you intend to run). It does not by itself execute long-lived
workers across machines.
dal agent fleet deploy my-fleet "Process daily logs"
dal agent fleet run my-fleetrun uses the built-in dispatcher: it loads the fleet,
ensures members (may add from mold if the roster is empty), and sends
last_deployed_task to each member via agent coordination.
Use dal agent fleet health my-fleet for a
quick status.
dal agent fleet scale my-fleet 5dal agent fleet export my-fleet --format docker-compose
dal agent fleet export my-fleet --format k8s.dal/fleets.json. Agents = runtime objects
(memory, tasks, messaging) in the process that created
them.create / deploy and exit, the
next dal agent fleet run may
re-create members from the mold when it needs agents
again—behavior is described in Where execution happens
below.When you are comfortable with this flow, read Fleet vs agent and the rest of this page for scaling, blue/green, and automation.
member_ids). So one fleet
= many agents (or zero).create_from_mold with count 10),
you get 10 separate agents, each with its own agent_id, and
each with its own agent state (memory, messages, tasks) in the runtime
that spawned them. The fleet is just a roster of those IDs..dal/fleets.json). Agents are runtime entities with
lifecycle, memory, and messaging. So: fleet = metadata/roster; agents =
the entities that do work and hold state..dal/fleets.json.API (Rust): fleet::create,
fleet::create_from_mold, fleet::list,
fleet::show, fleet::scale,
fleet::delete, fleet::deploy,
fleet::add_from_mold, fleet::add_member,
fleet::run, fleet::health,
fleet::export (with ExportFormat::K8s or
DockerCompose). Fleet has optional
last_create_params (used when scaling up).
CLI:
dal agent fleet create|list|show|scale|delete|deploy|add-from-mold|add-member|run|health|export ...
.mold.dal) that
describes agent type, role, skills, and lifecycle.dal agent fleet create workers --from-mold worker.mold.dal --count 10dal agent fleet scale workers 20
dal agent fleet scale workers 5dal agent fleet deploy workers "Process daily logs".dal/fleets.json) is updated with
last_deployed_task and last_deployed_at. Any
runner or automation can read this and distribute the task to fleet
members.create_from_mold),
the same process holds the agents and can distribute the deployed task
to them (e.g. via your own code that reads the fleet and calls your task
API).create or deploy, agents created in that
process are gone. The fleet file still has member_ids and
last_deployed_task. You can use the built-in runner
dal agent fleet run [name] (dispatches
last_deployed_task to each member via agent coordination),
or your own runner that:
.dal/fleets.json.last_deployed_task, (re)start
or connect to N workers (one per member or one pool per fleet).So: deploy = “record this task for this fleet”;
execution = dal agent fleet run or your
own long-lived process that reads the fleet and runs the task.
| Goal | Use |
|---|---|
| Homogeneous worker pool | create_from_mold with one mold and desired count;
scale to adjust. |
| Record what to run | deploy <name> <task>; then use
show or read .dal/fleets.json for
last_deployed_task / last_deployed_at. |
| Blue/green or canary | Use two fleets (e.g. workers-blue,
workers-green); deploy to one, then switch traffic or scale
the other to 0. |
| Rollback | Redeploy a previous task string, or scale down and scale up from a previous mold version. |
| Export for orchestrators | Use `dal agent fleet export [name] --format k8s |
.dal/fleets.json – Fleet names →
{ name, mold_source?, member_ids, last_deployed_task?, last_deployed_at?, last_create_params? }.
One file for definition + last deployment.*.mold.dal under project or
mold/ (see mold docs).| Area | Implementation |
|---|---|
| Task execution | dal agent fleet run [name] loads fleets, ensures
members (adds from mold if empty), and dispatches
last_deployed_task to each member via
agent::coordinate(..., "task_distribution"). |
| Scale-up params | Fleet has optional last_create_params; set by
create_from_mold and used by scale() when
spawning new members. |
| Add members | add_from_mold(name, mold_source, count, base, params?)
adds N agents from a mold (sets mold_source if fleet was
empty). add_member(name, agent_id) registers an existing
agent. |
| Health | dal agent fleet health <name> reports member
count, has_mold, last_deployed_task/at, status (ok/empty). |
| DAL/stdlib API | fleet namespace in runtime: fleet::create,
fleet::create_from_mold, fleet::list,
fleet::show, fleet::scale,
fleet::delete, fleet::deploy,
fleet::add_from_mold, fleet::add_member,
fleet::health. |
| Export | dal agent fleet export [name] [--format k8s|docker-compose]
emits YAML (JobList or docker-compose services). |
| list output | dal agent fleet list [--verbose|-v] shows
last_deployed_task and last_deployed_at. |
| Area | Notes |
|---|---|
| Scale-down teardown | Scale-down still only truncates member_ids; no agent
terminate/teardown. Can be added when agent lifecycle API supports
it. |
| Concurrency | Single-writer recommended for .dal/fleets.json.
Multiple processes writing may overwrite; use one runner/CLI at a time
or add advisory file locking (e.g. fs2) if needed. |
dal agent fleet run [name] (built-in
runner) or your own process to dispatch the task to fleet members.