> ## Documentation Index
> Fetch the complete documentation index at: https://docs.threetone.in/llms.txt
> Use this file to discover all available pages before exploring further.

# Structured procedures

> Prepare typed procedure steps, resolve resource references, and review compiler validation without assuming deterministic execution.

A structured procedure stores a JSON description of steps. In the API, its procedure `type` is `deterministic`. That name identifies the authoring format; it is not a guarantee of deterministic conversation execution.

<Note>
  Compilation validates the structured content and returns a workflow preview containing the procedure instructions. It does not turn each step into a separately enforced workflow node, execute tools, or save the returned graph.
</Note>

## Define the steps

The procedure's `content` field is a **string containing JSON**, not a nested request object. The JSON inside that string must be an object with a `steps` array. For example, the inner content can be:

```json theme={null}
{
  "steps": [
    { "type": "ask", "instruction": "Ask which product needs support." },
    { "type": "tell", "instruction": "Explain what information is needed." },
    { "type": "say", "message": "Please do not share passwords." }
  ]
}
```

Serialize this object into the request's `content` string. The compiler checks these step types and required fields:

| Step type | Required field |
| - | - |
| `ask`, `tell` | `instruction` |
| `say` | `message` |
| `tool_call` | `tool_id` |
| `sub_procedure` | `procedure_id` |
| `system_tool` | `system_tool_name` |
| `branch` | `branches`, which must be an array |

The presence of a required field is not proof that its referenced resource is usable or that a branch condition is complete. Do not invent an execution format for nested branch entries from this table alone.

## Save and review

<Steps>
  <Step title="Choose real resources">
    Prepare an existing agent and editable branch. Resolve any tool or procedure identifiers against resources you can access. Start with steps that collect or explain information before adding external actions.
  </Step>

  <Step title="Create the procedure">
    Use [Create procedure](/api-reference/agents-platform/create-procedure) with `type: "deterministic"`, `name`, a clear `trigger`, and the serialized `content`. Read its branch draft back before further edits.
  </Step>

  <Step title="Compile and correct errors">
    Call [Compile procedures](/api-reference/agents-platform/compile-procedures). Errors identify the procedure and a content path, such as `steps.0.instruction`. Check JSON syntax, recognized step types, and required fields first.
  </Step>

  <Step title="Inspect the preview">
    Review the generated additional prompt, trigger edges, and tool references. The compiler collects `tool_id` values into additional tool references. Saving the graph to an [agent draft](/agents-platform/deploy/versioning) is a separate action.
  </Step>
</Steps>

## Frequently asked questions

<AccordionGroup>
  <Accordion title="Why does content fail JSON validation?" id="faq-structured-json">
    Parse the inner content separately. It must be a JSON object with a steps array, then serialized as a string in the procedure request. An array alone is not accepted as the content object.
  </Accordion>

  <Accordion title="Does successful compilation prove every step can run?" id="faq-structured-execution">
    No. It proves the compiler accepted the authored structure. Resource access, runtime behavior, and successful external actions require separate verification.
  </Accordion>
</AccordionGroup>


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.