Running employees
AI Employees run when you send events to the API or use the Chat page in the customer panel. The system routes each event to the right employee (Customer Support, Email, or Appointment) and returns a reply.
From the customer panel
Go to Chat in the panel. Type a message and click Send. The page sends a POST /api/v1/events request with your tenant ID, channel: "web", and event_type: "message". The Customer Support Employee reply appears in the thread. No code required.
From the API
Send a POST request to /api/v1/events with a JSON body:
{
"tenant_id": "your-tenant-uuid",
"contact_id": "optional-contact-uuid",
"conversation_id": "optional-conversation-uuid",
"channel": "web",
"event_type": "message",
"payload": { "message": "Hello", "text": "Hello" },
"request_id": "optional-idempotency-id"
}
Required: tenant_id, channel, event_type. The payload holds the message or event data.
Routing rules
The orchestrator picks an employee by channel and event type:
channel === "email"→ Email Employeeevent_type === "appointment.requested"→ Appointment Employee- Otherwise → Customer Support Employee
Response
Success (200) returns:
{
"ok": true,
"agent": "ChatAgent",
"reply": {
"text": "Thanks for your message. We'll get back to you soon.",
"tool_results": []
}
}
The agent field in the JSON response is an internal class name and is unchanged for API compatibility.
Errors return {"ok": false, "error": "...", "details": ...} with an appropriate HTTP status.
Example: curl
curl -X POST https://praigen.com/api/v1/events \
-H "Content-Type: application/json" \
-d '{
"tenant_id": "550e8400-e29b-41d4-a716-446655440000",
"channel": "web",
"event_type": "message",
"payload": { "message": "Hi" }
}'