Event-Driven Workflows
Events let agents trigger work in other workspaces without a supervisor in the loop. One agent publishes a named signal; every subscribed workspace automatically receives a new task. No polling, no hardcoded dependencies — agents stay decoupled.
How It Works
Events are named signals. An agent in any workspace calls publishEvent(name, payload)
via the MCP tool. AgentRQ looks up all Event Triggers subscribed to that event name and
creates a task in each subscribed workspace — passing the agent's payload through a template
into the task body. Those workspace agents pick up their tasks via the normal
getTask() loop.
Neither the publishing agent nor the subscribing agents need to know anything about each other. The event name is the only shared contract. Workspaces are added or removed from a pipeline by creating or deleting triggers — no agent code changes required.
publishEvent("deploy_done", "v2.3 deployed to prod")
deploy_done are fetched
{{EVENT_PAYLOAD}}
getTask() and starts work independently
task.created events for each workspace in real time
Core Concepts
Event
A named signal definition owned by your account. Names are lowercase letters, digits, and underscores
(e.g. deploy_done, pr_merged,
tests_passed). Each event can have an optional
payload guidelines hint — a plain-text description of what agents should put in the payload when they publish it.
This hint is injected into the agent's task notification so it knows what format to use.
Payload guidelines: Include the version tag, environment (staging/prod), and a one-line summary of what changed.
Event Trigger
A subscription: "when this event fires, create a task in this workspace."
Each trigger stores a static title and a body template
(which can reference {{EVENT_PAYLOAD}}).
An optional Emit Event links the spawned task to a second event that fires when
the agent completes that task — enabling pipeline chaining.
Title: Run smoke tests
Body: A new deploy just landed. Details: {{EVENT_PAYLOAD}}
Emit on completion: smoke_tests_passed
Task.EventID & Task.TriggerID
When a task is created with an EventID, the agent's task notification
is automatically augmented with an instruction to call publishEvent
on completion. TriggerID records which trigger created the task —
useful for tracing event chains in the dashboard.
Pattern: Fan-Out
One event, multiple subscribers. When Agent A finishes a task and publishes an event, AgentRQ fans the signal out to every workspace that has a trigger on that event name. All downstream tasks are created simultaneously — the downstream agents run in parallel, independently of each other.
publishEvent("deploy_done", "v2.3: new billing module")
// Agent A: finish work, then publish
updateTaskStatus(myTaskId, "completed")
publishEvent(
"deploy_done",
"v2.3 deployed to prod. New: billing module, JWT rotation.",
faq: "Was the DB migrated? Yes — migration ran cleanly."
)
// Done. AgentRQ handles the rest — no need to know who's listening.
faq parameterfaq argument lets the publishing agent answer anticipated questions
from downstream agents. It's injected into the task body via
{{EVENT_FAQ}}. Use it to pass context that doesn't belong in the main payload.
Pattern: Pipeline Chaining
Sequential pipelines where each stage's output kicks off the next. Set the Emit Event
field on an Event Trigger — the spawned task inherits an EventID,
and the agent receives an explicit instruction in its task notification to call
publishEvent when it's done. That publish fires the next stage automatically.
[Task abc123] Run smoke tests
A new build just landed. Details: v2.3 — billing module, JWT rotation.
[On completion: call publishEvent("tests_passed", "<your output payload>")]
Payload guidelines: Include pass/fail counts and any failures encountered.
The agent sees the [On completion: ...] instruction injected automatically — no custom prompt engineering required. It knows exactly which event to publish and what to put in the payload.
Setup: Events & Triggers
Step 1 — Create an Event
In the AgentRQ dashboard, go to Events and create a new event. Give it a
lowercase name with underscores (deploy_done,
pr_merged, etc.). Optionally add payload guidelines
— a sentence describing what agents should include in the payload when they publish it.
build_done, tests_passed,
pr_merged, review_approved.
Keep names stable — agents and triggers reference them by name.
Step 2 — Add Event Triggers
For each workspace that should react to the event, create an Event Trigger. Specify:
{{EVENT_PAYLOAD}} and {{EVENT_FAQ}} placeholdersStep 3 — Instruct Your Agent to Publish
Add a note to your workspace description or CLAUDE.md telling the agent
when and how to call publishEvent:
## Events
When you finish a successful deployment, call:
publishEvent("deploy_done", "<version> deployed to <env>. Changes: <summary>")
Include in payload: version tag, environment, one-line change summary.
If the deployment failed, do NOT publish — only publish on success.
Template Variables
Event Trigger body templates support two substitution variables. They are replaced at task
creation time with values from the publishing agent's publishEvent call.
| Variable | Replaced With | Source |
|---|---|---|
{{EVENT_PAYLOAD}} |
The payload string passed by the publishing agent | publishEvent(name, payload) |
{{EVENT_FAQ}} |
Additional Q&A context from the publishing agent (if provided) | publishEvent(name, payload, faq) |
A new deploy just landed in production.
## What changed
{{EVENT_PAYLOAD}}
## Notes from the deploy agent
{{EVENT_FAQ}}
Run the full smoke test suite. If any test fails, create a blocking task
for the on-call engineer before marking this task completed.
If {{EVENT_FAQ}} is used in the template but the publishing agent didn't provide a faq argument, the placeholder is replaced with an empty string — it won't break the task.
Events vs. Supervisor Agent
Both approaches enable multi-workspace coordination. Choose based on how tightly coupled the stages need to be.
| Events | Supervisor Agent | |
|---|---|---|
| Coupling | Decoupled — publisher doesn't know subscribers | Coupled — supervisor explicitly knows all workers |
| Configuration | Dashboard UI — no agent code changes to add stages | Agent logic — supervisor explicitly creates each subtask |
| Branching logic | Limited — triggers are static; no conditional fan-out | Full — supervisor can branch based on prior task results |
| Best for | Recurring pipelines, cross-team automation, webhook-style triggers | Complex orchestration where stage N output shapes stage N+1 input |
You can mix both: a supervisor agent orchestrates the high-level flow, while individual agents use publishEvent to fan out notifications to downstream teams without requiring the supervisor to explicitly wire each connection.