Agent
A campaign agent that works in conversation and stops at approval
The agent accepts a request in plain language, calls the same tools the dashboard uses, reports what it changed, and never publishes. The approval gate is part of the workflow, not a policy the model is asked to remember.
From message to approved campaign
-
Send the request
The manager writes in the dashboard chat or a linked WhatsApp number. The message is stored as a chat turn against the tenant and user.
-
Queue and lease
The HTTP request only enqueues the turn. A leased chat worker claims it, so a slow model call never holds the API connection open and a crashed worker's lease expires for retry.
-
Agent reasons and calls tools
The worker runs the configured campaign_agent model, which calls tools such as starting a campaign, reading the current recommendation, regenerating an asset or requesting approval.
-
Stream the reply
Progress and the final answer stream over server-sent events. A reconnect with the last event ID resumes the stream instead of replaying or losing output.
-
Hand off to approval
Anything that would publish is turned into an approval request. The agent reports what it prepared and what is waiting for a reviewer; it cannot approve on its own.
-
Record the run
The turn, tool calls, model identity, token usage, latency and trace ID are recorded, so a reviewer can see exactly what the agent did.
Two ways in, one workflow
-
Dashboard chat
Authenticated, tenant-scoped and gated by the campaign_agent feature. The reply renders inline with links to the workflow or campaign it touched.
-
WhatsApp channel
A Meta WhatsApp Cloud API webhook verifies the request signature, maps the phone number to a tenant link, and creates the same chat turn. Replies go back through the Cloud API.
-
Link and verify
Inbound WhatsApp numbers are linked to a tenant through a verification flow, so an unknown number cannot start a campaign. Unlinking revokes the mapping.
-
Same guardrails
Both entries share rate limits, input and output caps, quota checks and the approval gate. The channel changes transport, not authority.
What the agent may do on its own
- Start a discount or campaign workflow for the tenant
- Read the current recommendation, campaign version and asset set
- Request regeneration of a proposal, content or a creative asset
- Explain a rule check or a policy citation behind a recommendation
- Prepare an approval request and notify the configured reviewers
What it cannot do
- Publish a campaign or deliver a social post
- Approve its own request or another reviewer's request
- Exceed the configured discount percentages, margin floor or prohibited terms
- Read another tenant's data or another user's assistant-owned resources
- Bypass a disabled optional stage or a feature the tenant has not enabled
Guardrails sit around the conversation
Chat input and output have hard character caps, per-user and per-tenant rate limits apply to sends and to the streaming endpoint, and quota checks run before a turn is queued. A request that exceeds a limit is rejected with a specific code rather than silently truncated.
The agent is a client of the platform, not an administrator. It authenticates with the user's actor context, so the same feature gating, tenant scoping and repository checks that protect the API protect the conversation.
Availability depends on three switches
| Layer | What it controls | Who sets it |
|---|---|---|
| Tenant flag | Whether the tenant may use the campaign agent and channels at all | Administrator |
| User grant | Whether a specific user inside an enabled tenant may use it | Administrator |
| Role | Whether the user's role is allowed to act; viewers are excluded | Role model |
Why the worker is separate
Model calls are slow and fail in interesting ways. Moving them to a leased worker keeps API latency predictable, makes retries safe, and lets a deployment scale chat independently of the web tier. The dashboard shows the current state of a turn even when the stream is closed.
See the pipeline behind the conversation
The how-it-works page follows a chat turn through the worker, the workflow and back to the approval gate.