Skip to content
TriedDocs
Build agents

Chat agents

Text agents for the chat API and the website widget, built on the same LLM or conversation flow as your voice agents.

A chat agent answers by text. It runs the same LLM (single or multi-prompt) or conversation flow engine as a voice agent, so one prompt can serve calls and chats. Chats have their own post-chat analysis, webhooks and history.

Chat agents answer on two channels:

  • The chat API.
  • The website widget, through a public key.
Chat Agents list

Create a chat agent#

Open Chat Agents and select Create chat agent:

Option What it does
Start from scratch Creates a single prompt chat agent with a welcome message and opens it in the chat builder.
From a voice agent Copies the voice agent's engine, post-call analysis fields, analysis prompts, timezone and webhook URL. The new agent is named "Voice agent name (chat)".
Use an existing prompt or flow Pick an existing LLM or conversation flow as the Engine.

Each option opens the new agent in the chat builder. Click a row on the Chat Agents list to open an agent again. Custom LLM engines are not supported for chat agents.

The API equivalents are Create chat agent and POST /convert-agent-to-chat/{agent_id}.

The chat builder#

The builder has three columns, like the single prompt voice builder. Changes save as you go.

The chat builder with the prompt, the Widget settings and Test chat
  • Left: the model (with temperature, structured output and fast tier under its settings button), the prompt, and the Welcome message card. The card sets whether the agent writes first and what it says, plus up to 6 Suggested replies: buttons under the welcome message that send their text when tapped and disappear once the visitor writes.
  • Middle: the settings sections below.
  • Right: Test chat, a live chat drawn like the website widget with your colours, title, suggested replies and pre-chat form.

The header has Add to website (public keys and the embed snippet for this agent), version history and Publish.

When the prompt is also used by a voice agent or another chat agent (for example after From a voice agent), the builder says so. Your first edit to the prompt makes a copy for this chat agent, so the other agent is not changed.

A chat agent on a conversation flow shows a link to the flow instead of the prompt editor. Its functions and knowledge bases are set on the flow's nodes.

Settings#

Section Setting Field Default
Functions Calendars, CRM and helpdesk actions, custom API, code, variable extraction and connected apps the LLM's general_tools none
Knowledge Base Knowledge bases, retrieval instruction, chunks and similarity the LLM's knowledge_base_ids, kb_instruction, kb_config none
Chat Settings End the chat after end_chat_after_silence_ms 1 hour
Closing message auto_close_message (up to 500 characters) not set
Timezone timezone Australia/Sydney
Default variables the LLM's default_dynamic_variables none
Widget Title, Subtitle widget.title (up to 60 characters), widget.subtitle (up to 120) "Chat with us", empty
Colour widget.color (hex, like #2563eb) #18181b
Position widget.position (right or left) right
Message box placeholder widget.placeholder "Type a message"
Teaser widget.teaser (up to 140 characters) empty (no teaser)
Welcome message card Suggested replies widget.suggested_replies (up to 6, 60 characters each) none
Pre-chat Form Ask for details first, fields and Intro widget.pre_chat_form (enabled, fields of name, email, phone, intro) off
Analysis Analysis fields post_chat_analysis_data none
Analysis model post_chat_analysis_model gpt-5.6-luna
Chat Summary, Chat Successful prompts analysis_summary_prompt, analysis_successful_prompt not set
Webhook Settings Webhook URL webhook_url the workspace webhook
Events webhook_events all three

Functions that only make sense on a phone call (end call, transfer, agent swap, press digit) and MCP servers are not offered for chat agents.

The Teaser is a small bubble next to the chat button, shown once per visit about three seconds after the page loads, until the visitor opens the chat or dismisses it.

With the Pre-chat Form on, the widget asks for the chosen details before the chat starts. Every field is required. The answers are stored with the chat as the dynamic variables customer_name, customer_email and customer_phone, so the prompt can use {{customer_name}}.

End the chat after offers 10 minutes, 30 minutes, 1 hour, 4 hours, 12 hours or 24 hours. The API accepts 60,000 ms (1 minute) to 86,400,000 ms (24 hours). A chat with no new message for that long is closed and analysed.

When a chat times out and the agent has a Closing message, that message is added as the last agent message before the chat ends, so it appears in the chat, the transcript and the chat_ended webhook. Without one, the chat closes silently.

The engine's prompt, functions, knowledge bases and dynamic variables work as they do in calls. {{session_type}} is chat and {{chat_id}} holds the chat ID, so one prompt can behave differently in chats. Time variables use the chat agent's Timezone.

Chat lifecycle#

  1. Start. Create chat with chat_agent_id (or weighted chat_agents), plus optional dynamic_variables and metadata. If the engine has a welcome message, it is the first message. The chat_started webhook is sent.
  2. Messages. Create chat completion with the chat ID and the user's message returns the agent's reply, including any function calls and flow node transitions.
  3. End. POST /end-chat/{chat_id}, or the silence timeout. The chat_ended webhook is sent.
  4. Analysis. Post-chat analysis runs and the chat_analyzed webhook is sent with chat_analysis.

The chat object has transcript, message_with_tool_calls (messages, tool_call_invocation items and node_transition items), chat_analysis (chat_summary, chat_successful, user_sentiment and your custom fields) and chat_cost.

curl https://api.tried.com.au/create-chat-completion \
  -H "Authorization: Bearer $TRIED_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "chat_id": "chat_5e1d2c3b4a5968778695a4b3", "content": "Can I move my appointment to Friday?" }'

Test a chat agent#

Test chat on the right of the builder starts a chat as soon as the builder opens, using your latest edits. Function calls appear inline as Ran name. Restart starts a new chat (and shows the pre-chat form again when it is on). End chat closes it so you can check the analysis in Chat History.

Versions#

Chat agents have their own version history, separate from voice agents.

Chat agent versions
  • Publish saves a numbered snapshot of the current settings (Publish chat agent).
  • Versions lists the current draft (Editing) and every published version.
  • Restore copies a published version back into the draft.

Chats always use the chat agent's current settings. Publishing records history; restoring is how you roll back.

A/B tests#

Chat A/B tests split traffic across chat agents, not versions:

  • Give a widget public key two or more chat agents with weights on the Website widget tab. The widget's look comes from the first agent on the key.
  • Or pass chat_agents with weights to create-chat, for example [{ "chat_agent_id": "chat_agent_a...", "weight": 0.5 }, { "chat_agent_id": "chat_agent_b...", "weight": 0.5 }]. Up to 10 agents.

The chosen agent is stored in the chat's metadata.ab_test.

Widget key with weighted chat agents

Website widget#

The Website widget tab manages public keys for the embeddable chat widget. Each key has allowed domains, optional reCAPTCHA, a rate limit and blocked countries. See Deploy for the embed code.

Website widget public keys

Pricing#

A chat is billed for what it uses, on the chat's chat_cost:

Line Product Price (AUD)
Each visitor message, a fixed welcome message, a fixed flow line and the closing message chat_messages $0.003
Each reply the model writes chat_model See below. Never less than $0.003
Each knowledge base search chat_knowledge_base $0.001
Post-chat analysis chat_analysis Priced like a reply, on the analysis model

A written reply costs the model's per-minute price (see LLM options) divided by 12 for each model call it makes. A call that sends more than 4,500 tokens costs proportionally more, counting everything sent (prompt, the chat so far, knowledge base text, function definitions and results) plus each output token four times. A reply that runs a function makes two or more calls. Fast tier adds 50%.

With the default model, a short prompt and a short chat, a reply costs about $0.0083. A 12,000 token prompt makes each reply about 2.7 times that. Tokens are estimated at four characters each.

API#

Action Endpoint
Chat agents POST /create-chat-agent, GET /list-chat-agents, GET /get-chat-agent/{id}, PATCH /update-chat-agent/{id}, DELETE /delete-chat-agent/{id}
From a voice agent POST /convert-agent-to-chat/{agent_id}
Chats POST /create-chat, POST /create-chat-completion, POST /end-chat/{id}, GET /get-chat/{id}, GET /list-chats
Versions POST /publish-chat-agent/{id}, GET /get-chat-agent-versions/{id}, POST /restore-chat-agent-version/{id}/{version}