Flow and Inspect Tools

Orchestrate multi-step workflows with human oversight, and inspect execution history.

Flow tools let you define and execute structured workflows, insert approval gates before sensitive operations, and request missing data from users mid-workflow. Inspect tools give you visibility into past executions. All tools are available at data-grout@1/flow.*@1 and data-grout@1/inspect.*@1.

When you need to defer or repeat a workflow on a schedule, see Scheduler Tools β€” you can pass a schedule argument directly to flow.into or use scheduler.create with a plan array.


Flow Tools

flow.into@1

Execute a multi-step workflow from a structured plan. You define the steps, and Flow handles dependency resolution, type bridging between steps, and validation. Completed workflows can be saved as reusable skills.

Parameters

Parameter Type Required Default Description
plan array yes – Ordered array of workflow steps. Each step specifies a tool and its arguments
input_schema object no – JSON Schema describing the expected input to the workflow
name string no – Human-readable name for the workflow
description string no – Description of what the workflow does
validate_only boolean no false Validate the plan without executing it. Returns a Cognitive Trust Certificate if valid
save_as_skill boolean no false Save the workflow as a reusable skill after successful execution
input_data object no – Input data to pass to the first step

Example

{
  "name": "data-grout@1/flow.into@1",
  "arguments": {
    "name": "Lead to Invoice",
    "plan": [
      {
        "id": "get_leads",
        "tool": "salesforce@1/get_leads@1",
        "args": { "status": "Qualified" }
      },
      {
        "id": "convert",
        "tool": "data-grout@1/prism.focus@1",
        "args": {
          "data": "$get_leads.result",
          "source_type": "crm.lead@1",
          "target_type": "billing.customer@1"
        }
      },
      {
        "id": "create_invoice",
        "tool": "quickbooks@1/create_invoice@1",
        "args": { "customer": "$convert.result", "amount": 1000 }
      }
    ],
    "save_as_skill": true
  }
}

Response:

{
  "workflow_id": "wf_abc123",
  "status": "completed",
  "results": {
    "get_leads": { "count": 8 },
    "convert": { "count": 8 },
    "create_invoice": { "success": 8, "failed": 0 }
  },
  "ctc_id": "ctc_def456",
  "skill_id": "skill_lead_to_invoice"
}

Steps reference outputs from previous steps using $step_id.result syntax. The system resolves these references at execution time.

Use validate_only: true to check a plan before committing to execution. The validator confirms the plan is cycle-free, type-safe (using Semio types), and policy-compliant. A successful validation produces a Cognitive Trust Certificate.


flow.request-approval@1

Pause execution and request human approval before proceeding. Use this in workflows that perform destructive, high-cost, or compliance-sensitive operations.

Parameters

Parameter Type Required Default Description
action string yes – Short description of the action requiring approval (e.g. "Delete 50 customer records")
details string yes – Full details of what will happen if approved
reason string yes – Why approval is needed
context object no – Additional context: workflow ID, step number, affected records

Example

{
  "name": "data-grout@1/flow.request-approval@1",
  "arguments": {
    "action": "Create 25 invoices in QuickBooks",
    "details": "Invoices totaling $47,500 for 25 qualified leads from Salesforce",
    "reason": "Bulk invoice creation exceeds single-operation threshold",
    "context": { "workflow_id": "wf_abc123", "step": 3 }
  }
}

Response (when approved):

{
  "decision": "approved",
  "approved_by": "nick@company.com",
  "approved_at": "2026-01-15T14:30:00Z",
  "comment": "Approved, proceed"
}

If the request is rejected or times out, the workflow halts and the response indicates the outcome.


flow.request-feedback@1

Request missing data from a user mid-workflow. When a workflow reaches a point where it lacks required information, it pauses and asks.

Parameters

Parameter Type Required Default Description
missing_fields array yes – List of fields needed, each with a name and description
current_data object no – Data collected so far, for context
reason string yes – Why this information is needed
suggestions object no – Suggested values for each missing field
context object no – Additional context about the workflow

Example

{
  "name": "data-grout@1/flow.request-feedback@1",
  "arguments": {
    "missing_fields": [
      { "name": "invoice_due_date", "description": "When should the invoice be due?" },
      { "name": "payment_terms", "description": "Net 15, Net 30, or Net 60?" }
    ],
    "current_data": { "customer": "Acme Corp", "amount": 5000 },
    "reason": "Invoice creation requires due date and payment terms",
    "suggestions": { "payment_terms": "Net 30" }
  }
}

The workflow resumes when the user provides the requested data.


flow.route@1

Conditional dispatch with fall-through matching. Evaluates an ordered list of branches against a payload β€” the first branch whose conditions all match wins, and its target tool is executed. If no branch matches, the optional else tool runs, or a {matched: false} result is returned.

Three when forms are supported:

  1. Full predicate array (ANDed conditions): [{field, op, value}, ...] β€” same engine as data.filter, with operators eq, neq, gt, gte, lt, lte, in, not_in, contains, starts_with, ends_with, is_null, not_null.
  2. Path shorthand: "$field.subfield" β€” truthy check (non-nil, non-empty, non-zero, non-false)
  3. Catch-all: "_" or true β€” always matches (like else inline)

Targets can be tool name strings (the payload is forwarded as the tool’s payload arg) or {tool, args} maps. Because user skills are exposed as standard MCP tools, this enables branching into custom workflows.

Parameters

Parameter Type Required Default Description
payload any no – Inline data to evaluate conditions against
cache_ref string no – Reference to a cached result to evaluate against
branches array yes – Ordered list of {when, then} branches. First match wins
else string/object no – Default tool to execute if no branch matches

Each branch has:

Field Type Required Description
when array/string/bool no Condition β€” predicate array, path string, or catch-all. Omit for catch-all.
then string/object yes Tool name or {tool, args} to dispatch on match
label string no Human-readable label for this branch

Example β€” concise path-based routing

{
  "name": "data-grout@1/flow.route@1",
  "arguments": {
    "cache_ref": "rc_lead_data",
    "branches": [
      {"when": "$is_enterprise", "then": "my-skill/enterprise-onboarding"},
      {"when": "$is_admin",      "then": "my-skill/admin-review"},
      {"when": "_",              "then": "my-skill/standard-onboarding"}
    ]
  }
}

Example β€” full predicate routing

{
  "name": "data-grout@1/flow.route@1",
  "arguments": {
    "cache_ref": "rc_lead_data",
    "branches": [
      {
        "label": "high-value",
        "when": [
          {"field": "annual_revenue", "op": "gt", "value": 1000000},
          {"field": "status", "op": "eq", "value": "Qualified"}
        ],
        "then": {
          "tool": "data-grout@1/flow.into@1",
          "args": {"name": "enterprise-onboarding"}
        }
      },
      {
        "label": "standard",
        "when": [
          {"field": "status", "op": "eq", "value": "Qualified"}
        ],
        "then": "my-skill/standard-onboarding"
      }
    ],
    "else": "my-skill/nurture-sequence"
  }
}

Response (when branch 0 matches):

{
  "matched": true,
  "branch": 0,
  "label": "high-value",
  "tool": "data-grout@1/flow.into@1",
  "result": { "status": "completed", "results": { "..." : "..." } }
}

Response (when no branch matches and no else defined):

{
  "matched": false,
  "branch": -1,
  "result": null
}

Conditional Steps in flow.into

The same predicate engine is available as an inline step type inside flow.into plans. Use "type": "conditional" with branches, when/then, and optional else/input. Both the concise path-shorthand syntax and full predicate arrays work here.

{
  "name": "data-grout@1/flow.into@1",
  "arguments": {
    "plan": [
      {
        "step": 1,
        "tool": "salesforce@1/get_lead@1",
        "args": {"id": "lead_001"},
        "output": "lead"
      },
      {
        "step": 2,
        "type": "conditional",
        "input": "$lead",
        "branches": [
          {"when": "$is_enterprise", "then": "my-skill/enterprise-onboarding"},
          {
            "label": "high-revenue SMB",
            "when": [{"field": "annual_revenue", "op": "gt", "value": 500000}],
            "then": {"tool": "slack@1/send_message@1", "args": {"channel": "#high-value", "text": "New high-value lead"}}
          },
          {"when": "_", "then": "my-skill/smb-follow-up"}
        ],
        "output": "routing_result"
      }
    ]
  }
}

Inspect Tools

inspect.execution-history@1

List recent tool and workflow executions. Use this to review what has run, check statuses, and find execution IDs for detailed inspection.

Parameters

Parameter Type Required Default Description
limit integer no 20 Maximum number of executions to return
offset integer no 0 Skip this many executions (for pagination)
status string no all Filter by status: "success", "failed", "pending", "running"
refractions_only boolean no false Show only Prism refraction executions

Example

{
  "name": "data-grout@1/inspect.execution-history@1",
  "arguments": {
    "limit": 5,
    "status": "failed"
  }
}

Response:

{
  "executions": [
    {
      "execution_id": "exec_001",
      "tool": "quickbooks@1/create_invoice@1",
      "status": "failed",
      "error": "Rate limit exceeded",
      "started_at": "2026-01-15T14:22:00Z",
      "duration_ms": 340
    }
  ],
  "total": 1,
  "offset": 0
}

inspect.execution-details@1

Get full details for a specific execution, including input arguments, output data, error traces, credit consumption, and CTC references.

Parameters

Parameter Type Required Default Description
execution_id string yes – The execution ID to inspect

Example

{
  "name": "data-grout@1/inspect.execution-details@1",
  "arguments": {
    "execution_id": "exec_001"
  }
}

Response:

{
  "execution_id": "exec_001",
  "tool": "quickbooks@1/create_invoice@1",
  "status": "failed",
  "input": { "customer_id": "cust_123", "amount": 500 },
  "error": {
    "code": "rate_limit",
    "message": "Rate limit exceeded. Retry after 2 seconds."
  },
  "started_at": "2026-01-15T14:22:00Z",
  "duration_ms": 340,
  "credits_charged": 0,
  "server": "Production"
}

inspect.ctc-executions@1

List executions associated with a specific Cognitive Trust Certificate or skill. Use this to audit all runs of a verified workflow.

Parameters

Parameter Type Required Default Description
ctc_id string no – Filter by CTC ID
skill_id string no – Filter by skill ID
limit integer no 20 Maximum number of results
offset integer no 0 Skip this many results

Example

{
  "name": "data-grout@1/inspect.ctc-executions@1",
  "arguments": {
    "skill_id": "skill_lead_to_invoice",
    "limit": 10
  }
}

Response:

{
  "executions": [
    {
      "execution_id": "exec_010",
      "ctc_id": "ctc_def456",
      "skill_id": "skill_lead_to_invoice",
      "status": "success",
      "started_at": "2026-01-15T15:00:00Z",
      "duration_ms": 1240,
      "credits_charged": 3
    },
    {
      "execution_id": "exec_008",
      "ctc_id": "ctc_def456",
      "skill_id": "skill_lead_to_invoice",
      "status": "success",
      "started_at": "2026-01-14T09:30:00Z",
      "duration_ms": 1180,
      "credits_charged": 3
    }
  ],
  "total": 2,
  "offset": 0
}

Related

  • Cognitive Trust Certificates – What CTCs prove and how to read them
  • Scheduler Tools – Schedule a workflow or tool call to run on a time-based or event-driven trigger
  • Warden Tools – Use as a gate step inside flow.into to detect adversarial content
  • Semio Types – How type safety is verified in flow.into plans
  • Discovery Tools – Plan and execute workflows through the intelligence layer