VocalDocscontracts 1.65.0

Statecharts and Workflows

By default an Agent runs as one implicit state: the model answers each Turn within the Agent's instructions, Tools and Policies. A statechart gives the conversation explicit states and guarded transitions; a Workflow describes the path of a Call as a graph of nodes. Both run on the same interpreter inside the Call, and both are deterministic where they decide.

On the Phase 0 host. Served: statecharts, slots, squad Agents and the decision lane since contracts 1.58.0 (deploy #65); conversation-scope Workflows since 1.59.0 (deploy #67).

Statecharts

machine on the Agent draft is the statechart: its regions and states, exactly one speaker region, guarded transitions, bounded loops, machine-wide limits and the state to enter when a limit is reached. The model proposes moves through control tools, such as transition, set_slot and handoff, and guards evaluated by the rules engine accept or refuse each one.

  • slots declares up to 32 typed slots, the conversation's memory, carried across every handoff. Every reference to a slot in the machine, a Prompt template, a Policy or an Outcome must resolve.
  • squad names up to 8 squad Agents that states bind by key; publishing pins the active version of each. A squad Agent with its own machine or squad is refused.
  • decision configures the decision lane, the model stage that answers the question sets states ask. Decision corpora hold labelled cases, and a run scores the lane's Provider and model on them.

Publishing checks the statechart, freezes it with the version and compiles it for the Call. POST /v1/agents/{agent_id}/versions/{version}/machine/dry-run runs a version's machine over scripted events and answers each step: its value, effects, guard outcomes and the state hooks it dispatches. No Policy runs in a dry run, and it writes nothing.

In a Call, the machine leaves Call events: state.entered, state.exited, transition.refused, handoff.completed, machine.limit_reached, guard.error, and decision.verdict or decision.failed for the decision lane.

Workflows

A Workflow is a versioned graph whose scope is fixed at creation. Conversation scope, the path of one Call, is built; process scope is refused with capability_not_available, and so is a decision that names a Ruleset.

StepOperation
Create a draft for one Agent; it is checked as a publish checks itPOST /v1/workflows
Test the draft or a version over scripted events; writes nothingPOST /v1/workflows/{workflow_id}/test
Publish: compile, record the digest and pin the Agent's active versionPOST /v1/workflows/{workflow_id}/versions
Activate a versionPOST /v1/workflows/{workflow_id}/versions/{version}/activate
Dry-run one deciding node of a version against sample inputPOST /v1/workflows/{workflow_id}/versions/{version}/nodes/{node_id}/evaluate

To run it, set workflow_id on the Agent draft; the Workflow's agent_id must be that Agent, and the draft then sets no machine, slots or squad. Publishing the Agent pins the Workflow's active version and compiles it into the Call's machine. Each evaluation in a Call is the Call event workflow.evaluated.

Not built

Processes, the running instances of a process-scope Workflow, have operations from contracts 1.62.0 (Processes and Human tasks), which the Phase 0 host does not serve; until it does, a Workflow of process scope is refused as described above. Rulesets and the canvas are planned.