Repository navigation
Description
Summary
Add a new run_workflow agent tool that allows the AI agent to trigger execution of existing workflow definitions directly from a chat conversation. Currently, the agent can create and edit workflow definitions (via create_workflow, save_workflow_definition), but cannot execute/run them.
Motivation
With the existing workflow engine supporting LLM nodes (with full agent tool access), loop nodes, conditions, and actions, complex multi-step document processing workflows can be built. However, there is no bridge between the chat agent and workflow execution — users must manually trigger workflows from the UI.
Enabling the agent to trigger workflows from chat unlocks natural language invocation of complex processes:
- "Run the contract comparison workflow on the last 10 uploads"
- "Execute the compliance report workflow for folder X"
Proposed Tool Design
Tool name: run_workflow
Registration: Add to agent_tools/tool_names.ts and agent_tools/tool_registry.ts
Input Schema
{
workflowId: string; // Required: ID of the workflow definition to execute
parameters?: Record<string, unknown>; // Optional: input parameters for the start node
}Output
{
executionId: string; // ID of the created workflow execution
status: "started" | "error";
message: string;
}Implementation Notes
- Look up the workflow definition by ID, verify it belongs to the current organization
- Verify the workflow has an active/published version
- Create a new workflow execution via the existing workflow engine
- The tool should return immediately after triggering (async execution)
- Consider adding a companion
check_workflow_statustool or extendworkflow_readto support execution status queries - Requires user approval via the existing approval card mechanism (similar to
create_workflow)
Key Files
services/platform/convex/agent_tools/workflows/run_workflow_tool.ts(new)services/platform/convex/agent_tools/tool_names.ts(register)services/platform/convex/agent_tools/tool_registry.ts(register)services/platform/convex/workflow_engine/(execution APIs to reference)
Acceptance Criteria
- New
run_workflowtool registered in tool registry - Triggers workflow execution with provided parameters
- Validates workflow exists and belongs to current organization
- Returns execution ID for status tracking
- Requires user approval before execution (approval card in chat)
- Unit tests covering: successful trigger, invalid workflow ID, unauthorized access, parameter passing
Activity
feat(platform): add run_workflow agent tool with approval flow (#663)
feat(platform): add run_workflow agent tool with approval flow (#663)
yannickmonney commentedon Apr 7, 2026
This feature is already fully implemented as
run_workflowtool atconvex/agent_tools/workflows/run_workflow_tool.ts. It acceptsworkflowSlugand optionalparameters, validates the workflow exists and is enabled, validates input parameters against the workflow's input schema, and creates an approval card for user confirmation. Tests exist at__tests__/run_workflow_tool.test.ts(13 tests).