chain-rdeveloper portal
build

Skills & Workers — Typed Graphs (schema v3)

How a skill graph is defined, what a worker's typed interface means, how nodes pass data to each other, and how conditional edges route without an LLM in the loop.

A worker is the atomic reasoning unit: a system prompt, a model, an optional toolset, and — since schema v3 — a typed interface. A skill is a directed acyclic graph (DAG) of nodes; each node is a worker invocation, a deterministic tool call, or a pure state transform. Skills run inside the standard agent pipeline described in Agent Graph (triage → planning → retrieval → skill graph → synthesis → evaluator).

Worker interfaces

A worker may declare an input_schema and an output_schema. Both are lists of FieldSpecs:

{"name": "risk_level", "type": "enum", "values": ["low", "medium", "high"],
 "description": "Overall risk", "required": true, "default": null}
FieldMeaning
valuesenum only — the closed set of allowed values
itemsarray only — scalar element type
required / defaultoptional inputs fall back to default; missing required inputs are reported in the trace
  • Inputs are the values a graph node binds into the worker. They are validated and coerced ("0.8" → 0.8, "High" → "high") and presented to the model as a JSON block; unknown extra keys pass through.

  • Outputs — when non-empty — turn the worker into a structured worker, filled like any system step (structured_call, decoded natively where the route can; since 20 October 2026):

    • Without tools the node makes one structured call (purpose <worker>.output) and is held to the schema; there is no free-text pass to parse.

    • With tools the model is given an OUTPUT CONTRACT and works through its tool loop. Its final message is read whole, or as the one fenced block it is — an object inside prose is not the answer. Anything else gets one native repair call (<worker>.output_repair).

    • An object field travels to the model as JSON text and comes back to the graph as the object, so every output schema can be decoded natively; a field named reasoning, rationale, thinking or trace is renamed on the wire and read back under its own name.

    • As a last resort the node returns the schema defaults plus _raw / _error, so the graph keeps flowing and the problem is visible.

Interfaces live on the definition (custom_workers.input_schema / output_schema in svc-core, mirrored to svc-ai's worker_agent_definitions) and can be overridden per node in a graph (input_schema / output_schema on the node). The built-in request_classifier worker is a reference example of a structured worker.

Running a skill from chat

/execute skill <skill> [request] in an agent's chat runs that skill. It runs whether or not the agent holds the skill and whether or not the chat's skill graph is on, answers as the agent, and is governed with the skill in the scope chain. Typing / opens a palette of the skills the workspace offers. A chosen skill shows its Run form above the message box: the same run schema, checked the same way, with the send held until every required field is filled. The text after the command is additional instructions, or the whole request for a skill with no fields. See chat-commands.md.

A pinned skill (a chat command or a standalone run, which runs every step in order) whose steps hold a web tool gets no __external_retrieval__: its own steps do that work (graph._pinned_skill_route; 28 October 2026). Research brief had searched the web before it ran and then again in its research step. Knowledge is still pre-retrieved, and an unpinned graph keeps the web retrieved for it.

A graph with a render_document tool step keeps that tool to the step (AgentFactory.from_graph_definition, WorkerAgent.withheld_tools): its agent steps are not offered it, from their own tools or a plan's guidance, and are told a later step makes the document (prompts.DOCUMENT_STEP_NOTE). Research brief had rendered four documents in one run. Such a step is shown the rendering hint without render_document (RENDERING_HINT_WITHOUT_DOCUMENT): shown it whole, the writing step called the tool it no longer held three times, ToolNode answered "not a valid tool", and the quality check read that as the document failing and sent the whole skill round twice more (run 5, 214 s). Such a reply now reads "Not run: this step does not hold …" to the check and the reviser (source_ledger.not_held).

Which model a node runs on

A worker definition is a role, a prompt and its sampling (temperature, max tokens). It names no model: a vendor model named in code is one some backend cannot serve. A node's model is, first match wins:

  1. The chat's model override, when the person picks a model for the turn (SkillSpec.system_model_override): every node, system nodes included.

  2. The node's pin (config_overrides.provider + model), checked against the catalogue when the skill is saved. The catalogue changes under a pin, so svc-core checks it again when the skill runs (skill_graph.resolve_for_execution): a pin to a model this deployment cannot run is dropped, with a status line in the chat ("Step 'check' is set to gpt-4o, which is not available here; it runs on the agent's model"). The stored skill keeps its pin.

  3. The agent's model, when the skill runs as an agent's chat turn (SkillSpec.default_model, from agent_transformers.skill_default_model). The system nodes (triage, evaluator) run on it too, as they do for a plain agent. An agent assigned a model the deployment cannot run falls back to the default model first, and the chat says so (agent_transformers.model_substitution).

  4. The deployment's default model (svc-ai llm.deployment_default_model: the catalogue's default chat model, which the seeder keeps runnable), for a standalone run with no agent.

Until October 2026 the built-in definitions named GPT-4o and GPT-4o mini and svc-core sent the agent's model only with a chat override, so on Bedrock every agent with its skill graph on failed while the graph was being built ("No model call" on the trace). That refusal was also raised before the stream's error handling, so the chat showed an empty answer; it is now one error frame with its message and code, shown in the chat. Pinned by svc-ai tests/agents/test_node_models.py and svc-core tests/test_agent_skill_model.py.

The variable namespace

Every template, binding and condition in a skill resolves against one namespace:

VariableContents
<skill input>values from the skill's interface.inputs, seeded from the caller
<state key>declared state variables and every node's output_key
<node_id>each completed node's result — a dict for structured workers, so node.field addresses one field
inputs.<field>inside a node: its own bound inputs

Paths are dotted and may index lists (fetch.items.0.title); a JSON string encountered mid-path is parsed once, so tool outputs are addressable without an explicit parse step.

Node types and bindings

"nodes": {
  "classify": {
    "type": "agent",
    "agent_name": "request_classifier",
    "inputs": {"request_text": "{input}", "channel": "{channel}"},
    "output_key": "classification"
  },
  "lookup": {
    "type": "tool",
    "tool": {"name": "web_search", "args": {"query": "{classify.summary} precedent"}},
    "output_key": "precedent"
  },
  "pack": {
    "type": "transform",
    "operation": {"op": "compose", "fields": {"cat": "{classify.category}", "src": "{precedent}"}},
    "output_key": "packed"
  }
}
  • A binding that is exactly one placeholder ("{classify.confidence}") keeps the value's type — numbers stay numbers, objects stay objects. Any other string is a text template.

  • Inputs not bound explicitly are auto-bound from a same-named variable, so a state key contract_text flows into a worker input contract_text with no configuration.

  • prompt_template replaces the default task and may use the same placeholders; bound inputs are still attached as <inputs>.

  • Transform ops: template, merge, select (keeps type), compose (builds an object — its fields become addressable), parse, literal. Tool and transform nodes never call an LLM.

  • A tool node's config may name knowledge (collection for query_knowledge_base, knowledge_id for query_knowledge_graph, checked on any tool). svc-ai searches whatever it names, so svc-core checks it twice (skill_graph.KNOWLEDGE_CONFIG_KEYS): on save, the author must be able to read it and the skill's workspace must have it (400 / 403 / 422, the rule a repository grant follows); on every run, the invocation's workspace must have it — where a standalone run was started, or the agent's own for a turn. One that fails at run time is dropped with a note and the tool runs without it, and one that passes is sent as the knowledge's id. A simulation's agent tools follow the same rule.

Conditional edges

A source node's outgoing edges are either all unconditional (fan-out) or governed by one of three routing forms:

"conditional_edges": {
  "classify": {
    "branches": [
      {"key": "urgent", "target": "escalate",
       "when": {"var": "classify.urgency", "op": "eq", "value": "high"}},
      {"key": "unsure", "target": "escalate",
       "when": {"all": [{"var": "classify.confidence", "op": "lt", "value": 0.5},
                        {"var": "classify.summary", "op": "not_empty"}]}}
    ],
    "default": "respond"
  }
}
FormHow the target is chosenLLM call
route_field + route_keys / edge_mapthe value of one field of the source's structured outputnone
legacy route_keys / edge_mapa Router worker picks one of the keys, as a structured choice of exactly those keys (purpose route)one

Predicates: eq ne gt gte lt lte in not_in contains not_contains starts_with ends_with matches (binary) and exists not_exists empty not_empty truthy falsy (unary), composed with all / any / not. Evaluation never raises — an unresolvable path is simply false and the default applies. Every target may be "end".

Skill interface

"interface": {
  "inputs":  [{"name": "channel", "type": "enum", "values": ["email", "chat", "api"], "required": false, "default": "chat"}],
  "outputs": [{"name": "category", "from": "classify.category"}, {"name": "response", "from": "final_response"}]
}
  • inputs seed the graph state from the caller (SkillSpec.inputs / POST /app/skills/{id}/runs body inputs), validated against the FieldSpecs.

  • outputs are projected from final state when the run ends and returned as skill_outputs (and streamed in the done frame) alongside the full skill_state.

  • A run asked for its answer as JSON (output_format="json", with an output_schema) is told so with its task, and its finished answer is held to the shape before the run's Output rules: as it stands when it fits, else rewritten by one structured call (purpose reply.format) on the skill's override or default model, else sent as it was with output_format_error. See Agent graph.

Templates: patterns to start from

A template is a graph pattern, not a skill. New Skill → From a Pattern copies its graph into a skill of the user's, which they then edit. It is never run or granted as it stands, so it is not listed on the Skills page, and the old …/skills/id/<base64 "s:<name>"> pages redirect to New Skill with that pattern selected (?template=<name>).

There are four, one per graph technique worth learning. Each declares an interface, so a skill started from one has a Run form:

TemplateTechnique
draft_review_revise — Draft, review, revisea structured verdict branches to a revise node or a no-model select transform, and both write final_response
fan_out_and_merge — Research in parallel, then mergefan-out from one node to three, fan-in to one
approval_gate — Draft, approve, finalisean approval gate before the final node

Something useful to run as it stands is a built-in skill (below), not a template. The generative agent and skillset setups used to copy templates into new user skills. They now offer the built-in skillsets and skills instead, flagged built_in in the catalogue, and grant or bundle them by reference. The previous nine templates (debugging, web / knowledge-base / graph / hybrid research, deep analysis, code review, iterative refinement) were removed: each duplicated a built-in or the pipeline's own retrieval, or, in iterative refinement's case, promised a loop a DAG cannot run. Skills already created from them are ordinary user skills and are unaffected.

Generating a skill

Generate on the Skills page, or in New Skill Generate from this pattern, designs one skill from a description. The optional inputs are a pattern to start from and Produce a downloadable document.

StepWhereWhat
Checksvc-ai generation.check, then svc-core _GraphDefinitionSchemasvc-ai checks structure (workers, tools, targets, cycles). svc-core applies the schema that guards a hand-built skill. A failure is sent back once with the problems (previous + feedback), and a second failure fails the request with them, recorded on the run. Nothing is repaired in code.
Documentsvc-ai generation.attach_documentDeterministic, not left to the model: the single agent end node gets REPORT_OUTPUT_SCHEMA (the DocumentSpec fields), and a render_document tool node is appended after it.
Reviewfe-core GenerateSkillModalName and description are editable. The design is shown as inputs, numbered steps (kind, approval pause, branches) and outputs, with the raw graph on request.
Createsvc-core POST /app/skills/create-from-config (skills/setup.py)Validated again (schema + validate_node_overrides), stamped with the GenerationRun (flow skill_setup, migration 74), versioned, and opened.

The flow is metered and ledgered like every generation flow (the generation path in llm_paths.py). A repair round is a second, separately priced call on the same run.

Built-in skills

Four skills in two built-in skillsets ship with the platform (Research & Reports, Decisions & Actions). They are ordinary skills, with system ownership: they are defined in app/services/system_resources/skillsets.py, validated by this same schema, restricted to svc-ai's built-in workers, and readable, runnable and grantable by every user but editable by none. Their prompts read {input} only, so they behave the same in chat and in a standalone run. See CHAINR Bot → Built-in skillsets.

Running a skill on its own

A skill is not only the body of an agent turn: run standalone, it is structured inference — typed inputs in, typed outputs out — for a repeatable workflow such as research_topic_and_generate_report. The skill page has a Run form and a list of the caller's runs; each run has its own page.

EndpointWhat it does
POST /app/skills/{id}/runsValidate inputs, record a running run, carry it out in the background (202). A bad input is a 422 {message, fields: {name: reason}}
GET /app/skills/{id}/runsThe caller's runs, newest first
GET /app/skills/{id}/runs/{run_id}One run in full — outputs, answer, per-node steps, rule trace, citations, final state

The run schema is derived from the graph (services/skill_runs/schema.py), so a form exists even when the author never declared interface.inputs:

  1. interface.inputs — the declared contract, authoritative;

  2. a worker input_schema field left unbound on its node that nothing in the graph produces — svc-ai auto-binds it by name from state, so it is an input whether or not anyone declared it;

  3. a declared state key with no default that no node writes and some node reads;

  4. a {placeholder} in a prompt_template naming none of the above.

Each field keeps its FieldSpec type (an object is a JSON editor, an enum a select), its source and the nodes that read it, so the form can say why it is asking. Run inputs seed state_vars whether declared or not. With no fields, a task text is required; otherwise the task is composed from the skill's name and description and the inputs are written into it (compose_task).

Runs are governed like agent turns (services/skill_runs/runner.py): Input rules evaluate the task text, which contains every input — a PII filter that fires also redacts the structured inputs; Output rules evaluate the answer plus the declared outputs, and a redaction that runs is applied to outputs, final state and every step too; the call is ledgered as execution_type="skill" against the skill and its owner; svc-ai's trace carries purpose="skill" and a {skill_id, skill_run_id} reference, which the Activity feed links back to the run. Runs record the skill version they ran under and belong to the user who started them. A run still running after ABANDONED_AFTER (a restart) is closed as failed when runs are read.

Cost. Every model call a run makes is metered in svc-ai and priced on the model that made it — per-node model pins and the pipeline's system nodes included — so a run's cost_usd, llm_calls and per-model cost_detail are measured, not estimated. A call to a model neither price table knows is counted in unpriced_calls, making the cost a lower bound ("≥" on screen). The skill page's cost card reads the ledger for the skill. See cost-monitoring.md.

Limits: a standalone run has no agent persona, knowledge or toolkits.

Human in the loop

The pause mechanics, question form, governance and trace records are shared with chat and described in Human in the Loop; this section covers what is specific to skill nodes and standalone runs.

A skill can stop mid-run for the person running it, in two ways, both set per node (graph builder → node → Human in the loop):

Node fieldWhat happensResume
ask_user: true (agent nodes)The node gets the ask_user tool and is told to ask before any other workThe person answers the questions (or skips them — the node is told they were skipped)

The gate sits at the very start of the node, and ask_user is asked first, because resuming replays the node from the top (LangGraph checkpoints between nodes, not inside them): nothing paid for before the pause repeats.

A paused run is awaiting_input with its interrupt (the kind, the questions or the work to approve, svc-ai's thread_id). The run page shows it; POST /app/skills/{id}/runs/{run_id}/respond answers it and …/cancel abandons it. Every answer is kept in responses. Each resume is a new segment: governed on its own (Input rules over the answer text, Output rules over what the pause shows and what comes back), ledgered on its own, and added to the run's totals. svc-ai resumes a batch run through ExecuteRequest.resume; the stream resume endpoint serves the chat.

Constraints, each enforced:

  • The paused state is an in-memory checkpoint in svc-ai. After a restart it is gone, and a resume is refused with that reason rather than silently starting an empty run.

  • A skill edited while a run is paused cannot be resumed on it (409): the checkpoint is of the old graph.

  • A pause nobody answers within 24 hours is cancelled, and svc-ai is told to drop the checkpoint (DELETE /agents/execute/threads/{thread_id}).

The same gates work in chat when an agent's body is the skill — the chat already renders approval and clarification interrupts.

Validation

svc-core validates every stored graph_definition (_GraphDefinitionSchema): node ids are identifiers, every edge / branch / default target exists, every variable referenced by a binding, tool argument, transform, condition or interface output resolves, no node references its own output, complete graphs are reachable, and — for graphs without conditional edges — every referenced node output comes from a strict ancestor. Invalid definitions are rejected with a 422 that names the node and variable.

Where to look

Concernsvc-aisvc-corefe-core
Conditions & routersapp/agents/conditions.py_Condition, _ConditionalEdgeConfigGraphBuilder.tsx (edge panel)
Bindings & transformsapp/agents/operations.py, skill node in app/agents/graph.py—GraphBuilder.tsx (node panel)
Graph constructionAgentFactory.from_graph_definition—serialiseGraph / hydrateFromDefinition
Skill run & outputsSkillEngine, project_skill_outputsservices/skill_runs/, /app/skills/{id}/runsskills/run/ (form, runs list, run page)
Pauses & resume_await_approval / RunRejected in agents/graph.py, ResumeSpec, GraphBasedEngine._resume_commandrunner.respond / cancel / _resumeskills/run/RunPausePanel.tsx, node panel in GraphBuilder.tsx
Costservices/metering.pyai_client.usage_capture, services/llm_paths.pycomponents/cost
Templates (patterns)BUILTIN_SKILL_TEMPLATES in app/skills/registry.py, GET /skills/available—NewSkill.tsx (From a Pattern)