Model API docs
Packs
X-Workload selects one pack on the first call of a session. The pack reads only its own message shape. A generic status object does not count on coding, query, forecast, cohort, strategy, or registry. A turn that does not match the pack leaves the graph unchanged.
generic
Use generic for a recurring job or a long-lived entity when you can report the outcome yourself. The tool result has to follow the assistant tool call that named the tool. A user message on its own writes no edge.
A good fit is a daily or recurring job such as an export, report, or sync, a per-customer or per-ticket agent, or any long-lived workflow that can emit a simple success or failure signal.
The API remembers a case as the tool name plus its main argument, such as a path or an id. The first outcome for that case writes an edge. A later call of the same case with the opposite outcome can remove that edge and ask the model for one revision. A different argument is a different case.
A signal: line is one whole line. The class is success, failure, progress, or no_change. The last matching line wins. The line can be the tool content, or a line inside an output string:
signal: success
A tool result that is one JSON object can report the same outcome with a top-level field:
| Field | Value | Outcome |
|---|---|---|
outcome | success, failure, progress, no_change | that value |
status | success | success |
status | error or failure | failure |
ok | JSON true or false | success or failure |
is_error | JSON true | failure |
failure wins when the line and the fields disagree. When neither is a failure, the signal: line wins, then outcome, then status, then ok.
These write no edge: a nested status, the prose status: success, is_error set to false, the string "true", and any other value. A tool exit code is not an outcome.
The session page shows the edge as causes_success, causes_failure, causes_progress, or failed_to_progress.
This follow-up writes causes_success for check_export on workflow-1.
client.chat.completions.create(
model="glm-5.3-flash:causal-reflection",
messages=[
{"role": "user", "content": "Check whether the daily export finished."},
{
"role": "assistant",
"tool_calls": [
{
"id": "call_1",
"type": "function",
"function": {
"name": "check_export",
"arguments": "{\"day\": \"2026-11-06\"}",
},
}
],
},
{
"role": "tool",
"tool_call_id": "call_1",
"content": "{\"status\": \"success\"}",
},
],
extra_headers={
"X-Session-Id": "workflow-1",
"X-Workload": "generic",
},
)
{"ok": false} and {"is_error": true} write causes_failure. {"outcome": "progress"} writes causes_progress. {"output": "signal: failure", "status": "success"} writes causes_failure because failure wins.
medical
Use medical for one case, chart, or patient when a later question needs a fact already taken from that record. Send X-Workload: medical on the first call. The header is required. Tool names do not select this pack.
A good fit is a multi-step medical billing workflow: extract a fact, then use it on a later question about the same record.
The outcome classes are the same as generic. The tool result carries outcome. On success, the API stores the tool call's answer under its full summary. progress, failure, and no_change write the class edge and leave a stored fact in place. The harness decides which class to send. A later turn reprints the stored facts after the class lines, including when that question uses a different summary.
Keep one session per case. A shared session mixes records.
coding
Use coding for one coding task, and keep that task on its own session id. Send X-Workload: coding on the first call.
A good fit is fixing a failing test, applying a patch, or iterating on a code change until the suite passes.
The pack reads the command output. A bash fence, a <bash> block, and a bash tool call are the same shape: the assistant sends the command, and the next user message or tool result is the output. read_file, apply_patch, edit_file, and run_tests are read from the tool call.
A test summary writes causes_pass or causes_regress. Failure wins when a pass line is also present.
19 passed in 0.42s
Tests 6 failed | 1 passed (7)
ok github.com/example/pkg 0.45s
FAIL github.com/example/pkg
--- FAIL: TestName
Ran 12 tests in 0.8s
OK
FAILED (failures=1)
A Django result needs both Ran N tests in Xs and OK. A bare OK is not a result. System check identified no issues is not a result. Ordinary text that says "passed", and All checks passed!, do not write an edge.
A pipe, a trailing &, or tail / head / grep hides the exit code. The footer still counts. A command with no footer stays an open prediction until a later observation shows one.
A file edit that succeeds writes fixes. The same command with the same output writes failed_to_progress.
The case is the test command with its target. python runtests.py auth_tests and python -m django test auth_tests are different cases. Flags and a trailing pipe do not make a new case. A scratch file created in this session is not a suite: python runtests.py check_tmp after check_tmp.py was created writes no suite edge.
coding does not read a generic status object or a signal: line.
tool-use
Use tool-use when the agent calls tools and a normal tool result means the call worked. Send X-Workload: tool-use on the first call. If you omit the header and the agent sends tools that are not the coding set, the first call is stored as tool-use.
A good fit is an agent that calls APIs or tools, such as search, booking, or a CRM update.
The tool result follows the assistant tool call, the same way as generic. The case is the tool name plus its main argument.
A result that starts with Error:, or that contains error: or a traceback, writes causes_failure. A non-empty result that does not look like an error writes causes_success. An empty result writes no edge.
These write tools are a state change. A successful result writes fixes:
book_reservation, cancel_reservation, update_reservation_baggages, update_reservation_flights, update_reservation_passengers, send_certificate.
A signal: line is read first, and its class has to be one of tool_success, tool_error, state_change, or no_change. The words success and failure are the generic classes. They do not count here.
tool-use does not read outcome, status, ok, or is_error. A JSON object such as {"status": "failure"} can be recorded as success. Send generic when the outcome is those fields.
A completion that calls transfer_to_human_agents can be revised when the readout predicted a state change. That revision stays off unless TOOL_USE_PLAN_CONTINUATION is set.
query
Use query when the agent inspects a database and the next user message is the result. Send X-Workload: query on the first call.
A good fit is a database or SQL agent that inspects the schema and then answers, including when the schema can change.
The assistant message is JSON, either raw or inside a fence:
{"action": "QUERY", "content": ".schema orders"}
The next user message is the result. The pack pairs that result with the QUERY above it. A later question in the same user message, after a blank line and NOTICE: or Question N/M, is not part of the result.
An inspect writes causes_success. Inspect is .tables, .schema, PRAGMA, or SQL that mentions sqlite_master. The edge remembers the names that came back, such as tables orders customers or schema orders id status.
A result whose first line is ERROR: or timeout writes causes_failure. no such table and no such column name the missing object.
{"action": "ANSWER", ...} writes no edge. A result table from an ordinary SELECT writes no edge.
A user message that says the schema may have changed drops the schema edges. These two sentences are that notice: schema may have changed, and schema or contents may have changed.
forecast
Use forecast when a fit is saved and a later message reports the closed-year score. Send X-Workload: forecast on the first call.
A good fit is a training or backtesting loop that fits a procedure and later receives a scored result for a closed period.
The assistant message remembers the procedure. That can be a shell command that runs a .py, .r, or .R script, a redirect that writes one of those scripts, or --model some-name. A JSON object with a command string is read the same way. A JSON object whose body is a predictions list does not change the remembered procedure.
A later user message reports the score. Either line works:
Predictions recorded for year 2024. Composite score: 0.42
{"feedback_year": 2024, "entries": [{"error": 0.1}], "composite_score": 0.42}
The first score for that procedure writes a defines edge. A later higher score replaces it with causes_progress. A later lower score replaces it with causes_regress. The same score writes nothing. The score is kept with the procedure, so the user message has to come after the command that named it. Other JSON in the message is not a score.
cohort
Use cohort when a study tool prints columns, a survival table, or a failed probe. Send X-Workload: cohort on the first call. The pack reads the latest user message.
A good fit is a clinical or research study agent that probes columns, survival rates, or schema and needs to remember what it found.
A column block writes a defines edge per column. The block starts at === Columns === and ends at the next === heading. A column line looks like status: (active, paused). A categorical line looks like arm (categorical, 2 levels): treat, control. The current study name is prefixed on those facts.
A survival line writes a defines edge. It contains S(12m)=, S(24m)=, and S(36m)= on the same line. The group name is the token before those rates.
A failed probe writes causes_failure. The message starts with ERROR: or SQL ERROR:. The edge is named from no such column: age, no such table: visits, or Got: age.
Report submitted for cardio. drops the schema edges for that study. A line that starts with NOTICE:, or a sentence that says the schema may have changed, drops the schema edges for the study that was current. ## Study 2/5: oncology makes oncology the current study. The same other text twice writes failed_to_progress.
strategy
Use strategy when each decision prompt names the opponent and the hand result includes a chip line. Send X-Workload: strategy on the first call. The pack reads the latest user message.
A good fit is any agent or simulation that plays out many rounds against named counterparts, each round naming the other party and reporting a signed numeric outcome, so you can track running totals per name—for example poker, trading rounds, competitive games, or negotiation sims.
The opponent is a line by itself:
Opponent: Vikram
The chip line is:
Net chip change this hand: +120 chips
The first total for that opponent writes a defines edge. A later total that goes up replaces it with causes_progress. A later total that goes down replaces it with causes_regress. The edge is the running total for that opponent, not the single hand. A street with no chip line writes nothing. Invalid poker action writes nothing.
A new seat is:
NOTICE: You are now playing against Elena.
Chips before this separator stay with the previous opponent. Chips after it are booked to the new opponent:
Additional auto-resolved hand while advancing to the next prompt:
A human approval adds an edge when that decision comes back as a user message with the opponent and a chip line.
registry
Use registry when a scan prints a peak block and the same center should be remembered. Send X-Workload: registry on the first call. The pack reads the latest user message.
A good fit is a signal or spectrum scanning agent that should remember peaks or centers it has already seen.
The block starts at Detected peaks: and ends at Band:. Each peak is freq: 433.0 MHz. The center is rounded to the nearest 0.5 MHz.
The first time a center is seen, it is remembered and no edge is written. The next time that center is seen, or a later peak within 4 MHz of it, a defines edge is written and replaced as the hit count grows. A scan with no Detected peaks: line leaves the remembered centers in place.