Skip to content

A workflow is a tool

Agents and MCPMCPHTTPlist_workflowsget_workflowinvoke_workflowmcp-workflows-longtail

A compiled pipeline deploys as an MCP tool, so the next agent that meets the same case calls a deterministic fix instead of reasoning again.

The situation

An agent fixed an edge case once by calling three tools in sequence: rotate, extract, validate. The next time the same case appears, it should not spend tokens rediscovering the sequence.

The recipe

Once the sequence is compiled into a YAML pipeline and activated, the mcp-workflows-longtail server offers it as a tool. An agent checks for a compiled solution first:

tool call: list_workflows
{ "status": "active" }
tool call: invoke_workflow
{
"workflow_name": "rotate-and-extract",
"input": { "document": "page1_upside_down.png", "rotation": 180 },
"async": false
}

get_workflow returns a pipeline’s input schema and activity manifest. With async: false the call waits for the result (default limit 120000 ms); with async: true it returns a job_id. Only pipelines in active status run.

The cycle that produces these tools:

  1. A workflow calls tools as durable activities.
  2. It escalates when confidence is low.
  3. A triage agent calls the same tools dynamically to fix the case.
  4. The successful sequence compiles into a deterministic pipeline.
  5. The pipeline becomes a tool, and the next run takes the direct path.

The guarantee

A compiled pipeline is deterministic tool-to-tool data piping: no model call, no token cost, the same steps every run. It inherits the invoking workflow’s principal and credentials through the DAG. See MCP.