Run your first AgentWorks agent
DVARA AgentWorks runs durable AI agents whose model, tool and agent-to-agent calls DVARA, the AI gateway, can govern. This quickstart runs one agent from start to finish on your own computer: you describe the agent in YAML, list it in a runtime file, start AgentWorks from that file, run the agent, change it without a restart, and prove that queued work survives a restart.
You need no database, no Flightdeck, no model provider account and no API key. AgentWorks keeps its runs in one local SQLite file, and the walkthrough uses a predictable local test model that makes no network call.
By the end you will have:
- described an agent in a small AgentSpec;
- listed it in a runtime file,
agentworks.yaml, with a deployment and a caller key; - checked the file and started AgentWorks from it;
- run the agent and read its result and events;
- changed the agent and seen the deployment move to a new revision while earlier runs keep theirs;
- restarted AgentWorks without losing a queued run.
Plan for about 15 minutes after the first build completes.
The local test model is accepted only when AgentWorks binds to a loopback address, which the local profile does.
Inside the released image ghcr.io/dvarahq/dvara-agentworks-ee:1.15.0, that loopback address is the container's own,
and a published container port does not reach it; bound to any other address, the runtime refuses the test model at
startup. This walkthrough therefore runs the server JAR built from the private release tag v1.15.0, which needs
authorized access to that tag. To run the released image, use a real model gateway and follow
Run AgentWorks headless from a runtime file.
What do the words mean?
| Word | Plain meaning |
|---|---|
| AgentSpec | The YAML description of the agent's instructions, models, tools and limits. |
| Runtime file | agentworks.yaml: which agents this runtime serves, where they are deployed, and who may call it. |
| Deployment | A stable name in an environment, such as hello in development, that runs one agent. |
| Revision | What a deployment runs now. Changing the agent or its deployment makes a new revision, numbered by generation. |
| Run | One job performed by a deployed agent for one input. |
| Caller key | A secret a caller sends as Authorization: Bearer <key>. The runtime file names the variable that holds it. |
AgentWorks here is the runtime only. It reads the runtime file, keeps every run and its history in its own SQLite file, and runs the agents with a worker. In production you can connect a runtime to Flightdeck instead, which then releases, deploys and governs the agents; see Understand AgentWorks architecture.
Prerequisites
- macOS or Linux;
- authorized access to the private AgentWorks release tag
v1.15.0; - JDK 25, Git,
curl,jqandopenssl.
java -version
curl --version
jq --version
Build AgentWorks from the release tag
From a clean clone of the private repository, check out the release tag and build the server:
git switch --detach v1.15.0
./mvnw -B -ntp -DskipTests package -pl agentworks-server -am
cp agentworks-server/target/agentworks-server-1.15.0.jar target/agentworks.jar
The build finishes with BUILD SUCCESS, and the copy puts the server JAR at target/agentworks.jar. Run every
remaining command from the repository root.
Describe the agent
Create a folder for the walkthrough and the agent's AgentSpec in it:
mkdir -p target/agentworks-demo/agents
cat > target/agentworks-demo/agents/hello-agent.yaml <<'YAML'
apiVersion: dvarahq.com/v1alpha1
kind: Agent
metadata:
name: hello-agent
version: 1.0.0
spec:
executor:
type: spring-ai
instructions:
system: |
You are a concise assistant.
Answer in one short sentence.
models:
reasoning:
gateway: local
model: demo-model
limits:
maxSteps: 4
maxRuntime: 1m
maxToolCalls: 0
YAML
| Field | Why it is set this way |
|---|---|
metadata.version | The agent's version. You change it in a later step to see a new revision. |
spec.executor.type | spring-ai, the built-in executor that calls the model. |
spec.models.reasoning | The model role. gateway: local and model: demo-model must match a model gateway you configure when you start AgentWorks. |
spec.limits | Stops a run that takes more than four steps or one minute. maxToolCalls: 0 because this agent uses no tools. |
The YAML is configuration, not program code. See Define agents, models and tools for the AgentSpec fields.
Write the runtime file
The runtime file lists the agent, deploys it as hello in development, and names one caller key:
cat > target/agentworks-demo/agentworks.yaml <<'YAML'
apiVersion: agentworks.dvarahq.com/v1alpha1
kind: Runtime
agents:
- file: agents/hello-agent.yaml
deployments:
- name: hello
environment: development
agent: hello-agent
callers:
keys:
- name: me
secretEnv: CALLER_KEY_ME
role: operator
YAML
The file never holds the key itself, only the name of the environment variable that does. An operator key may read
the workspace and start, cancel, pause and resume runs. Choose a key of at least 32 characters; a shorter key is a
problem in the file:
export CALLER_KEY_ME="local-demo-key-$(openssl rand -hex 16)"
Check the runtime file
The server JAR's validate mode runs the runtime's own reader and starts nothing:
java -jar target/agentworks.jar validate target/agentworks-demo/agentworks.yaml
A good file prints a summary and exits 0:
target/agentworks-demo/agentworks.yaml: valid. Workspace default, 1 agent, 1 deployment, 0 permissions, 1 caller key, 0 identity providers.
Model gateways and bound tools are checked when the runtime starts.
A file with problems lists every problem with where it is, as a JSON pointer, and exits 1. For example, a
deployment that misspells its agent:
target/agentworks-demo/agentworks.yaml: 1 problem:
/deployments/0/agent: names no agent in /agents (helo-agent)
Start AgentWorks
Open a second terminal, run the same export CALLER_KEY_ME=... there with the same value, and start AgentWorks.
Leave this terminal running so you can see the log:
java -jar target/agentworks.jar \
--spring.profiles.active=local \
--server.port=8080 \
--agentworks.config.file=target/agentworks-demo/agentworks.yaml \
--agentworks.config.reload-interval=2s \
--agentworks.storage.local.path=target/agentworks-demo/run-plane.db \
--agentworks.runs.worker.enabled=true \
--agentworks.gateway.gateways.local.type=deterministic-fake \
'--agentworks.gateway.gateways.local.models[0].alias=demo-model' \
'--agentworks.gateway.gateways.local.models[0].model=demo-model'
| Setting | What it does |
|---|---|
--spring.profiles.active=local | Binds AgentWorks to 127.0.0.1 only and allows the local test model. Never use it for a reachable installation. |
agentworks.config.file | Serves what the runtime file lists. Setting it makes the runtime headless. |
agentworks.config.reload-interval | Reads the file again every two seconds. The default is 5s. |
agentworks.storage.local.path | The SQLite file that keeps runs. The default is data/run-plane.db. |
agentworks.runs.worker.enabled | Runs a worker so queued runs execute. Off by default. |
agentworks.gateway.gateways.local.* | A model gateway named local with the predictable test model demo-model. |
If the runtime file has a problem, AgentWorks does not start and lists every problem with where it is, the same way
validate does. It creates nothing in the data folder first.
Back in the first terminal, check that AgentWorks is ready:
curl --fail http://127.0.0.1:8080/actuator/health/readiness
{"status":"UP"}
Run the agent
List the deployments the runtime serves:
AUTH="Authorization: Bearer $CALLER_KEY_ME"
curl --fail-with-body -H "$AUTH" http://127.0.0.1:8080/api/v1/deployments
{"items":[{"id":"4445c895-01ab-3220-acd2-b14bc80e32e8","name":"hello","environment":"development",
"agent":"hello-agent","revisionId":"7857f8e5-7820-3675-8b49-20796fdb981d","generation":1,"admitting":true}],
"nextCursor":null}
Keep the id of hello and start a run on it:
DEPLOYMENT=$(curl -s -H "$AUTH" http://127.0.0.1:8080/api/v1/deployments \
| jq -r '.items[] | select(.name == "hello") | .id')
RUN=$(curl -s -H "$AUTH" -H 'Content-Type: application/json' \
-d '{"input":{"prompt":"Say hello."}}' \
http://127.0.0.1:8080/api/v1/deployments/$DEPLOYMENT/runs | jq -r .id)
echo "$RUN"
The 201 answer is the run, created with its exact pins and queued (abridged):
{
"id": "aabe30f8-e5e9-44d6-8c07-5c08225ad50a",
"deploymentId": "4445c895-01ab-3220-acd2-b14bc80e32e8",
"releaseId": "a50194ad-69fa-326d-9480-d63d7c5aef9e",
"revisionId": "7857f8e5-7820-3675-8b49-20796fdb981d",
"admission": "ROOT",
"lifecycle": "QUEUED",
"createdAt": "2026-11-17T10:31:24.688Z"
}
Within a few seconds the worker finishes it. Read the run and the types of its events:
curl -s -H "$AUTH" http://127.0.0.1:8080/api/v1/runs/$RUN | jq '{lifecycle, usage}'
curl -s -H "$AUTH" http://127.0.0.1:8080/api/v1/runs/$RUN/events | jq -r '.items[].type'
The lifecycle is SUCCEEDED, and usage counts one model call. The events start with RUN_CREATED,
RUN_QUEUED and RUN_ACTIVATED, include MODEL_REQUESTED and MODEL_RESPONSE_RECEIVED, and end with
RUN_SUCCEEDED, whose payload holds the output. The test model answers by echoing the input it was given.
Without a key, AgentWorks answers 401 with a problem document:
curl -s http://127.0.0.1:8080/api/v1/deployments
{"type":"urn:dvaraos:problem:authentication-required","status":401,"detail":"Authentication is required.","code":"AUTHENTICATION_REQUIRED"}
A wrong key gets 401 with the code AUTHENTICATION_FAILED.
Change the agent
Change the agent's instructions and version. AgentWorks reads the file again within two seconds:
sed -i.bak -e 's/version: 1.0.0/version: 1.1.0/' -e 's/one short sentence/one friendly sentence/' \
target/agentworks-demo/agents/hello-agent.yaml
sleep 3
curl --fail-with-body -H "$AUTH" http://127.0.0.1:8080/api/v1/deployments
The deployment keeps its id, and now shows generation 2 and a new revisionId. New runs use the new revision. A
run that started before the change finishes on the revision it started on: its release cannot change underneath it.
If a change has a problem, AgentWorks refuses the whole change, logs every problem once, and keeps serving the last good version. A file is never partly applied. Fix the file and the next read uses it.
Restart without losing queued work
-
Stop AgentWorks with Ctrl+C.
-
Start it again with the same command, but with
--agentworks.runs.worker.enabled=false. -
Start a run. It stays
QUEUED, because no worker takes it:RUN=$(curl -s -H "$AUTH" -H 'Content-Type: application/json' -d '{"input":{"prompt":"Still there?"}}' \http://127.0.0.1:8080/api/v1/deployments/$DEPLOYMENT/runs | jq -r .id)curl -s -H "$AUTH" http://127.0.0.1:8080/api/v1/runs/$RUN | jq -r .lifecycle -
Stop AgentWorks again and start it with the worker enabled.
-
Read the run again. The queued run is still there, the worker finishes it, and its
lifecyclebecomesSUCCEEDED.
Every run, step and result is in run-plane.db, which survives restarts. The deployment's revisions are recorded
there too, so the restarted runtime still shows generation 2.
Troubleshooting
| Symptom | Cause and fix |
|---|---|
| AgentWorks does not start and lists problems in the runtime file | Fix each problem at the JSON pointer it names, then run validate again. |
the environment variable CALLER_KEY_ME is not set | Export the key in the terminal that starts AgentWorks, not only in the other one. |
| Startup refuses the local test model | The test model needs the local profile on a loopback address. Do not override server.address. |
401 with AUTHENTICATION_FAILED | The two terminals hold different keys. Use the same value in both. |
A run stays QUEUED | The worker is off. Start with --agentworks.runs.worker.enabled=true. |
Clean up
Stop AgentWorks with Ctrl+C, then remove the walkthrough's folder, which holds the runtime file, the agent and the SQLite run file:
rm -rf target/agentworks-demo
Next steps
- Run AgentWorks headless from a runtime file with the released image, a real model gateway and identity providers.
- Understand AgentWorks architecture: headless and connected runtimes.
- Manage agents, releases and deployments: revisions, generations and rollback.
- Connect AgentWorks to Flightdeck to release, deploy and govern centrally.
- Secure identities and credentials.