Skip to content

feat(platform): Add run_workflow agent tool #663

Closed

Description

@larryro

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_status tool or extend workflow_read to 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_workflow tool 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

  1. added
    priority: medium
    feat
    service: platform
    on Mar 4, 2026
  2. yannickmonney commented on Apr 7, 2026

    @yannickmonney
    Contributor

    This feature is already fully implemented as run_workflow tool at convex/agent_tools/workflows/run_workflow_tool.ts. It accepts workflowSlug and optional parameters, 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).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    featpriority: mediumservice: platform

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions