Assistant on event
Updated
An administrator registers a rule: when document.posted or
command.succeeded fires, start an assistant turn as a chosen user. Posting
does not wait on the model. A rolled-back post enqueues nothing.
This is the same in-process sink as tenant webhooks. The
handler only enqueues. The LLM runs on AssistantEventWorker, not on
WebhookSenderService and not in the posting transaction.
Rule#
| Event | document.posted, command.succeeded, or * |
| Object | optional name (SalesOrder); empty = any |
| User | must be active and unlocked; tools run with that user's roles |
| Prompt | may mention {event}, {object}, {recordId}, {command}, {userId} |
Duplicate (rule, PublishId) is a no-op. A Test button queues assistant.test
(that name does not match *).
Run#
Pending → InFlight → Succeeded / Abandoned. Max 3 attempts, same backoff as webhooks, 10 minute lease (an LLM turn is slower than HTTP). The conversation is owned by the rule user; the admin journal stores its id.
Never call run_command from the enqueue path. The turn is a visible assistant
thread. Auto-answering command questions is out.
Admin#
SPA /assistant-events (Administrators). List, create, disable, delete, Test,
last 50 runs. API: GET/POST /api/assistant-events,
PUT/DELETE /api/assistant-events/{id}, POST /api/assistant-events/{id}/test,
GET /api/assistant-events/{id}/runs.
See also: Office inbox, Process timeline, Tenant webhooks.