Schemas
Describe the values Steps exchange under an Attribute name.
Attribute Schemas
A Schema associates an Attribute name with a JSON Schema 2020-12 document. For example, if several Steps use risk_score, you can define its range once in the catalog. Send this definition to POST /engine/schemas:
{
"name": "risk_score",
"description": "Fraud risk from 0 to 100",
"schema": {
"type": "integer",
"minimum": 0,
"maximum": 100
}
}
Use the exact Attribute name from the Step definition. The description is optional. Schema references must resolve within the same document.
What Argyll Checks
When you register or update a Step, the engine checks its constants and optional input defaults against the registered Schemas. With the definition above, a risk_score default of 80 passes and 101 fails. For collect: all and collect: some, the default must be an array and each element must satisfy the Schema.
The engine also checks the Argyll Expressions that use a typed Attribute. A Predicate, match, or input mapping selector must read the value the way its Schema describes it, so risk_score.level > 2 fails because risk_score holds an integer. A Script Step result must fit the Schema of each output it returns. Lua scripts run without these checks.
A Step that breaks a Schema fails with 400 Bad Request. The response is application/problem+json, and its errors list names each rejected value with a pointer into the Step definition:
{
"type": "urn:argyll:problem:invalid-request",
"title": "Invalid request",
"detail": "invalid step: risk_score default should be at most 100, got 101",
"errors": [
{
"detail": "risk_score default should be at most 100, got 101",
"pointer": "/attributes/risk_score/optional/default"
}
],
"status": 400
}
If you add or change the Schema after registering the Step, the engine checks the existing definition. A conflict returns 409 Conflict and identifies the Step.
The engine passes Flow inputs and ordinary Step outputs through without validating them against catalog Schemas. Agent Steps also use Schemas when generating results. For example, if an Agent returns 101 for a directly mapped risk_score output, the worker asks the model to correct it. The worker skips this check for outputs with a mapping selector.
Catalog Changes
A Flow’s plan captures the Schemas for the Attributes its Steps declare. Updating or removing a Schema affects future plans. Running Flows keep their original definitions.
| Request | Result |
|---|---|
GET /engine/schemas | List Schemas in Attribute name order |
GET /engine/schemas/{name} | Read one definition |
POST /engine/schemas | Register a definition |
PUT /engine/schemas/{name} | Replace an existing definition |
DELETE /engine/schemas/{name} | Remove the Schema for that Attribute |
curl "$ARGYLL_URL/engine/schemas/urn:acme:billing%2Fcount" \
-H "Authorization: Bearer $TOKEN"
Registering the same definition again succeeds. Use PUT to change it. MCP clients can look up definitions with list_schemas and get_schema.