Skip to main content
Action Runner allows the AI agent to execute pre-built flows by emitting [ACTION:slug:{"params"}] tags in chat responses. The system intercepts these tags, executes the flow steps, and streams status updates back to the user.

How It Works

  1. AI emits action tag — Model outputs [ACTION:slug:{"params"}] in its prose
  2. Interceptor strips tag — Action-runner plugin removes tag from visible chat
  3. Flow execution — System fetches flow from Directus action_flows collection
  4. Status streaming — Each step streams status back to chat interface
  5. Results logged — Execution logged in agent_audits collection

Flow Storage

Flows are stored in the Directus action_flows collection:

Built-in Action Flows

Step Types

The Action Runner supports 14+ step types. Each step can reference previous step results using variable interpolation.

Directus Steps

directus_read

Read items from a Directus collection.
Config options:
  • collection (required) — Collection name
  • filter — Filter object (Directus query syntax)
  • fields — Comma-separated field names
  • limit — Max items to return
  • sort — Sort field (-field for descending)
  • id — Read single item by ID

directus_write

Create a new item in a collection.

directus_update

Update an existing item.

directus_delete

Delete an item.
Full-text search across a collection.

directus_trigger

Trigger a Directus Flow.

Stagehand Steps (Browser Automation)

stagehand_start

Start a new browser session.
Returns: { sessionId: "xyz123" }

stagehand_navigate

Navigate to a URL.

stagehand_extract

Extract data from current page using AI.

stagehand_act

Perform an action on the page (click, type, etc.).

stagehand_close

Close browser session.
Start session with stored platform cookies (bypasses login).
Fetches decrypted cookies from platform_sessions, injects them, and navigates to target URL.

stagehand_extract_cached

Extract with 10-minute cache (reduces browser calls).

Ollama Steps (AI Generation)

ollama_generate

Generate completion (single-turn, no history).

ollama_chat

Multi-turn chat with message history.

Taxonomy Steps

taxonomy_terms_read

Read taxonomy terms with caching.

taxonomy_invalidate

Bust taxonomy cache after writes.

Queue Steps

bullmq_enqueue

Enqueue a BullMQ job.

Generic HTTP

http_request

Make arbitrary HTTP request.

Variable Interpolation

Steps can reference data from:
  • $input.field — Parameters from ACTION tag
  • $steps[N].field — Result from step N (0-indexed)
  • $result_key.field — Result from step with given result_key
  • $context.field — Context data (user info, workspace, timestamp)
Example flow:

Creating a New Action Flow

  1. Design the flow — Map out steps and data flow
  2. Create in Directus — Add to action_flows collection
  3. Set slug — Unique identifier (e.g., analytics-report)
  4. Define steps — JSON array of step definitions
  5. Test execution — Trigger from AI chat: [ACTION:analytics-report:{"period":"7d"}]
  6. Check audit log — Review in agent_audits collection

Execution Timeouts

  • Per-step timeout: 120 seconds
  • Steps exceeding timeout are aborted
  • Flow execution stops on first failed step
  • Partial results available in error response

Error Handling

Failed steps return error details:
All executions logged to agent_audits with full error details.

Implementation Files

  • server/utils/actionRunner/index.js — Flow executor (server/utils/actionRunner/index.js:1)
  • server/utils/actionRunner/stepExecutors.js — Step type implementations (server/utils/actionRunner/stepExecutors.js:1)

Next Steps

Project Structure

Understand the codebase layout

Extending MCP

Add new MCP tools