Skip to main content
Version: 1.16.0-dev

Manage agents, releases and deployments

AgentWorks separates the agent you edit from the exact release that executes. A model, instruction, tool or dependency change therefore never silently alters work already in progress: every run stays pinned to what admitted it. How you make a change depends on how the runtime runs. A headless runtime builds its releases from its runtime file. A runtime connected to Flightdeck runs what Flightdeck publishes, releases and promotes.

What are the lifecycle objects?​

ObjectMeaning
AgentSpecThe YAML or JSON description of an agent's executor, instructions, model roles, tools and limits.
ReleaseThe exact agent version plus the resolved models, gateway identities, pinned tools with their schemas and effects, the skills it declares, and limits it runs with.
DeploymentA stable name in an environment, such as triage in production, that admits new runs.
RevisionWhat a deployment admits now, numbered by a generation that only grows.
CohortThe runtime work belonging to one revision; it drains when a newer revision takes new work.
RunOne durable piece of work, pinned to the release, revision and cohort that admitted it.
AgentSpec -> release -> deployment revision (generation N) -> new runs
|
+-> a change makes revision N+1; runs on N finish on N

How does a headless runtime change a deployment?​

The runtime file lists each agent once, at the version this runtime serves, and each deployment names an agent:

agents:
- file: agents/support-triage.yaml # metadata.version: 1.0.0
deployments:
- name: triage
environment: production
agent: support-triage

For each deployment the runtime builds a release from the agent's AgentSpec: the models are resolved through the configured gateways, capability-pack tools are pinned with their schemas and effects, and each skill the agent declares is pinned with its content digest. There is no separate publish, build, environment or promotion step, and no API for one; you change the file.

  1. Edit the AgentSpec, for example set metadata.version: 1.1.0 and change the instructions.
  2. Run validate on the file, as in Run AgentWorks headless from a runtime file.
  3. Let the runtime read the file again; it does so every 5s by default (agentworks.config.reload-interval).
  4. Check GET /api/v1/deployments: the deployment keeps its id and shows the next generation and a new revisionId.

Each time the file puts a deployment on something new, another agent version or another configuration, the deployment gets a new revision and the runtime records it in its SQLite file. New runs use the new revision. A run that started earlier finishes on its own revision, which stays readable, draining, until its last run ends. This holds across a restart, because the revisions are in the SQLite file.

A change with any problem is refused as a whole and logged once, and the last good version stays in use. A deployment whose release cannot be built yet, for example because its model gateway is not configured, is left out with the reason while the rest are served.

How do you roll back a headless deployment?​

Put the earlier AgentSpec back in the file. Going back is a new revision, as any rollback is, so generations only grow: rolling back from generation 2 to the 1.0.0 agent gives generation 3. Runs on generation 2 still finish on generation 2.

To stop a deployment, remove it from the file. It admits no new run, and its unfinished runs still finish; while they do, GET /api/v1/deployments lists it with admitting set to false and revisionId set to null.

Keep your runtime file and agent files in Git and run validate in CI, so every revision a runtime serves is a reviewed commit you can return to.

How does a connected runtime get its releases?​

With a runtime connected to Flightdeck, the AgentWorks control plane runs inside Flightdeck and the lifecycle steps happen there, on the AgentWorks pages Flightdeck hosts:

  1. Publish an AgentSpec as a read-only agent version. Publishing validates the specification; it neither deploys nor runs anything.
  2. Build a release from the version: Flightdeck resolves every model role through its model gateway and pins the models and tools the release runs with.
  3. Promote the release into an environment's deployment. Environments are Flightdeck's own; AgentWorks creates none of its own. Promotion policies, approvals and signed release evidence apply here when your environment requires them. A promotion can carry credential references and a runtime target.
  4. Flightdeck sends the deployment to the runtimes that serve that environment in their signed bundle, and the runtime admits new runs on the new revision.

Flightdeck's PostgreSQL is the system of record for releases, deployments and approvals. The runtime keeps only the runs. See Connect AgentWorks to Flightdeck.

What happens to runs when a newer release is promoted?​

Suppose release R1 is running and you promote R2:

  • new runs go to R2;
  • existing R1 runs stay on R1;
  • R1's cohort enters DRAINING: it accepts no new work but finishes its old work;
  • R1's cohort can retire once all of its work is finished or safely resolved.

AgentWorks never swaps R2 into the middle of an R1 run. Rollback is the same decision in reverse: route new work to the last accepted release. It never rewrites a release or changes a run already admitted. Keep a compatible runtime available while an older release still has active or recoverable work; see Operate runtimes and recover work.

How do runs keep their release?​

A root run is new work, such as a new API request, and uses the deployment's current revision. A continuation resumes existing work, such as a human response, callback, child result or scheduled wake-up, and keeps the release and security context of the run it belongs to. Start and follow runs through the runtime's API:

curl -s -H "Authorization: Bearer $KEY" -H 'Content-Type: application/json' \
-d '{"input":{"prompt":"I was charged twice for my November invoice."}}' \
http://127.0.0.1:8080/api/v1/deployments/$DEPLOYMENT/runs | jq '{id, releaseId, revisionId, lifecycle}'
{"id":"aabe30f8-e5e9-44d6-8c07-5c08225ad50a","releaseId":"a50194ad-69fa-326d-9480-d63d7c5aef9e",
"revisionId":"7857f8e5-7820-3675-8b49-20796fdb981d","lifecycle":"QUEUED"}

The run's releaseId and revisionId never change, whatever later revisions the deployment gets. Follow the run at /api/v1/runs/<run-id>/stream, and reconnect with the last event id after a network interruption; see Operate durable runs and interactions.

Next steps​