Added

Workflow LLM and File Step Support

Workflow definitions now support richer built-in tool steps for report generation and structured post-processing. API consumers can save workflows that call an LLM with a JSON Schema contract, write downloadable artifacts, and see whether a workflow contains non-deterministic model steps.

What's New

  • tool_call workflow steps now validate against an explicit allowlist: run_sql, execute_python, fetch_url, web_search, llm_call, and write_file.
  • llm_call steps run a one-shot model call and return schema-validated structured output for downstream workflow steps.
  • write_file steps create downloadable artifacts such as CSV, JSON, Markdown, HTML, SQL, Python, text, YAML, or PDF files.
  • Workflow create and update responses include containsLlmStep, which is true when the saved workflow contains at least one llm_call step.

Modified Endpoints

  • POST /api/v1/accounts/{accountId}/workflows
  • POST /api/v1/accounts/{accountId}/workflows/{workflowId}
  • GET /api/v1/accounts/{accountId}/workflows
  • GET /api/v1/accounts/{accountId}/workflows/{workflowId}

Example Workflow Steps

[
  {
    "id": "query-revenue",
    "name": "Query revenue",
    "order": 0,
    "type": "tool_call",
    "toolName": "run_sql",
    "toolArgs": {
      "query": "SELECT CURRENT_DATE AS report_date, SUM(amount) AS revenue FROM orders WHERE order_date = CURRENT_DATE"
    }
  },
  {
    "id": "summarize",
    "name": "Summarize revenue",
    "order": 1,
    "type": "tool_call",
    "requires": ["query-revenue"],
    "toolName": "llm_call",
    "toolArgs": {
      "prompt": "Create an executive revenue brief from {{query-revenue.parsed_output.rows}}.",
      "schema": {
        "type": "object",
        "properties": {
          "headline": { "type": "string" },
          "summary": { "type": "string" }
        },
        "required": ["headline", "summary"]
      },
      "model": "haiku",
      "temperature": 0
    }
  },
  {
    "id": "write-report",
    "name": "Write report",
    "order": 2,
    "type": "tool_call",
    "requires": ["summarize"],
    "toolName": "write_file",
    "toolArgs": {
      "filename": "daily-revenue-brief",
      "file_extension": "md",
      "content": "# {{summarize.parsed_output.headline}}\n\n{{summarize.parsed_output.summary}}"
    }
  }
]

Response Field

Workflow create/update responses now include containsLlmStep:

{
  "ok": true,
  "data": {
    "workflowId": "770e8400-e29b-41d4-a716-446655440002",
    "version": 1,
    "command": "/daily-revenue-brief",
    "containsLlmStep": true
  }
}

Migration Notes

Existing workflows continue to work. If you previously saved unsupported toolName values, update them to one of the allowed built-ins before saving a new version. write_file depends on the agent-file-exports feature flag; when the flag is disabled, omit file-writing steps or use another output path.