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

# How a tool gets its arguments

> Tool bindings, the input sources, and one complete workflow document that uses them.

A saved tool declares what it needs — an `input_schema` with named fields. A
workflow says **where each of those fields comes from** on this particular
agent. That wiring is a *binding*, and it is the piece of the document most
people have to reverse-engineer from the schema. This page is the prose for it.

```json theme={null}
{
  "bindings": [
    {
      "id": "book-visit",
      "tool_revision_id": "6f1b2c3d-4e5f-4a7b-8c9d-0e1f2a3b4c5d",
      "inputs": {
        "patient_name": { "kind": "model", "path": "/patient_name" },
        "clinic_id":    { "kind": "stored", "path": "/clinic_id" },
        "channel":      { "kind": "literal", "value": "phone" }
      }
    }
  ]
}
```

A binding is named by `id` and used by that name: a conversation step lists it
in `available_binding_ids`, an action step names it in `binding_id`, and a
before-call or follow-up step names it the same way. `inputs` maps **a field of
the tool's own `input_schema`** to one source. A field the tool does not
declare is `unknown_input`; a *required* field with no source and no schema
default is `missing_input_source` — the 422 most first integrations hit.

> [!NOTE]
>
> Call logs and legacy flow-agent payloads label a value the model produced
> `ai_extract`. That is a runtime label, not something you can author: in a
> workflow document the same idea is written `{"kind": "model", "path": "/field"}`.

## The sources

| `kind` | Shape | Where the value comes from |
| - | - | - |
| `model` | `{"kind":"model","path":"/patient_name"}` | The agent collects it in conversation and fills it when it calls the tool. |
| `literal` | `{"kind":"literal","value":"phone"}` | A fixed value written into the document. |
| `request` | `{"kind":"request","path":"/language"}` | The call-creation request — the `variables` you send to `POST /calls`, declared by the document's `request_schema`. |
| `stored` | `{"kind":"stored","path":"/clinic_id"}` | Context the platform holds for the call, declared by the document's `stored_schema`. |
| `sequence` | `{"kind":"sequence","path":"/booking_id"}` | The input of the sequence this step belongs to. Only inside a sequence. |
| `step` | `{"kind":"step","scope":"local","step_id":"log","path":"/reference"}` | The output of another step. |
| `artifact` | `{"kind":"artifact","artifact":"transcript","path":"/text"}` | Something the finished call produced. Follow-ups only. |
| `extract` | `{"kind":"extract","instruction":"the time slot the caller agreed to"}` | A value read from the finished call by description. Follow-ups only. See [Reading a value by description](#reading-a-value-by-description). |

`path` is a JSON Pointer into whatever that source resolves to, and it is
checked at publish: a path the source's schema does not declare is
`unknown_source_path`. A number in the path addresses a position in a list
(`/slots/0/time`), also when the tool marks the list optional; the refusal for
anything else there names the list and a position to try. Every source except
`model` and `literal` also takes an explicit `fallback`:

```json theme={null}
{ "kind": "request", "path": "/language", "fallback": { "value": "he" } }
```

Nothing is ever invented at run time. Without a fallback, a value that is not
there is simply absent, and if the tool required it the call is refused rather
than sent a guess.

### `model` — the one the schema hides

`{"kind":"model","path":"/patient_name"}` says: *this argument is the agent's
to collect.* The compiler gathers every model source on a binding, builds one
function schema from exactly those fields, and hands it to the live model; the
rest of the tool's arguments are filled from the document and never shown to
it.

Three rules follow from that, and each has its own refusal:

* **`path` names one top-level argument** — `/patient_name`, never
  `/patient/name`. The *value* can be as nested as the tool's schema says;
  the argument name cannot. Otherwise: `model_field_path`.
* **Names are unique within a binding** — two model sources cannot claim the
  same argument name. Otherwise: `model_argument_collision`.
* **Only the conversation can use it.** A model source in a before-call step,
  in a follow-up, or inside a sequence child is `model_input_unavailable`:
  before the call there is no conversation yet, after it there is no one left
  to ask, and a sequence's arguments are collected once, as the sequence's own
  `input_schema`, when the model invokes it.

### `request` and `stored`

Both read a schema the document declares, so both are only as wide as you make
them. `request_schema` describes what a caller may send in `variables` on
[`POST /calls`](https://docs.goyappr.com/api-reference/calls/create); `stored_schema` describes the
context the platform keeps for the call. A path neither schema declares fails
at publish, not mid-call.

### `step` — reading another step's output

`scope` says which phase's step you mean:

| `scope` | Reads | Rule |
| - | - | - |
| `local` (default) | Another step in the same phase or sequence | Must be a declared `depends_on` ancestor or a route predecessor; a value produced on a conditional branch needs a `fallback`, or `branch_dependent_source`. |
| `before` | A before-call step's output | Usable during and after the call. A before-call step reads its siblings with `local`. |
| `during` | An action or sequence node's output | Not readable from a before-call step (`future_input`), and a step cannot read itself. |

### `artifact` — what the call produced

`transcript`, `analysis`, `recording`, `lead` and `billing` exist only once the
call is over, so an artifact source belongs to an After trigger; anywhere else
is `artifact_phase`. Reading one makes the step wait for it to be produced; name it in the
step's `requires` to wait without reading it. A step can only wait for what its event can
have, so an `artifact` input on a follow-up for a call nobody answered is refused: see
[what each event can have](https://docs.goyappr.com/api-reference/workflows/events.md#what-each-event-can-have).

`path` is an ordinary JSON pointer into that artifact's payload:

| `artifact` | Payload |
| - | - |
| `analysis` | `{"summary": …, "disposition_id": …, "extracted_data": {…}}` — the post-call pass writes all three at once. |
| `transcript` | The stored turns for the call. |
| `recording` | The stored recording for the call. |
| `lead` | The lead record this call was attributed to. |
| `billing` | What the call was billed. |

#### Reading what the agent extracted

**The values your agent was asked to pick out of the conversation are
`analysis` → `/extracted_data`.** Each field is at `/extracted_data/<the name
you gave it>`, and the whole set is at `/extracted_data`, so "post what we
collected to the CRM" is one source:

```json theme={null}
{
  "id": "notify-crm",
  "tool_revision_id": "TOOL_REVISION_ID",
  "inputs": {
    "preferred_day": { "kind": "artifact", "artifact": "analysis", "path": "/extracted_data/preferred_day" },
    "everything":    { "kind": "artifact", "artifact": "analysis", "path": "/extracted_data" }
  }
}
```

Every parameter the agent is set up to collect is a key on every call: one the
conversation never covered is stored as **`null`**, not left out. That matters
for the input you point at it. The pointer resolves, so a `fallback` on the
source never fires, and a tool input declared `"type": "string"` refuses that
call — whether or not the tool requires it. Give an input that reads a single
extracted field a type that accepts null:

```json theme={null}
{ "preferred_day": { "type": ["string", "null"] } }
```

…or send the whole `/extracted_data` object into one object input, where an
unanswered field is simply a null inside it. [Check](https://docs.goyappr.com/api-reference/workflows/validate.md)
refuses a name the agent does not collect (`extracted_field_unknown`) and a
kind the input's `type` cannot take (`extracted_field_type_mismatch`), so a
typo or a yes/no wired into a text input is caught before publishing, not on
the first call. And `extracted_data` is written by
the same pass that writes `summary`, so `requires: ["analysis"]` on the step is
what makes the follow-up wait for it.

### Reading a value by description

`{"kind":"extract"}` is for a value the finished call can *name* but nothing has
collected: "the time slot the caller agreed to" for a calendar event's start,
"how many people are coming", "whether they want a reminder". You write one
sentence; no extraction parameter has to exist on the agent first.

```json theme={null}
{
  "id": "calendar-event",
  "tool_revision_id": "TOOL_REVISION_ID",
  "inputs": {
    "title": { "kind": "literal", "value": "Visit" },
    "start": { "kind": "extract", "instruction": "the time slot the caller agreed to" },
    "end":   { "kind": "extract", "instruction": "the time it ends, only if the caller named an end time later than the start" }
  }
}
```

| Member | |
| - | - |
| `instruction` | Required. One sentence, up to 500 characters, in any language. |
| `type` | Optional. `text`, `number`, `yes_no`, `date` or `datetime`. Left out, it follows the tool's input: a string with `format: date-time` is `datetime`, `format: date` is `date`, an integer or number is `number`, a boolean is `yes_no`, any other string is `text`. A string input with an `enum` is answered with one of its values, or nothing. |
| `on_missing` | Optional. What happens when the call did not say it: `"skip"` skips the step (the default for a **required** input) or `"fail"` fails it. An optional input with neither is simply left out. |
| `fallback` | Optional. `{"value": …}` sent when the call did not say it. Not together with `on_missing`: that is `extract_missing_policy`. |

The same post-call analysis that writes the summary answers every description
in one model call, so there is no extra call and no extra service; the step
waits for the analysis, which usually finishes a few seconds after the call
ends. A `datetime` is a day plus a clock time in the **workspace's time zone**,
sent as an ISO time with that zone's offset on that date
(`2026-11-03T15:00:00+02:00`). The model never does the calendar arithmetic:
it names the day as the caller said it and the platform works it out from the
day of the call.

**Nothing is sent on a guess.** A value the call did not say is *missing*:

* a time said without morning or afternoon (“at five”, with nothing earlier or
  later in the conversation that settles it) is missing, not 5 PM;
* two candidate slots with none agreed is missing; with one agreed, it is that one;
* a day or time the call contradicts itself on is missing;
* an answer the tool's input would refuse is missing.

A missing value follows `fallback`, then `on_missing`. A skipped step is not a
failure: its follow-up is complete, the call shows the step as **Skipped** with
the reason, and a step that depends on it is skipped too. A failed or absent
analysis is different: the step is blocked (`artifact_unavailable`) whatever you
chose, because a booking lost to a broken analysis must be loud.

It is accepted only on a step that runs after the call (`extract_unavailable_phase`
anywhere else), on an input that takes text, a number, a yes/no, a day or a time
(`extract_type_unsupported` for a list, an object or an input that declares no
type, or a `type` the input cannot take), with a description that is not blank
(`extract_instruction_empty`). A document that uses it is published only to a
voice engine that reads it; until then Check refuses it with `extract_unavailable`
and says what to use instead. On a trigger for a call nobody spoke on
(`call.no_answer`, `call.failed`, `request.failed`) it is `artifact_never_produced`
like any step waiting for the analysis; under `any_end` it is allowed, and an
unanswered call skips the step.

Do not stage extracted values through `stored_schema`. Nothing writes saved
context, so a `stored` source is empty on every call, and
[Check](https://docs.goyappr.com/api-reference/workflows/validate.md) says so with
`stored_context_has_no_writer`.

## Tool inputs must declare an object root

Four schemas in this picture are **argument lists**, and an argument list is a
named set — so each must be an object at its root:

* a tool's `input_schema`,
* the document's `request_schema` and `stored_schema`,
* a sequence's `input_schema` and `output_schema`.

A schema that is missing `"type": "object"` at the top is refused with
`object_schema_required` and the message *"Tool inputs must declare an object
root."* The message says "tool inputs" whichever of the four it was, so when it
points at `/` rather than at a binding, check the **document's** two schemas
first — that is the usual cause, and an empty one has to be written as
`{"type": "object", "properties": {}}` rather than `{}`.

## A complete document

[`complete-workflow.json`](https://docs.goyappr.com/examples/complete-workflow.json) is one document
that uses all of it: a conversation node, an action node whose tool collects
two arguments from the model, a sequence with a child that reads the sequence's
input and another that reads its sibling's output, an End node, and an After
trigger that emails the transcript.

```json theme={null}
{
  "id": "wf-clinic-reception",
  "name": "Clinic reception",
  "channels": ["phone"],
  "request_schema": { "type": "object", "properties": { "language": { "type": "string" } }, "additionalProperties": false },
  "stored_schema":  { "type": "object", "properties": { "clinic_id": { "type": "string" } }, "additionalProperties": false },
  "bindings": [
    {
      "id": "book-visit",
      "tool_revision_id": "6f1b2c3d-4e5f-4a7b-8c9d-0e1f2a3b4c5d",
      "inputs": {
        "patient_name": { "kind": "model", "path": "/patient_name" },
        "starts_at":    { "kind": "model", "path": "/starts_at" },
        "clinic_id":    { "kind": "stored", "path": "/clinic_id" },
        "preferred_language": { "kind": "request", "path": "/language", "fallback": { "value": "he" } },
        "channel":      { "kind": "literal", "value": "phone" }
      }
    },
    {
      "id": "sms-confirm",
      "tool_revision_id": "8b3d4e5f-6a7b-4c9d-8e1f-2a3b4c5d6e7f",
      "inputs": {
        "booking_id": { "kind": "sequence", "path": "/booking_id" },
        "reference":  { "kind": "step", "scope": "local", "step_id": "log", "path": "/reference" }
      }
    },
    {
      "id": "email-summary",
      "tool_revision_id": "9c4e5f6a-7b8c-4d0e-9f2a-3b4c5d6e7f80",
      "inputs": {
        "transcript": { "kind": "artifact", "artifact": "transcript", "path": "/text" },
        "clinic_id":  { "kind": "stored", "path": "/clinic_id" }
      }
    },
    {
      "id": "missed-call-sms",
      "tool_revision_id": "ad5f6a7b-8c9d-4e1f-a03b-4c5d6e7f8091",
      "inputs": { "clinic_id": { "kind": "stored", "path": "/clinic_id" } }
    }
  ],
  "conversation": {
    "entry_node_id": "greet",
    "nodes": [
      { "id": "greet", "type": "conversation", "label": "Greet and find out what they need", "instructions": "…" },
      { "id": "book", "type": "action", "label": "Book the appointment", "binding_id": "book-visit" },
      { "id": "confirm", "type": "sequence", "label": "Confirm and log the booking", "sequence_id": "confirm-and-log" },
      { "id": "end", "type": "end", "label": "End call" }
    ],
    "edges": [
      { "id": "greet-to-book", "kind": "conversation", "source": "greet", "target": "book", "condition": "The caller wants an appointment and has given a name and a time" },
      { "id": "book-ok", "kind": "result", "source": "book", "target": "confirm", "outcome": "succeeded" },
      { "id": "confirm-ok", "kind": "result", "source": "confirm", "target": "end", "outcome": "succeeded" }
    ]
  },
  "sequences": [
    {
      "id": "confirm-and-log",
      "name": "Confirm and log the booking",
      "input_schema":  { "type": "object", "properties": { "booking_id": { "type": "string" } }, "required": ["booking_id"], "additionalProperties": false },
      "output_schema": { "type": "object", "properties": { "confirmation_sent": { "type": "boolean" } }, "required": ["confirmation_sent"], "additionalProperties": false },
      "output_mapping": { "confirmation_sent": { "kind": "step", "scope": "local", "step_id": "sms", "path": "/sent" } },
      "steps": [
        { "id": "log", "label": "Write it to the practice system", "binding_id": "log-visit" },
        { "id": "sms", "label": "Text the confirmation", "binding_id": "sms-confirm", "depends_on": ["log"] }
      ]
    }
  ],
  "after": [
    {
      "id": "summary-to-clinic",
      "event": "call.ended",
      "steps": [
        { "id": "email", "label": "Email the clinic the call summary", "binding_id": "email-summary", "requires": ["transcript"], "on_failure": "continue" }
      ]
    },
    {
      "id": "missed-call",
      "event": "call.no_answer",
      "steps": [
        { "id": "text-clinic", "label": "Text the clinic that a call went unanswered", "binding_id": "missed-call-sms", "on_failure": "continue" }
      ]
    }
  ]
}
```

The file linked above is the same document in full — with the `apologise`
branch, both failure routes and the editor positions this excerpt leaves out.
It is not decorative: `docs/scripts/check-docs.mjs` validates it against
[`workflow-v1.json`](https://docs.goyappr.com/schemas/workflow-v1.json) on every run, so an example
that stops being publishable fails the check rather than the reader.

### Things the example is quietly demonstrating

* **Every step carries a `label`.** `id` and `binding_id` are not enough — a
  step without a label is refused, and the refusal does not name the field.
  Label every before-call step, follow-up step and sequence child.
* **Exactly one End node**, and nothing leaves it.
* **A conversation node branches with a written `condition`; an action or
  sequence node branches on `outcome`** (`succeeded` / `failed`). Mixing the
  two is `edge_kind`.
* **Every node has to be reachable** from `entry_node_id` or a global branch —
  a tool node added to the canvas but never wired is `unreachable_node`.
* **Every declared sequence needs an invocation node**, and a sequence's child
  bindings are private to it: a binding used inside a sequence cannot also be
  used by a conversation or lifecycle step.

## Where to go next

* [Save workflow draft](https://docs.goyappr.com/api-reference/workflows/save.md) — how the document is
  written, with `expected_version`.
* [Check workflow](https://docs.goyappr.com/api-reference/workflows/validate.md) — the same rules as
  publication, with every issue and its JSON pointer.
* [Publish workflow](https://docs.goyappr.com/api-reference/workflows/publish.md) — what becomes live.


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