contenox
Browse docs/

The chain format

This is a reference for a file you mostly do not write. An agent is a Markdown declaration; contenox generates the chain behind it and keeps it in step with the file you edited.

You come here for two reasons. To read one — the chain is the audit artifact, the single place that says which model runs, which tools are on the table, and where the run can go next. And to write one, when a declaration cannot say what you need it to: a branch, a different model per step, a recovery path, a declared point where a human stands. Then the engine runs exactly what you wrote.

Task Chain Execution Flow

Chain structure

{
  "id": "my-chain",
  "description": "What this chain does",
  "tasks": [ /* TaskDefinition[] */ ],
  "token_limit": 8192,
  "debug": false
}
FieldTypeDescription
idstringUnique identifier
descriptionstringHuman-readable description
tasksTaskDefinition[]Ordered list of task definitions
token_limitintContext budget for the chat history, and the source of the per-call tool-result cap. Set it. See below.
debugboolEnable verbose task-level logging

token_limit also sizes tool results. The largest result a tool may return is derived from what is left of this budget after the chat history. Omitting the field does not mean “no limit” — it leaves the budget at zero, so every tool call comes back as tool_result_too_large no matter how small the real result is. A chain whose tools all report that error is missing its token_limit.

Task structure

{
  "id": "step_name",
  "description": "What this task does",
  "handler": "chat_completion",
  "system_instruction": "...",
  "execute_config": { },
  "transition": { "branches": [ ] },
  "retry_on_failure": 0,
  "timeout": "30s"
}
FieldTypeDescription
idstringUnique identifier for this task
descriptionstringHuman-readable summary of what the task does
handlerstringHandler type — see Handlers
system_instructionstringSystem prompt (supports template macros)
execute_configobjectModel, provider, tools, and execution policy settings
transitionobjectBranching rules — see Transitions
retry_on_failureintNumber of times to retry if the task errors (default: 0)
timeoutstringPer-task timeout, e.g. "30s" or "2m"

See Handlers and Transitions for the full field reference.

Sections

Esc to close