Define AgentWorks agents, models, and tools
An AgentWorks agent is an AgentSpec: a versioned YAML contract for its executor, instructions, model roles, capability packs, and limits. A runtime never takes an agent from an API call. A headless runtime reads the AgentSpec from its runtime file, and a runtime connected to Flightdeck receives it in a release that Flightdeck built. Either way, the runtime pins the exact models and tools before the first run starts.
What does an AgentSpec contain?
The released contract is apiVersion: dvarahq.com/v1alpha1, kind: Agent. This agent checks a customer's identity
with one model role and one capability pack:
apiVersion: dvarahq.com/v1alpha1
kind: Agent
metadata:
name: kyc
version: 2.0.0
spec:
executor: {type: spring-ai}
instructions:
system: Check the customer's identity against the CRM before you answer.
models:
reasoning: {gateway: dvara, model: gpt-5-mini}
execution: {initialIntent: EXECUTE}
capabilityPacks: [crm]
limits:
maxSteps: 40
maxToolCalls: 10
maxRuntime: 5m
maxCostUsd: 2
| Field | What it decides |
|---|---|
metadata.name, metadata.version | The agent's identity. Change the version whenever you change the agent. |
spec.executor.type | Which executor runs it, such as spring-ai. A runtime never substitutes another executor. |
spec.instructions.system | The system instructions. Never put a credential or personal data here. |
spec.models.<role> | A gateway id and a model alias for each role: reasoning, compaction, summarization, memory, capabilityRouting, guardrail, or evaluation. |
spec.execution | initialIntent (OBSERVE, ANALYZE, PROPOSE, or EXECUTE) and autonomyProfile. An agent needs EXECUTE to call tools at all. |
spec.capabilityPacks | The packs, by id, whose tools the agent may call. |
spec.context, spec.memory | Context budget and compaction, and which memory tiers are on. See memory and context. |
spec.limits | maxSteps, maxToolCalls, maxRuntime (such as 5m), and maxCostUsd. |
The whole document is checked against the AgentSpec JSON Schema. An unknown field, an unsupported apiVersion, or
YAML aliases and tags are refused, and the problem names where it is. Treat a refusal as an authoring error; do not
delete a limit just to get past the check.
How are model roles pinned?
Each role names a model gateway and a model alias. On a headless runtime, the gateway is a process setting:
agentworks:
gateway:
gateways:
dvara:
type: openai-compatible
base-url: https://gateway.example.com/v1
credential-ref: env://dvara-gateway
models:
- {alias: gpt-5-mini, model: gpt-5-mini}
When the runtime builds a release for a deployment, it resolves each alias to a concrete model and pins it with the gateway's identity and the capabilities the release requires. A later alias change produces a new release; a run already admitted keeps the model it started with.
A deployment whose model cannot be resolved yet is left out, not served half-built. The runtime keeps serving the
other deployments, reports DEGRADED health with the reason under leftOut, and tries again at most every
30 seconds. The underlying codes are GATEWAY_NOT_CONFIGURED for an unknown gateway id and MODEL_ALIAS_UNKNOWN for
an unknown alias.
Use a DVARA Gateway as the model gateway when every model call must pass DVARA policy, personal-data checks, and the
tamper-evident audit trail. On a runtime enrolled with Flightdeck, the gateway key comes from Flightdeck as a
flightdeck://dvara-gateway reference instead of a long-lived key; see connect a runtime to Flightdeck.
How does an agent get tools?
An agent calls only the tools of the capability packs it declares, and a tool with a declared effect runs only when a permission allows that effect. In a runtime file, the pack and the permission sit next to the agent:
capabilityPacks:
- id: crm
version: 1.0.0
tools:
- tool: crm:lookup-customer:1.0.0
effect: {resource: customer, action: read, risk: low}
- crm:send-letter:1.0.0 # no effect declared
permissions:
- tool: crm:lookup-customer:1.0.0
environment: production
resource: customer
action: read
maximumRisk: low # low, medium, high or critical
- A tool id is
namespace:name:version. The release pins each tool with its schema and its effect. - A tool written as its id alone is pinned with the unclassified effect (
legacy-unclassified/invoke/critical), so only a permission for those values allows it. Declare a real effect wherever you can. - One tool has one effect. Declaring it again with a different effect, an unknown risk, or an empty or wildcard resource or action is a problem in the file.
- A pack tool that the runtime cannot bind yet leaves its deployment out, with the reason, until the tool appears.
On a connected runtime, Flightdeck's tool catalog and its AgentWorks Tools page play the role of the file: they import the tools, and the release that Flightdeck sends pins them the same way. See releases and deployments.
Which built-in and DVARA Gateway tools exist?
| Tool | Available when |
|---|---|
dvarahq:call-agent:1.0.0 | agentworks.gateway.dvarahq.a2a.origin is set. Each call is an A2A message/send through the DVARA A2A Gateway, made as the run's invoker. |
<server>:<tool>:1.0.0 for each MCP tool of the DVARA Gateway | agentworks.gateway.dvarahq.mcp.origin and .servers are set, and the optional MCP connector library is added to a derived image. |
agentworks:remember:1.0.0, agentworks:recall:1.0.0 | Always. A headless runtime keeps the facts in its own SQLite file; a runtime enrolled with Flightdeck keeps them in Flightdeck. See entity memory. |
agentworks:ask-caller:1.0.0 (ask_caller) | Always. The run asks its caller a question and waits for the answer; see ask the caller a question. |
The runtime lists each DVARA Gateway MCP server's tools at startup and pins each tool's schema hash, so a schema that
changes on the gateway is refused until the pack is updated. A server that is not reachable yet is retried in the
background, and new runs get its tools once a listing succeeds. A tool whose input schema the runtime refuses is left
out with a warning that names it, such as TOOL_INPUT_SCHEMA_INVALID.
When the DVARA MCP Gateway refuses a call, the run keeps the gateway's code: MCP_DENIED for a 403 and
MCP_UNAUTHORIZED for a 401. When the DVARA A2A Gateway refuses a call_agent hop, the tool's failure keeps the
gateway's own code, such as A2A_TOKEN_EXCHANGE_DENIED.
Built-in tools are offered like any other tool: through a capability pack that the agent declares, with an effect,
and a permission that allows it. For example, ask_caller in a runtime file:
capabilityPacks:
- id: ask
version: 1.0.0
tools:
- tool: agentworks:ask-caller:1.0.0
effect: {resource: caller, action: ask, risk: low}
permissions:
- {tool: agentworks:ask-caller:1.0.0, environment: production, resource: caller, action: ask, maximumRisk: low}
How do skills work in a runtime file?
A runtime file can hold skills, and an agent served from it declares them by id in spec.skills. Each skill is a
folder next to the file with a SKILL.md and the files it refers to: at most 128 files of at most 1 MiB each, 2 MiB in
all, and no symbolic link.
skills:
- id: kyc-checklist
path: skills/kyc-checklist
digest: sha256:<folder-digest>
license: Apache-2.0
loading: CONTEXT_TRIGGERED # ON_DEMAND (default), ALWAYS or CONTEXT_TRIGGERED
triggers: [kyc] # at least one with CONTEXT_TRIGGERED
The file names each folder's content digest, so a skill is exactly the files its author reviewed. A folder whose content differs is a problem in the file, and the problem names the digest it found:
/skills/0/digest: the folder's content digest is sha256:9d1e…
Run agentworks validate after you write or change a skill, and put the digest it names in the file. The release pins
every declared skill with its digest, path, loading policy, and license, as a release that Flightdeck sends does, so
the same files make the same release on any machine. In 1.16.0 a run does not load skill content into its context
yet, on either kind of runtime: the release records which skills the agent was built with.
What happens when a model sends invalid tool arguments?
When a model proposes arguments that do not match a tool's input schema, the runtime records the call as failed,
invokes nothing, and gives the model one correction round with only schema-derived pointers and rules. That single
round is shared by every tool in the execution segment. A second invalid call ends the run with TOOL_INPUT_INVALID,
so an unreliable model cannot loop. The correction never relaxes a permission, a credential, or maxToolCalls.
What should you check before you serve an agent?
- Run
agentworks validateon the runtime file; see the CLI reference. - Confirm every model role resolves, and health shows no
leftOutdeployment. - Give every tool a real effect and the narrowest permission that allows it.
- Keep secrets out of the AgentSpec: name them with credential references, such as
env://dvara-gateway. See security. - Set limits below what the business process can tolerate.