Decagon Chat Widget Agent
This integration sends text to an anonymous Decagon web chat deployment and returns the next plain-text AI reply. It preserves the Decagon conversation across turns within an evaluation session. Use it for an agent that Decagon has deployed through its web chat product.
The integration reproduces the transport used by a public Decagon widget. It does not authenticate a customer, supply an account identity, or bypass access controls.
Required secrets
Spec27 stores the deployment values below as project secrets because required secret bindings are the sandbox configuration channel. These values identify the Decagon deployment; they are not Decagon account credentials.
| Secret | What it is |
|---|---|
DECAGON_API_ORIGIN | HTTPS origin that receives the widget's conversation requests, such as https://api.decagon.ai or https://eu.api.decagon.ai. |
DECAGON_WIDGET_ORIGIN | HTTPS origin shown in the widget request's Origin header, such as https://decagon.ai or https://eu.decagon.ai. |
DECAGON_TEAM_ID | Value of the widget request's x-decagon-auth-team-id header. |
DECAGON_FLOW_ID | Value of flow_id in the widget's conversation and message request bodies. |
DECAGON_METADATA_JSON | Complete metadata object from a widget message request. It must include non-empty timezone and user_device strings. |
DECAGON_TERMINAL_REPLIES_JSON | JSON array of exact terminal reply mappings. Use [] when you have not verified a terminal reply. |
Configure Decagon
Ask your Decagon administrator to publish the agent as an anonymous web chat deployment. Confirm that the deployment answers text messages on a test site before you connect it to Spec27.
Capture the deployment values
You can read the deployment values from a widget conversation that you are authorized to test:
- Open the page that hosts the Decagon widget.
- Open your browser's developer tools and select the Network panel.
- Clear the recorded requests, open the widget, and send a harmless test message.
- Find the request whose path ends in
/conversation/new. Copy the URL's scheme and host asDECAGON_API_ORIGIN. - Inspect that request's headers. Copy
OriginasDECAGON_WIDGET_ORIGINandx-decagon-auth-team-idasDECAGON_TEAM_ID. - Inspect the JSON body. Copy
flow_idasDECAGON_FLOW_ID. - Find the request whose path matches
/chat/<conversation-id>/message. Copy its completemetadataobject as one-line JSON forDECAGON_METADATA_JSON.
Set DECAGON_TERMINAL_REPLIES_JSON to [] unless probing has verified that an
exact reply ends the native conversation. For a verified terminal reply, use
this shape:
[
{
"text": "The exact terminal reply",
"reason": "The Decagon agent ended the conversation"
}
]
The integration returns the terminal reply for the current turn. If the simulator requests another turn, Spec27 records the configured reason and stops before sending another provider request.
Do not copy the anonymous user ID or conversation ID. The integration creates
new values for each evaluation session. If the widget sends a non-empty
x-decagon-auth-signature or depends on a signed-in customer, use a custom
agent that implements that deployment's authentication contract.
Set the values in Spec27
- Copy Decagon Chat Widget Agent from the registry into your project.
- Open the project's secrets and create each exact key listed under Required secrets.
- Open the copied agent and use the preview to send a harmless support question.
The metadata value must be valid JSON. Keep string values and property names in double quotes.
Turn support
This integration supports single-turn and multi-turn evaluations. It keeps one anonymous user ID and Decagon conversation ID for the duration of each sandbox session, so later turns retain the conversation context.
Limitations and notes
- The integration supports anonymous web chat deployments. It does not support signed customer sessions.
- It returns the first non-empty AI text message after the matching user message. It does not serialize cards, forms, files, surveys, or other widget components.
- Configure verified handoff or conversation-ending announcements through
DECAGON_TERMINAL_REPLIES_JSONso later turns stop before another request. - The integration enforces a 15-second timeout on conversation creation and message submission. It polls for each reply for up to 36 seconds and bounds every history request by the remaining polling time.
- Evaluations create real conversations and may invoke tools configured on the Decagon agent. Use a non-production deployment when the agent can change customer or business data.