[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
- AI emits action tag — Model outputs
[ACTION:slug:{"params"}]in its prose - Interceptor strips tag — Action-runner plugin removes tag from visible chat
- Flow execution — System fetches flow from Directus
action_flowscollection - Status streaming — Each step streams status back to chat interface
- Results logged — Execution logged in
agent_auditscollection
Flow Storage
Flows are stored in the Directusaction_flows collection:
| Field | Type | Description |
|---|---|---|
slug | string | Unique identifier (used in ACTION tag) |
name | string | Human-readable name |
description | text | What the flow does |
steps | JSON | Array of step definitions |
active | boolean | Enable/disable flow |
Built-in Action Flows
| Slug | Purpose |
|---|---|
scout-analyze | Scrape URL + AI analysis |
taxonomy-tag | Auto-classify content with 6-concept taxonomy |
post-create | Draft platform-specific social post |
message-generate | Fan engagement message |
memory-recall | Search stored data + summarize |
media-process | Queue media job (watermark, teaser, compress) |
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.
collection(required) — Collection namefilter— Filter object (Directus query syntax)fields— Comma-separated field nameslimit— Max items to returnsort— Sort field (-fieldfor 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.
directus_search
Full-text search across a collection.
directus_trigger
Trigger a Directus Flow.
Stagehand Steps (Browser Automation)
stagehand_start
Start a new browser session.
{ 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.
stagehand_cookie_login
Start session with stored platform cookies (bypasses login).
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)
Creating a New Action Flow
- Design the flow — Map out steps and data flow
- Create in Directus — Add to
action_flowscollection - Set slug — Unique identifier (e.g.,
analytics-report) - Define steps — JSON array of step definitions
- Test execution — Trigger from AI chat:
[ACTION:analytics-report:{"period":"7d"}] - Check audit log — Review in
agent_auditscollection
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: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
