Automations
An Automation starts an Agent or Task manually, on a schedule, from a webhook, or in response to a product event. Every run keeps its status and result so you can inspect what happened.
Automation is one stage of xopc's initiative model, not permission to act without limits. Begin with observation or a proposed action, test manually, and enable unattended execution only for an explicit, low-risk scope with understood side effects.
Choose the action
| Action | Use it when |
|---|---|
| Agent instruction | The request is best interpreted at run time by one Agent |
| Task | An existing Task should start on a one-time or recurring schedule with its durable context |
When an Automation starts a Task, the Task's definition, constraints, acceptance criteria, and attached context are carried into the execution session. A Task that is already running, blocked, or closed cannot start another run.
Project-bound Agent actions inherit the selected project's scope, instructions, workspace, and other project context. Event-triggered actions also receive the triggering event: Agents and Tasks receive a bounded data block containing the event context.
Create an Automation
- Open Automations in the Gateway console.
- Choose Create automation.
- Give it a name that describes the result, such as “Weekday 9:00 planning summary”.
- Choose the action and target.
- Select a trigger: manual, one-time, interval, cron schedule, or webhook.
- For a calendar schedule, set the intended time zone explicitly.
- Configure timeout and retry behavior.
- Save, then choose Run now for a test.
Keep the first run manual. Enable an unattended schedule only after the result and side effects are correct.
Sending, deleting, purchasing, publishing, or changing an external system should retain the applicable confirmation or explicit policy. A schedule does not expand an Agent's authority.
Configure in chat
Open the project’s scheduled tasks to start a project configuration chat, or start from Personal for your own schedules. The setup chat retains that scope.
You can also configure schedules in the owner Web Chat. For example: “Save a daily 9:00 Beijing-time report as a draft; don’t run it yet,” “Try it once, show the actual result, then enable the same task,” or “Remind me once in 90 seconds.” A one-time reminder uses a saved once schedule. The API also accepts schedule: { kind: "once", afterMs: 90000 }; the server anchors it once within the operation receipt, so retrying does not move the reminder.
Explicit local create, edit, pause, resume, and delete requests need no duplicate confirmation. Requested reminders and reports should use notificationPolicy: "all" to notify on success; attention is for exceptional updates. A queued run is not a completed result. Inspect the terminal run and its result delivery separately.
For a selected custom HTTP MCP read, conversational setup can prepare a source reference and save it as the Agent action’s mcpSourceId. The runtime pins the service, tool contracts, and fixed argument hashes, requires an actual successful read in every run, and refuses changed sources or alternative tools. Enable only after a successful trial of the same action. This reference does not independently verify remote account identity; account-specific workflows require their identity adapter. Existing general Agent automations keep their previous behavior.
Monitor runs
The runtime uses one durable pipeline for every entry point:
manual / schedule / webhook / product event → event hub → matching automation → action executor → result delivery
Events carry correlation, causation, trust, deduplication, and chain-depth metadata. Each event-to-automation delivery and each result delivery is persisted independently, so a full executor does not drop triggers, gateway restarts can reconcile terminal work, and a failed result webhook does not change a successful run into a failed run. Action and delivery kinds are registry-based extension points; adding a new executor or destination does not change trigger ingestion.
Authenticated diagnostics are available through GET /api/automation-events and GET /api/automation-deliveries. The first reports event projection plus per-automation run delivery; the second reports result destinations, attempts, and the latest error. Both endpoints accept limit; event diagnostics also accept type and source, while result diagnostics accept runId and status.
Terminal failures move to a dead letter state and emit one automation.attention.required event. Operators can recover them without editing SQLite:
POST /api/automation-events/:eventId/replayreplays failed projection and event-to-run delivery;POST /api/automation-deliveries/:runId/:destinationKey/retryretries one failed result destination.
Both recovery requests require an Idempotency-Key header and a JSON body containing a non-empty reason. Metrics include pending work, oldest pending age, active leases, and dead-letter counts.
The next reliability and business-integration contract is defined in the Automation reliability and integration contract.
Use Pause when a dependency, credential, or expected input is temporarily unavailable. Pausing preserves the definition and history. Delete only when you no longer need them.
Reliable schedules
- Confirm the displayed time zone and next run time.
- Give the action a clear success condition.
- Set a realistic timeout.
- Use limited retries for transient failures, not for invalid credentials or bad input.
- Avoid overlapping runs when actions modify the same external data.
- Review failures regularly; do not assume a schedule guarantees success.
Webhook safety
Treat a webhook URL and secret as credentials. Do not put them in public repositories, screenshots, or logs. Validate any external input before allowing the action to write files, send messages, or change connected services.
Webhook Automations receive POST /api/automation-hooks/:automationId. Set the trigger's secretId, then provide its secret through XOPC_AUTOMATION_WEBHOOK_SECRETS, a JSON object keyed by secret id. Callers must send the secret as Authorization: Bearer ... (or X-Xopc-Webhook-Secret) and a stable Idempotency-Key. Payloads must be JSON objects and are limited to 256 KiB. Secrets shorter than 16 characters are rejected.
Result webhook destinations use the same secret registry and must use HTTPS. Deliveries include a stable Idempotency-Key, delivery id, attempt number, timestamp, and X-Xopc-Signature HMAC-SHA256 header. The receiver should verify the signature and deduplicate by idempotency key before applying side effects.
Examples
- summarize open Tasks every weekday morning;
- check a saved browser task and report changes;
For supported, paired Weixin private conversations, the host binds reminder delivery to the original conversation and principal. Requested reminders use notificationPolicy: "all"; the durable result outbox retries failed message delivery without rerunning the task. Identity and pairing are checked again before sending. See Weixin conversational configuration for routing requirements and acceptance scope.