Build and run your first AgentWorks agent
This quickstart takes a minimal agent through the complete AgentWorks lifecycle without a GUI, provider account, or paid model. The deterministic local model makes no network call, while the agent still uses the normal publication, release, promotion, queue, worker, and durable-run paths.
You will create:
hello-agent -> version 1.0.0 -> release hello-agent-1.0.0
-> development/hello -> one durable run
Plan for about 10 minutes after AgentWorks is running.
Before you begin
Complete Run AgentWorks standalone and headless through Connect the CLI. Keep the server running. This quickstart assumes:
- AgentWorks is available at
http://127.0.0.1:8080with its worker enabled; - the local gateway exposes the deterministic model alias
demo-model; agentworks,curl, andjqare installed; andAGENTWORKS_TOKENcontains the short-lived administrator token created in that guide.
Confirm the headless service and CLI identity:
curl --fail http://127.0.0.1:8080/actuator/health/readiness
agentworks auth status
Create a disposable working directory and run the remaining commands from it:
mkdir agentworks-hello
cd agentworks-hello
1. Create the agent
Save this request as create-agent.json:
{
"name": "hello-agent",
"description": "A small agent used to learn AgentWorks"
}
Create the agent and retain its generated identifier:
AGENT_ID="$(
agentworks --output json agent create --file create-agent.json |
jq -r '.data.result.id'
)"
test -n "$AGENT_ID"
The agent is a stable identity. It has no executable behavior until you publish an AgentSpec.
2. Publish version 1.0.0
Save the following AgentSpec as hello-agent.json:
{
"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
}
}
}
Publish it and retain the version identifier:
VERSION_ID="$(
agentworks --output json agent publish "$AGENT_ID" --file hello-agent.json |
jq -r '.data.result.id'
)"
test -n "$VERSION_ID"
The published version is read-only. Publishing validates the AgentSpec but does not create a deployment or run.
3. Build a release
Save this request as create-release.json:
{
"name": "hello-agent-1.0.0"
}
Build the release and retain its identifier:
RELEASE_ID="$(
agentworks --output json release build "$VERSION_ID" --file create-release.json |
jq -r '.data.result.id'
)"
test -n "$RELEASE_ID"
Here, build means assembling the exact agent version and resolved dependencies into a release. It does not compile the AgentWorks server again.
4. Create a development environment
Environments are logical promotion boundaries; they do not create infrastructure. Create one through the public API:
ENVIRONMENT_ID="$(
curl --fail-with-body \
-H "Authorization: Bearer $AGENTWORKS_TOKEN" \
-H 'Content-Type: application/json' \
-d '{"name":"development","description":"Local quickstart"}' \
http://127.0.0.1:8080/api/v1/environments |
jq -r '.id'
)"
test -n "$ENVIRONMENT_ID"
The CLI and API use the same authorization and workspace rules. Environment creation uses the API because the
1.14.0 CLI does not expose an environment-creation command.
5. Promote the release
Create a promotion request containing the release identifier:
jq -n --arg releaseId "$RELEASE_ID" \
'{deployment:"hello", releaseId:$releaseId, reason:"first local release"}' \
> promote.json
Promote the release into a stable deployment named hello:
DEPLOYMENT_ID="$(
agentworks --output json promote apply "$ENVIRONMENT_ID" \
--file promote.json \
--idempotency-key hello-agent-promote-1 |
jq -r '.data.result.deploymentId'
)"
test -n "$DEPLOYMENT_ID"
The deployment now routes new work to hello-agent-1.0.0. Nothing has run yet.
6. Start and follow a durable run
Save the run input as run.json:
{
"input": {
"prompt": "Explain what AgentWorks does."
}
}
Start the run and retain its identifier:
RUN_ID="$(
agentworks --output json run start "$DEPLOYMENT_ID" \
--file run.json \
--idempotency-key hello-agent-run-1 |
jq -r '.data.result.id'
)"
test -n "$RUN_ID"
Follow its ordered events until the stream ends:
agentworks stream "$RUN_ID"
Then inspect the durable summary:
agentworks run show "$RUN_ID"
Confirm that the lifecycle reaches SUCCEEDED. The result identifies the exact version, release, deployment,
runtime cohort, and usage associated with the run.
What just happened?
- AgentWorks validated and published an exact agent definition.
- The release resolved the model choice and other dependencies promoted with that definition.
- The
hellodeployment selected the release for new work indevelopment. - AgentWorks stored the run before accepting it.
- A worker claimed the run, called the deterministic local model, and recorded its events and result.
This is the same durable lifecycle used with a real model. Only the model adapter is replaced by a predictable local implementation for this walkthrough.
Make a change
Do not edit version 1.0.0 in place. Change metadata.version to 1.0.1, update the instructions, publish the new
version, build another release, and promote that release with a new idempotency key. Existing runs remain linked to
the release that admitted them.
Clean up
When you finish testing, stop AgentWorks with Ctrl+C. The standalone guide uses the disposable embedded H2 database, so stopping that process removes the agents, releases, deployments, runs, and history created by the walkthrough.