Automations Configuration Guide
This guide explains how to configure automations in Fabric Agent to automate workflows based on events.
This guide explains how to configure automations in Fabric Agent to automate workflows based on events.
What Are Automations?
Automations allow you to trigger actions automatically when specific events occur in Fabric Agent. You can:
- Send prompts to create agent sessions based on events
- Execute prompts on a schedule using cron expressions
- Automate workflows based on permission mode changes, flags, or session status changes
automations.json Location
Automations are configured in automations.json at the root of your workspace:
~/.fabric-agent/workspaces/{workspaceId}/automations.jsonBasic Structure
{
"version": 2,
"automations": {
"EventName": [
{
"name": "Optional display name",
"matcher": "regex-pattern",
"actions": [
{ "type": "prompt", "prompt": "Check for updates and report status" }
]
}
]
}
}Supported Events
App Events (triggered by Fabric Agent)
| Event | Trigger | Match Value |
|---|---|---|
LabelAdd | Label added to session | Label ID (e.g., bug, not Bug) |
LabelRemove | Label removed from session | Label ID (e.g., bug, not Bug) |
LabelConfigChange | Label configuration changed | Always matches |
PermissionModeChange | Permission mode changed | New mode name |
FlagChange | Session flagged/unflagged | true or false |
SessionStatusChange | Session status changed | New status (e.g., done, in_progress) |
SchedulerTick | Runs every minute | Uses cron matching |
Note:
TodoStateChangeis a deprecated alias forSessionStatusChange. Existing configs using the old name will continue to work but will show a deprecation warning during validation.
Only these events run actions. Agent hook events such as
PreToolUse,PostToolUse,UserPromptSubmitorStopare not automation triggers:automations.jsonstill accepts them, but no action ever runs for them. Don't create automations on them.
Action Types
Prompt Actions
Send a prompt to Fabric Agent (creates a new session for scheduled prompts).
{
"type": "prompt",
"prompt": "Run the @weather skill and summarize the forecast"
}| Property | Type | Default | Description |
|---|---|---|---|
type | "prompt" | Required | Action type |
prompt | string | Required | Prompt text to send |
llmConnection | string | Workspace default | LLM connection slug (configured in AI Settings) |
model | string | Workspace default | Model ID for the created session |
Features:
- Use
@mentionsto reference sources or skills - The event's
FABRIC_*variables are expanded (e.g.,$FABRIC_LABEL). Nothing else is: any other variable,$HOMEincluded, expands to nothing, so a prompt can't pull in the app's credentials. Values are inserted as they are, without shell escaping.
LLM Connection & Model: Optionally specify which AI provider and model to use for the created session. If omitted, the workspace default connection and model are used.
{
"type": "prompt",
"prompt": "Quick code review of recent changes",
"llmConnection": "my-copilot-connection",
"model": "gemini-3-pro-preview"
}The llmConnection value is the slug of an LLM connection configured in AI Settings. The model value is a model ID supported by the provider. If either is invalid or not found, it gracefully falls back to the workspace default. Both can be used independently or together.
Webhook Actions
Send an HTTP request to an external endpoint when an event fires. Useful for notifications (Slack, Discord), logging to external services, or triggering external workflows.
{
"type": "webhook",
"url": "https://hooks.slack.com/services/${FABRIC_WH_SLACK_PATH}",
"method": "POST",
"body": {
"text": "Session ${FABRIC_SESSION_NAME} status changed to ${FABRIC_NEW_STATE}"
}
}| Property | Type | Default | Description |
|---|---|---|---|
type | "webhook" | Required | Action type |
url | string | Required | Target URL (http or https) |
method | "GET" | "POST" | "PUT" | "PATCH" | "DELETE" | "POST" | HTTP method |
headers | Record<string, string> | {} | HTTP headers as key-value pairs |
bodyFormat | "json" | "form" | "raw" | "json" | Body serialization format |
body | object or string | - | Request body (omitted for GET requests) |
auth | object | - | Authentication shorthand (see below) |
captureResponse | boolean | false | Capture response body in result (truncated to 4KB) |
URL validation: Literal URLs are validated at config load time. Templated URLs (containing
$VAR) are validated at runtime after variable expansion. Both must resolve tohttp://orhttps://— other protocols are rejected.
Body format:
json(default) — Body is serialized as JSON.Content-Type: application/jsonis set automatically unless you override it inheaders.form— Body object keys are URL-encoded asapplication/x-www-form-urlencoded. Useful for OAuth token endpoints, Stripe, and legacy APIs. Each value supports$VARexpansion.raw— Body is sent as a plain string. SetContent-Typeinheadersyourself.
Authentication:
Instead of manually constructing Authorization headers, you can use the auth shorthand:
Bearer token:
{
"type": "webhook",
"url": "https://api.example.com/events",
"auth": {
"type": "bearer",
"token": "${FABRIC_WH_API_TOKEN}"
},
"body": { "event": "$FABRIC_EVENT" }
}Basic auth (username/password):
{
"type": "webhook",
"url": "https://legacy.example.com/webhook",
"auth": {
"type": "basic",
"username": "${FABRIC_WH_USER}",
"password": "${FABRIC_WH_PASS}"
}
}The auth field is applied before custom headers, so you can override the generated Authorization header if needed. All auth field values support $VAR expansion.
Response capture: By default, webhook response bodies are discarded after reading (to release connections). Set captureResponse: true to capture the response body (truncated to 4KB). The captured body is included in the execution result and recorded in automation history (truncated to 500 chars).
{
"type": "webhook",
"url": "https://api.example.com/status",
"method": "GET",
"captureResponse": true
}Note: Response capture adds memory overhead proportional to the response size. Only enable it for endpoints where you need to inspect the response.
Variable expansion: The url, headers values, body, and auth fields all support $VAR and ${VAR} syntax for environment variable expansion. Values are inserted as proper JSON strings in a JSON body, and an expanded value is never expanded again. A placeholder outside quotes ({"n": $COUNT}) also goes in as a JSON string ("5", not 5), so a value can never add fields to the body.
Security: Webhook actions only have access to FABRIC_* system variables and FABRIC_WH_* user-defined secrets. They do not have access to your full system environment (e.g., $HOME, $PATH, or other process variables).
Script Actions
Run a script that lives inside the workspace. Scripts are spawned directly (never through a shell), so arguments are passed as-is and nothing is interpolated.
{
"type": "script",
"script": "scripts/rotate-logs.ts",
"args": ["--keep", "7"],
"runtime": "bun",
"timeoutMs": 60000
}| Property | Type | Default | Description |
|---|---|---|---|
type | "script" | Required | Action type |
script | string | Required | Script path relative to the workspace root |
args | string[] | [] | Extra arguments appended after the script path |
runtime | "bun" | "node" | "python3" | "bun" | Runtime used to execute the script |
timeoutMs | number | 60000 | Per-run timeout in milliseconds, clamped to 1 second – 15 minutes |
page | string | – | Slug of a page this script refreshes |
How scripts run:
- The script path must stay inside the workspace. Symlinks that escape it are rejected.
- The working directory is the workspace root.
- The child environment contains only
FABRIC_*variables: the event context (FABRIC_EVENTplus the same fields webhook actions receive),FABRIC_WORKSPACE_PATH, and anyFABRIC_*variables exported in the app's environment.PATH, credentials, and the rest of the process environment are never passed through. - A run that exceeds
timeoutMsreceivesSIGTERM, thenSIGKILL. - Runs of the same matcher never overlap. If a tick fires while the previous run is still going, the tick is skipped and recorded in history.
- When
pageis set, the executor also injectsFABRIC_PAGE_SLUG,FABRIC_PAGE_DIR, andFABRIC_PAGE_DATA_DIR, and records the outcome on the page so the app can show refresh failures.
Exit code, stdout, and stderr are captured in the automation history. A non-zero exit is recorded as a failure.
Action types are a strict set: prompt, webhook, and script. An automation with an unknown type (such as the removed command action), an invalid cron expression or regex, or any other error is skipped on its own: the rest of your automations keep running, and the Automations list marks the skipped one Not running with the reason on its page. If automations.json isn't valid JSON, the list says so, and automations that were already running keep running until the file is fixed.
Matcher Configuration
Display Name
Use the optional name field to give an automation a human-readable display name. If omitted, the name is automatically derived from the first action.
{
"name": "Morning Weather Report",
"cron": "0 8 * * *",
"actions": [
{ "type": "prompt", "prompt": "Run the @weather skill" }
]
}Regex Matching (for most events)
Use the matcher field to filter which events trigger your automations:
{
"matcher": "^urgent$",
"actions": [
{ "type": "prompt", "prompt": "An urgent label was added. Review the session and summarise the issue." }
]
}If matcher is omitted, the automation triggers for all events of that type.
Cron Matching (for SchedulerTick)
For SchedulerTick events, use cron expressions instead of regex:
{
"cron": "0 9 * * 1-5",
"timezone": "America/New_York",
"actions": [
{ "type": "prompt", "prompt": "Give me a morning briefing" }
]
}Cron format: minute hour day-of-month month day-of-week
| Field | Values |
|---|---|
| Minute | 0-59 |
| Hour | 0-23 |
| Day of month | 1-31 |
| Month | 1-12 |
| Day of week | 0-6 (0 = Sunday) |
Examples:
*/15 * * * *- Every 15 minutes0 9 * * *- Daily at 9:00 AM0 9 * * 1-5- Weekdays at 9:00 AM30 14 1 * *- 1st of each month at 2:30 PM
Timezone: Use IANA timezone names (e.g., Europe/Budapest, America/New_York). Defaults to system timezone if not specified.
Semantic Conditions
Matchers and conditions compare fields. A semanticCondition asks a yes/no question that the decision model answers before a prompt action starts a session:
{
"matcher": "^needs-triage$",
"semanticCondition": {
"question": "Is the user reporting a bug or crash, rather than asking a question?",
"threshold": 0.6
},
"actions": [{ "type": "prompt", "prompt": "Triage the bug in session $FABRIC_SESSION_NAME" }]
}| Property | Type | Description |
|---|---|---|
question | string | Required. The yes/no question, in English (max 500 characters). |
threshold | number | "Yes" probability needed to run, 0 < threshold <= 1. Default 0.5. |
- The model sees the event (name, automation name, payload fields) and, for session events, the session's name, labels, status and its latest user and assistant messages.
- Below the threshold the run is skipped, and the automation history records it as skipped, not failed.
- A matcher is judged once per event: all of its prompt actions run, or all are skipped.
- Inert without the decision model — when it is off (or the Automation conditions switch is), unavailable or fails, the automation runs as it would without the condition.
- It applies to prompt actions only; webhook and script actions are not gated.
- With
fabric-cli automation, setsemanticCondition(andconditions,telegramTopic) through--json.
Loop guard
An automation never runs for an event about a session it created itself — its own prompt matching a label rule would otherwise re-trigger it forever — and a chain of automation-created sessions triggering further automations stops at three levels deep. Such runs are recorded as skipped.
Permission Mode
The permissionMode field controls the permission level of sessions created by prompt actions.
{
"cron": "*/10 * * * *",
"permissionMode": "allow-all",
"actions": [
{ "type": "prompt", "prompt": "Check system health and log the results" }
]
}Permission modes:
safe- Session runs in Explore mode (default)ask- Session prompts for approval before write operationsallow-all- Session auto-approves all operations
Labels for Prompt Actions
Prompt actions can specify labels that will be applied to the session they create:
{
"cron": "0 9 * * *",
"labels": ["Scheduled", "morning-briefing"],
"actions": [
{ "type": "prompt", "prompt": "Give me today's priorities" }
]
}This creates a session with the "Scheduled" and "morning-briefing" labels applied automatically.
Complete Examples
Daily Weather Report
{
"version": 2,
"automations": {
"SchedulerTick": [
{
"name": "Daily Weather Report",
"cron": "0 8 * * *",
"timezone": "Europe/Budapest",
"labels": ["Scheduled", "weather"],
"actions": [
{ "type": "prompt", "prompt": "Run the @weather skill and give me today's forecast" }
]
}
]
}
}Log Label Changes
{
"version": 2,
"automations": {
"LabelAdd": [
{
"actions": [
{ "type": "prompt", "prompt": "The label $FABRIC_LABEL was added. Log this change with a timestamp." }
]
}
],
"LabelRemove": [
{
"actions": [
{ "type": "prompt", "prompt": "The label $FABRIC_LABEL was removed. Log this change with a timestamp." }
]
}
]
}
}Urgent Label Notification
{
"version": 2,
"automations": {
"LabelAdd": [
{
"matcher": "^urgent$",
"actions": [
{ "type": "prompt", "prompt": "An urgent label was added to this session. Triage the session and summarise what needs immediate attention." }
]
}
]
}
}Permission Mode Change Notification
{
"version": 2,
"automations": {
"PermissionModeChange": [
{
"matcher": "allow-all",
"actions": [
{ "type": "prompt", "prompt": "The permission mode was changed to allow-all. Log the change and note any security implications." }
]
}
]
}
}Validation
Automations are validated when:
- The workspace is loaded
- The agent edits automations.json
- You run
config_validatewith targetautomationsorall
Using config_validate:
Ask Fabric Agent to validate your automations configuration:
Validate my automations configurationOr use the config_validate tool directly with target: "automations".
Common validation errors:
- Invalid JSON syntax
- Unknown event names
- Empty actions array
- Invalid cron expression
- Invalid timezone
- Invalid regex pattern
- Potentially unsafe regex patterns (nested quantifiers)
To validate manually:
# Check automations.json syntax
cat automations.json | jq .Rate Limits
To protect against runaway automations (e.g., an automation that indirectly triggers itself in a loop), the event bus enforces per-event-type rate limits:
| Event | Max fires / minute |
|---|---|
SchedulerTick | 60 (1/sec) |
All others (LabelAdd, FlagChange, SessionStatusChange, etc.) | 10 |
When a limit is hit, further events of that type are silently dropped for the remainder of the 60-second window. A warning is logged. The window resets automatically.
Example: If you have a LabelAdd task that triggers a prompt which adds a label back to a session, it will fire at most 10 times before being rate-limited — preventing infinite session creation.
Troubleshooting
Automation not firing
- Check event name - Must be exact (e.g.,
LabelAddnotlabeladd) - Check matcher - Regex must match the event value
- Check cron - For SchedulerTick, verify cron expression with an online tool
- Check logs - Look for
[automations]or[Scheduler]in the logs
Prompt not creating session
- Check that the prompt is not empty
- Verify @mentions reference valid sources/skills
Best Practices
- Start simple - Test with a basic prompt before building complex workflows
- Use labels - Tag scheduled sessions for easy filtering
- Be specific - Use matchers to avoid triggering on every event
- Test cron - Use crontab.guru to verify expressions
Auto-apply rules
Automatically label sessions in Fabric Agents based on user messages or the working folder, with optional label values.
Browser
Fabric Agents ships with a built-in Chromium browser the agent can drive — navigate pages, interact with elements, read the DOM, take screenshots, inspect network traffic.