🛠️Authoring Tools and Workflows
This page is for tool providers and agent developers building the pieces a skill runs. Answers are grounded in the documented contracts; command snippets are illustrative (they show what a command looks like, not a prescriptive procedure).
Building a tool
What kinds of tool can I build?
Two: an off-chain tool and an on-chain tool.
An off-chain tool is an HTTP service. The leader invokes it over the network. Use this for anything that reaches outside the chain — calling an API, running a model, doing arbitrary computation.
An on-chain tool is a Move module published on Sui. The leader invokes it by making a Move call. Use this when the step must read or mutate on-chain state atomically as part of the workflow.
Both are named by a fully qualified name (FQN) and registered on-chain before a DAG can call them.
What is an FQN?
A fully qualified name identifies a tool. It has three parts — domain, name, and version — written {domain}.{name}@{version}, for example:
com.example.add@1The registration process validates this structure. A DAG vertex names the tool it calls by FQN.
What HTTP endpoints must an off-chain tool expose?
Three, all under the tool's base URL:
GET /health → 200 only when the tool is ready to be invoked
GET /meta → returns the tool's definition JSON
POST /invoke → runs the tool: accepts input in the tool's input schema,
returns output in the tool's output schemaThe definition returned by /meta (and stored on-chain at registration) carries the FQN, the type (offchain or onchain), the URL, a description, and JSON Schema (draft 2020-12) definitions for the input and the output. The output schema's top-level oneOf enforces the exclusive output variants the DAG expects — every output is one tagged variant (for example ok or err), each with its own fields.
How does an on-chain tool's execute function have to look?
An on-chain tool is a Move module that provides a public, non-entry execute function. It receives owned UID requirements and a result object, does its work, builds a tagged output, and finalizes that output into the result — the function returns nothing. This is a signature sketch, not a complete registered implementation: a complete Tool also recomputes the registered canonical input commitment from its concrete arguments and state IDs before any effect. A minimal shape, matching the LTS scaffold:
The omitted assert_workflow_invocation helper comes from the on-chain Tool guide. It imports nexus_workflow::execution::DAGExecution and checks the canonical worksheet type, worksheet/result execution-ID binding, and unfinalized result before any application effect.
Four requirements make it valid:
Authenticate the invocation. The Tool checks the workflow-created worksheet and durable result before it changes application state.
Satisfy requirements. The tool satisfies
UIDRequirementswith its registered witness before finalizing the result.Build a
TaggedOutput. Construct the result withtagged_output::new(tag)and attachNexusValuepayloads withwith_named_payload. Usedata::inline_data_valuewith canonical JSON bytes: numbers are unquoted and strings or addresses are quoted. The tag names the output variant (ok,err, or a custom one such astimeout).Finalize, don't return. Call
onchain_tool_result::finalize_and_share(result, requirements, output, ctx)— this consumes the result object and shares it so the leader can pick it up. The function must not return a value.
A custody-touching on-chain tool (one that spends or moves an agent's or user's assets) additionally needs an on-chain authorization grant tying the call to the right agent and vertex — that mechanism is explained on the authorization page.
How do I register a tool?
Registration puts the tool's definition on-chain so DAGs can reference it. The CLI drives it, dispatching by tool type:
nexus tool validate onchain --ident <fqn> validates a registered on-chain Tool's live execute and Output schemas against its stored MetaSchema, and checks whether its Standard or WorkflowAuthorization mode matches the live signature. It returns the Tool state (or {valid:true,fqn,tool} with --json). It does not prove lineage, UpgradeCap custody, dependency linkage, witness ownership, or business invariants; use the on-chain Tool candidate-verification checklist for those separate checks.
You can scaffold a new tool from a template (nexus tool new), inspect a Tool by its known FQN (nexus tool inspect --tool-fqn <FQN>), set a per-invocation cost (nexus tool set-invocation-cost), unregister (nexus tool unregister), and later claim back the collateral a registration locks (nexus tool claim-collateral --tool-fqn <FQN> --owner-cap <OVER_TOOL_CAP_ID>). Registering a Tool locks Talus US from Coin<US>; owner collateral claims wait until that Tool's unregistered_at_ms plus its registration or re-registration lock_duration_ms snapshot, while an authorized admin slash is immediate and retires an active Tool when remaining collateral falls below the configured registry requirement. SUI is separate transaction gas and execution-payment funding; the verification page covers why collateral exists.
Building a workflow
What is a DAG, and how do I get from a DAG to a runnable skill?
A DAG is the graph of tool-call steps a skill runs: vertices are tool calls (each naming a tool FQN and being on-chain or off-chain), edges carry one vertex's output port into another vertex's input port, and entry ports are the inputs you supply to start a run. You author the DAG as a JSON file, validate and publish it, then bind it to an agent's skill:
The default-DAG schedule requires an operator-provisioned default Agent and executor. If the preflight reports AgentRegistry missing default agent or EDefaultDagExecutorMissing, stop and hand the deployment to its operator; do not infer that missing dispatch is a permanent rejection or bootstrap the shared executor from this FAQ.
For package-backed agents, the nexus tap flow scaffolds a user-created package and a DAG-backed skill config, publishes them together, and registers the skill on an agent:
Once a skill is bound to a published DAG, scheduling an occurrence dispatches an Execution that walks the DAG. Observe it with nexus task occurrence inspect and nexus execution inspect.
What edge kinds can a DAG use?
Edges carry data between vertices, and their kind controls loop and fan-out behavior. There are six:
Normal — a plain edge: one vertex's output feeds the next vertex's input.
ForEach — fans out over each element of a multi-valued output, running the downstream vertex once per element.
Collect — the inverse of ForEach: gathers multiple same-typed values back into a single multi-valued input.
DoWhile — creates a pseudo-loop in the DAG, letting a section repeat.
Break — exits a DoWhile loop.
Static — feeds a value from outside a loop into a looped vertex (for example, a constant that every iteration reads).
What happens when a step fails?
An ordinary selected output variant with no matching outgoing edge is a successful terminal end state and emits EndStateReachedEvent. _err_eval, or terminal failure evidence with no routed continuation, follows the configured post-failure action. There are two actions, settable DAG-wide and overridable per vertex:
Terminate — stop the whole execution; the remaining work is useless without this step.
TransientContinue — keep executing the other walks, which may still complete independently.
A vertex can also legitimately produce an error variant (an output tagged err) instead of aborting — that is a normal, typed output that flows down an edge to the next vertex, distinct from a resolution failure. Design tools to return an err variant when the downstream graph should react to the error, and reserve aborting for truly unrecoverable states.
Where do I go next?
Concepts — the agent / skill / tool / workflow / task vocabulary these steps assume.
Authorization — the on-chain grant a custody-touching tool needs, and signed HTTP for off-chain tools.
Payments — how each step's cost is budgeted and settled.
Build guides — an off-chain tool, an on-chain tool, an agent package, and registering a skill package.
Reference — the
dagandgraphMove pages for exact edge and vertex types, thetagged_outputpage for the on-chain output shape, and thetoolanddagCLI pages for command flags.
Last updated

