invariance_node_write
Append a node to an Invariance run to record tool calls, LLM calls, logs, context attachments, or handoffs as they happen.
Instructions
Append a single node (one unit of work) to an open Invariance run. Use this to record tool calls, LLM calls, logs, context attachments, or handoffs as they happen.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| type | No | Declared custom node type registered via invariance_node_type_register / defineNodeType. Narrows the shape of custom_fields and is selectable by monitors via on.node({type}). | |
| error | No | Error payload as a JSON-encoded string. Example: {"type":"TimeoutError","message":"upstream took >30s"} | |
| input | No | Node input payload as a JSON-encoded string (any JSON value: object, array, string, number). | |
| output | No | Node output payload as a JSON-encoded string (any JSON value). | |
| run_id | Yes | ||
| metadata | No | Free-form metadata as a JSON object string. Example: {"model":"claude-opus-4-7","temperature":0.2} | |
| action_type | Yes | Free-form verb describing what happened. Conventional values used by the SDK helpers: "tool_call" (a tool/function invocation; pair with type:"tool_call" and custom_fields.tool_name/status), "llm_call" (a model inference call), "log" (human-legible breadcrumb; input.message holds the text), "context" (structured state attached to the run, e.g. user_id), "handoff" (delegation to another agent; set handoff_from/to/reason). Custom verbs are allowed; monitors can select on this field. | |
| custom_fields | No | Typed custom fields as a JSON object string. For type="tool_call": {"tool_name":"search","status":"success","tool_input":{...},"tool_output":{...},"latency_ms":120} |