Skip to main content

Playbooks

A playbook is a set of tasks that leads to a result: the tasks a selection must cover before it is submitted, the order in which they open, the choices between several ways of doing a task, and the tasks that only hold for some selections.

playbooks:
- name: open-company
goal: "open a company: the structure, then (optionally) the accounting"
tasks:
formation: {skill: formation, label: "Your company"}
accounting: {skill: accounting, required: false, label: "Your accounting", after: [formation]}

- name: take-meal-order
goal: "order a meal: the dishes, then pickup or delivery"
tasks:
dishes: {skill: takeMealSelection, label: "Your dishes"}
handover:
label: "Pickup or delivery"
after: [dishes]
one_of: # two methods, one skill: each is one of its kinds
choose: customer # the person picks (the default)
methods:
pickup: {skill: takeDeliveryOption, kind: pickup, label: "Pickup in store"}
delivery: {skill: takeDeliveryOption, kind: delivery, label: "Delivery"}

The goal and the tasks​

  • goal is the result the playbook leads to, in a sentence. It is what the agent sees in order to offer it (start_playbook, its brief). Absent, the playbook's name is shown.
  • tasks are keyed by name: the name after and $submitted[<task>.<call>] cite, never the skill's.
  • submit and submit_guard (optional): the order that sends the lines of several tasks in one request, and what submitting this playbook asks (The playbook's submit).

A task is written in exactly one of these two forms:

formmeaning
{skill: x}, or {skill: x, kind: k}the action of a skill; with kind, of a single kind of that skill
{one_of: {choose: …, methods: {method: {skill, kind, when, label, params}}}}a choice: several methods, only one of which does the task, and who picks it

Waiting for several tasks is written after: [a, b]: the task opens when a and b are done. There is no meeting-point task.

The steps show in one order, everywhere: each task after those of its after (written, or implied by depends_on or by what its params read), and, between tasks nothing ties, in the order written. So a task that truly follows another says so with after: the order written is kept end to end, but after is what makes it a rule.

And on the task:

keymeaning
whenthe task only holds if this condition holds (Conditions) — on every form
requiredthe playbook cannot be submitted without it — true by default
labelthe task's title as the person reads it, in their language: in the stepper, at the head of its lines in the selection, and in the refusals and the submit's lock. Absent, the stepper shows the skill's name made readable, in English, and the refusals the task's name
afterthe tasks that must be done before this one opens; [a, b] waits for both
paramsbinds parameters of its skill to what another task filed (A task's params). On the {skill} form and on each method of a one_of; never on the one_of itself

A skill is the action of a single task of a playbook: a card finds its task by its skill. Two methods of one one_of may share a skill, as long as each names its own kind. Two playbooks may give the same task name; only a $submitted[…] written on a skill's call, which holds for the whole station, refuses a name that designates two different calls (The submit).

Choosing a method — choose​

A one_of carries choose (who picks) and methods, at least two methods keyed by name. Each is the action of a skill (skill), or of a single one of its kinds (kind), and may carry a when, a label and params. Only one method does the task.

A method's label is what the person reads ("Pickup in store"): the refusals and the submit's lock name the method that way. Absent, it is the method's name (pickup).

valuewho chooses
customer (default)the person, among the methods whose when holds. The step presents them, each with the tool that shows it; the agent is told to call one or the other, depending on what the person asks for
rulethe first method whose when holds. The others' lines are refused. If that method's skill is withheld from the station, the task has no method: it is skipped, the next method is not taken in its place

choose: clm (a model picking the method) is refused at load: that model does not exist yet.

A method without when is mandatory: it always holds, so the task always has a method. Under rule, it is the last one.

Conditions — when​

A when, on a task or on a method, reads one thing only: $selection.kinds, the kinds of the lines still in the selection and of what this journey has already filed. It is read as a list, on the right of in or not in:

      wrapping:
skill: gift-wrap
required: false
when: "'gift' in $selection.kinds"
  • A task whose when is false is skipped: it is not a step, never blocks the submit, and its lines are refused. The tasks placed after it do not wait on it. If the condition cannot be evaluated, the task holds.
  • A method only holds if its when is true.
  • A when does not look at its own task's kinds: a task's line is not chosen yet when it is added, so the condition would close it for ever. Condition a task on what comes before it.

A task's params​

A skill reads its parameters ($params.<name>) in the args of its submit calls. A task binds a parameter of its skill to what another task of the same playbook filed: $submitted[<task>.<call>].<output>.

skills:
- name: repondre
params:
refund_id: {type: id} # no default: only a task sets it
invoke: {method: draftReply}
kinds: {reply: {}}
submit:
- {name: send, tool: sendReply, args: {body.draft: "$item.ref", body.refund_id: "$params.refund_id"}}

playbooks:
- name: ticket
tasks:
geste:
label: "Gesture"
one_of:
methods: # each method has a call `pay` that keeps `id` (type: id)
remboursement: {skill: rembourser}
avoir: {skill: avoir}
reponse:
skill: repondre
label: "Reply"
params: {refund_id: "$submitted[geste.pay].id"}
  • The reference makes the order. reponse waits for geste, as if after: [geste] were written: a line of reponse is refused until geste is done ("Reply opens once Gesture is done — choose that first").
  • A binding is read in its own playbook. Two playbooks may give the same name to different tasks: each reads its own.
  • A choice is one reference. Both methods of geste have a call pay: $submitted[geste.pay] reads the one that was filed.
  • The parameter and the output have the same type. refund_id is an id, and so is the id output of pay. A binding to an output of another type is refused at load: a value is never converted. At submit, a tenant answer that is not of that type holds the call (The submit).
  • At submit, the call of reponse leaves after the call of geste, in the same submit, with its answer. Outside this playbook, the parameter is its default; what the submit does when nothing sets it is in The submit.
  • A call of the playbook is bound by its name alone: params: {order_id: "$submitted[order].order_id"}. The task then waits for the required tasks whose lines order takes; an optional task is not waited for.

The playbook's submit​

playbooks:
- name: take-meal-order
tasks:
plats: {skill: takeMealSelection, label: "Vos plats"}
boisson: {skill: takeDrinkSelection, label: "Votre boisson", after: [plats], required: false}
submit: # one order for the lines of two tasks
- name: order
tool: placeOrder
args:
body.items: "$selection[task=plats,boisson]"
body.idempotency_key: "$action.key"
line: {slug: "$line.ref", quantity: "$line.quantity"}
submit_guard: {confirm: true} # absent: the station's
  • submit is a list of request calls, in the same shape as a skill's. Each sends lines of its tasks ($selection[task=…], or $selection[kind=…] for a kind of its tasks). Inside this playbook, a line one of its calls takes leaves by it only; its task's skill needs no call of its own. See The submit.
  • submit_guard has the keys of the station's (form, confirm, validate, submitted_by). It applies inside this playbook; without it, the station's does. For submitted_by, the stricter rule of the two wins.

Dependencies — depends_on​

      reponse:
skill: repondre
label: "Reply"
params: {refund_id: "$submitted[geste.pay].id"} # inferred: after + revalidate
depends_on: {geste: {on_loss: clear}} # written to change on_loss

depends_on is keyed by an upstream task of the same playbook and carries two answers:

  • on_loss — the upstream task was emptied: clear (its lines go with it) or block (they stay, and the submit is refused until the upstream is chosen again or they are removed). Default: block.

  • on_change — it changed without emptying (a line added, removed or replaced, a quantity): keep (nothing), revalidate (the line's guards run again at once; if they pass, the line stays, at the price they give now; a refusal, or a check that cannot run, keeps the line and holds the submit — never a pass; a line with no guard stays, silently), clear (the line goes) or block (it stays, and the submit waits until it is chosen again).

  • It implies the order: depends_on: {geste: …} counts as after: [geste].

  • It holds while its playbook is active. A skill's (Skills) holds everywhere. A written dependency is written once: on the skill or on the task, not both. One that params imply may sit beside a skill's: each answers its own changes, and a revalidation never answers another one's block.

  • params infer it. A task whose params read $submitted[geste.…] depends on geste with on_change: revalidate and no on_loss: a reference reads a value at the submit, it does not say the task makes no sense alone. You write depends_on only to change that answer. clear is always written out: the platform never decides on its own to throw away answers the person filled in.

  • On both task forms: a {skill} task as much as a one_of.

  • Every change counts. A line remembers what its upstream held when it was chosen; a line that does not know counts as changed. What this journey already filed counts as done: neither emptied nor changed — a change after it is still one. Each answer is told to the person and the agent at the change; a refusal gives the guard's public reason. The sentence for a change reads "Reply: Gesture has changed since this was chosen — choose again, or remove this line, before submitting".

How it opens​

playbooks:
- name: open-company
goal: "open a company: the structure, then (optionally) the accounting"
activation:
when: "true" # who it is for (optional: absent, everyone)
intent: "create a company" # what it is for, shown by seek_guidance
exclusive_skills: [formation] # chosen only inside this playbook
tasks:
formation: {skill: formation, label: "Your company"}
accounting: {skill: accounting, required: false, label: "Your accounting", after: [formation]}

A playbook opens in two ways, and never by a read:

  • start_playbook: the agent opens it itself, when it judges it is the right journey.

  • The first write: a choice (selection_add), or a submit, made with no journey open. For each skill written, the candidates are the admissible playbooks that have a task of that skill:

    • exactly one, and it declares activation: the choice is decided under it, as if it were open — step_open applies, and every rule of the choice. Allowed, the playbook opens (its own decision, journalled after the choice's), then the choice is written; the result says so: "open-company is now open: its steps apply from this choice on". Refused, nothing opens. If another journey opened in the meantime (two choices at once), the choice is refused, naming it: "SAS: subscribe-accounting is in progress — finish it or leave it first; nothing was added";
    • several, one of which declares activation: none opens and nothing is refused — the choice is decided outside any journey, as without activation, and its notice names them ("Essential Accounting belongs to several flows (open-company, subscribe-accounting) — it was chosen outside them; start the one meant to follow its steps"): the target's suggestion, without a model;
    • none, and the skill is exclusive to a playbook: the choice is refused, and the sentence says what the person can do — sign in, when a sign-in would open that playbook to them ("… is chosen only inside open-company, open once you are signed in — sign in first"), or nothing, when it is not open to them ("… is chosen only inside open-company, which is not open to you here — nothing was added");
    • otherwise: the choice is decided outside any journey.

    With a journey open, a skill exclusive to another playbook is refused, at the choice as at the submit: "SAS is chosen only inside open-company — subscribe-accounting is in progress: finish it or leave it first".

    If the room's journey cannot be read, the choice is held ("the order of this journey cannot be checked right now"). A submit is decided the same way under the playbook it would open — its required tasks, its submit_guard — and opens it only once allowed; refused, it is refused in a submit's shape (ok: false, blocked, errors, outcome: blocked). With several candidates, the submit goes ahead outside any journey, with no notice: the choice named them. The journal names the rule first_write.

Showing options is not choosing one: calling a skill never opens a journey.

activation has three keys, all optional:

keymeaning
whenwho it is for: a condition on the caller only. $identity.<field>, as in a profile's when, and $profiles, the names of the profiles they hold, read with in: "'pro' in $profiles". Absent: everyone
intentwhat it is for, in one sentence: seek_guidance shows it beside the goal. No score is computed
exclusive_skillsthe skills chosen only inside this playbook. Each is the skill of one of its tasks

Admissibility first. A playbook whose when is false for the caller, or whose required task (with no when) or whose own submit (its calls, its guard's validate) needs an operation their grants do not reach, never opens and is never a candidate — start_playbook included: "open-company is not open to you here — nothing was started" (refusal not_admissible, rule activation, identity phase, journalled). An operation a proof not made yet would open (a sign-in, or another provider of the station) stays reachable: the person is asked for it when the time comes. And when a sign-in would make the when true, start_playbook is held (sign_in): the surface asks for the sign-in, as for a reserved skill.

Without activation, a playbook opens only by start_playbook. Load notes it ("no activation: it opens only when the agent calls start_playbook").

seek_guidance is a tool of the station's MCP, presented beside start_playbook when the station declares playbooks. It takes no argument and does not read the room. It lists what is open to the caller, in the station's order: the admissible playbooks ({type: playbook, name, goal, intent, opens: start_playbook}, with needs: sign_in for one a sign-in would open), then the skills they can call ({type: skill, name, objective, only_in}: objective is the skill's cognitive.objective, else its name; only_in names the playbook of an exclusive skill). The answer carries band: "suggest", ranked: false, and a note saying no model ranks the candidates. It opens nothing. A guidance decision is journalled, with no target and no room; if the journal cannot write it, it answers {ok: false, code: journal_unavailable}.

The agent sees each playbook by its goal, with all its tasks in order, the optional ones marked, each named by every tool that does it: a task with two methods reads "rembourser or avoir". It is told to start the playbook before calling the skill of any of its tasks, optional ones included: a playbook opens on its own only with the first item chosen, and a task done before it started does not count. start_playbook returns the tasks to it as {task, label, required, tools}.

What it guarantees​

  • A task is done when the selection contains an item of a kind of its methods that hold (a method's kind, else every kind of its skill). This is read from the selection, never from the conversation: the person can stop and come back. A skipped task counts as done for the tasks that wait on it. A choice that holds two methods, or a method ruled out, is not done: the journey stays on it. An optional task whose skill puts nothing in the selection (a read: a guide, a check) is done once its skill has been called in this run of the playbook, never before: a call made before the playbook started does not count.

  • The order and the choices, at each choice (step_open). While the playbook is active, a line is refused, with the reason, in the station's language, and nothing is written, when:

    • a task of its after is not done: "Your accounting opens once Your company is done — choose that first";
    • its task does not hold for this selection: "wrapping does not apply to this selection";
    • it is of a kind of the skill its task does not take (kind): "Pickup does not take this choice";
    • its method does not hold: "Delivery is not available for Pickup or delivery with this selection";
    • under choose: rule, another method is the one: "Pickup or delivery is done by Pickup in store with this selection";
    • another method of the task is already in the selection: "Pickup or delivery: Pickup in store is already in your selection — remove it to take Delivery instead". An add that replaces the other method in its part (max_items: 1) goes through: the order is checked on the selection as the add leaves it.

    What this journey already filed counts as chosen. In the stepper, a waiting task is shown as not available, with the kinds still missing. A task also waits for the tasks its params read. Without after or params, tasks can be done in any order.

  • The submit is blocked, with the reason:

    • as long as a required task that holds is not done: "Your dishes: a required step of this order"; for a choice, with the methods that do it now: "Pickup or delivery: a required step of this order — choose Pickup in store or Delivery";

    • as long as the selection keeps a line the submit must not file — chosen before the journey opened, or made wrong by a later choice:

      • a line of a task that no longer holds (its when turned false after the choice: pickup replaced the delivery a courier message was written for): "Courier message does not apply to this selection";
      • a line of a kind its task does not take: "Pickup does not take this choice";
      • a method ruled out by the rule or by its when: "Pickup or delivery is done by Pickup in store with this selection", "Delivery is not available for Pickup or delivery with this selection";
      • two methods of one choice: "Pickup or delivery takes one choice — keep only one of: Pickup in store, Delivery"; if this journey has already filed one of them, the sentence names that one and asks to remove the other: "Pickup or delivery: Pickup in store is already in your selection — remove it to take Delivery instead";
      • a line whose upstream (a skill, or a task of this journey) was emptied, under on_loss: block; under clear too (a clear that did not happen is held, never done at the submit). What this attempt already filed counts as done: retrying a partial submit files the rest. The attempt is the open journey; outside one, it is the partial submit the retry continues (The submit);
      • a line whose upstream changed since it was chosen, under on_change: block or clear; under revalidate, its guards run again at the submit, and it stays held if they refuse, cannot run, or the line moved while they answered.

      The agent reads it too: while it is so, it says what holds the submit and lets the person remove the line, instead of offering to confirm.

    A task already filed by a partial submit of this journey stays done — for a choice, the filed method stays its method, whatever the rule or a when says afterwards, and another method's line is refused: the rest can be retried.

  • If the journey's state cannot be read, choosing a line a playbook rule binds and the submit are blocked too, with a sentence that says so ("the order of this flow cannot be checked right now — try again in a moment"): never an order out of sequence or without its required tasks.

These sentences come from Convoy's catalogue, in French or English according to global.language, and the station's texts block rewrites them (The station's sentences). They name a task by its label and a method by its own — never by a kind's technical name.

What load refuses​

Each error says where it is: playbooks.<playbook>.tasks.<task>.one_of.methods.<method> for a method.

writtenrefused because
a playbook with the name of a skill (error at playbooks.<name>)<name>.<call> would not say which of the two it names: one name per station
a task with neither of the two forms, or bothnobody could tell what it does
an unknown key, fallback among themnothing would read it — fallback goes with choose: clm, which is not built
choose: clmthe model that would pick the method does not exist yet: nothing would pick it
kind without skillit applies to nothing
a skill or a kind that is not declaredthe task would have nothing to show it done
a skill in two tasks of the same playbooka card could not tell which task it belongs to
two methods that take the same kinda line could not tell which method it is
a one_of with fewer than two methods, or where every method has a whenit is no choice; or a selection could leave no method at all
under choose: rule, the method without when before another onethe methods after it could never be chosen
a method whose skill produces no kindnothing could show it chosen
a required task that nothing produces a kind fornothing could show it done
a when that reads anything other than $selection.kinds ($memory, $submitted[…], $read[…], $result[…], $item…), or does not read it as a listthe reason is given: it cannot be read here
a when that looks for a kind the station does not havethe condition would never hold (or always, with not in)
a task's or a method's when that looks for a kind of its own taskthe line is not chosen yet when it is added: the task would stay closed, or change between the choice and the submit
an after that names a missing task, or a task nothing can show donethe task would never open
an after that loopsno task of the loop would ever open
a required task placed after an optional oneit would make the optional one required in practice
params on a one_of (write them on each method)it runs no skill of its own
a binding to $read[…]a read leaves no trace a task can read yet
a binding to $result[…]sub-playbooks do not exist yet
a binding to an output of another type than the parametera value is never converted: the parameter and the output have the same type
a binding to a fixed value, or to any other $… referencea fixed value is the skill's default; a task binds only to $submitted[<task>.<call>].<output> or $submitted[<call>].<output>
a binding to a call the playbook does not declare, or to the one that takes the task's own linesthe reference would resolve empty; or the task would wait for itself
a binding to a parameter the skill does not declare, that its invoke.args reads or that one of its guards readsit would set nothing; or the invoke, or the guard, would read the default while the submit reads the binding
a binding to a task missing from the playbook, to the task itself, to a call the task does not make, to an output the call does not keep, to a call that is not a requestthe reference would resolve empty
a binding to a task that has a whenit may be skipped: its answer would never exist
a binding to a one_of with a method that does not make the callchosen, that method would leave nothing to read
an after contrary to a binding (geste placed after reponse, which reads it)the written order contradicts the data
a required task whose params read an optional taskit would make the optional one required in practice
a skill parameter without default that the model does not set and no task bindsnothing would set it: every call reading it would be held
a depends_on naming a task missing from the playbook, the task itself or a task that has a whenthe dependency would never hold a line
depends_on and after that loopno task of the loop would open
two skills tied by a written depends_on both on the skill and on a tasktwo answers to one change: a written dependency is written once
a call of the playbook's submit that is not a request, reads a bare $selection, $item… or $params…, takes a missing task or a kind of none of its tasks, or sends no lineit would send whatever lines the room holds, or nothing; it has no one item, and no parameters
two calls of the playbook with one name, or with a task's name; two calls taking the same kind$submitted[…] would not say which; a line would leave twice
a $submit.<field> that a call of the playbook, or of the skill of one of its tasks, reads and that the form of its submit_guard does not askit would be sent empty, with ok: true
a submitted_by: [{who: owner}] on a playbook of a station that can sign no one inno submit could ever pass
an activation.when that reads anything but $identity.<field> and $profiles ($memory, $event…), or what a profile cannot readan activation reads the caller only
$profiles read other than with in, or a name that is not a profile of the stationit is the list of the profiles held; the condition would never hold for that name
an activation.when no one can meet today: neither the anonymous visitor nor an identity a provider of the station provesthe playbook would never open
an exclusive skill that is not the skill of a task of the playbookit would be chosen nowhere
a skill exclusive to two playbooks, or exclusive to one and a task of another (error at playbooks.<other>.tasks)it would be refused where a task asks for it
an exclusive skill written twiceonce is enough

What it does not guarantee yet​

  • Conditions on anything but the chosen kinds. A when reads neither a room fact, nor a total, nor what a task read or filed. For a real data dependency, use depends_on on the skill: it holds even outside the journey.
  • Choice by the model. No choose: clm (refused at load), no fallback.
  • Dependencies, finely. Every change of the upstream counts, a quantity as much as a replacement. A line a dependency holds shows in the notice of the change and in the submit's refusal, not yet in the selection before the submit.
  • What a task sets or starts. No params bound to $read[…] or $result[…]; no on_open or guards on a task; no result, no sub-playbooks. Every tool stays presented to the model, whichever task is open.
  • Activation by a model. Nothing ranks the candidates: intent is shown, never scored; no ENFORCE or OBSERVE bands, no station.guidance and its thresholds. An activation when reads neither $memory nor $event (refused at load). The target: Activation.
  • Reads (the skills that only answer) cannot be required tasks, nor be cited by an after: they produce no kind, nothing shows them done.

See Current limits.

What it looks like​

Terre & Table. The place-an-order playbook has two required tasks. Once the products are chosen, the Livraison (delivery) step opens: the station shows the steps (Produits done, Livraison in progress), the form's answers and the slots to choose. The customer did not have to ask what comes next.

playbooks:
- name: place-an-order
goal: "Put together a selection of products, then choose a delivery slot."
activation: {when: "true"}
tasks:
products: {skill: products, required: true}
delivery: {skill: delivery, required: true, after: [products]}