Skip to content

Front doors

How people reach your agents: web chat, phone, email, Slack, Teams and the console.

Updated

A front door is a file in your repo, doors/{name}.yml. It says how people reach your agents. A person who comes in through a door starts a conversation. The door sets the first agent, the agents that can take over, the languages, the checks on each message, the limits and the channels.

name: Acme support
entry: support/desk
agents:
  - agent: billing
    when: Invoices, payments, refunds and plan changes.
  - agent: support/tech
    when: Errors, outages and questions about the API.
languages: [en, fr]
guards:
  input:
    - kind: pii
      message: Please do not send personal details in this chat.
router:
  rules:
    - keywords: [invoice, refund, facture]
      agent: billing
session:
  idle_ttl: 30m
  retention: 7d
limits:
  daily_conversations: 500
  per_participant:
    conversations_per_day: 5
channels:
  web:
    origins: [https://www.acme.com]
  phone:
    greeting: 'Hello, you reached Acme support. How can I help?'
  console: {}

Read the doors.yml reference for every key.

The model

Bindings (org state)     a phone number, an embed key, an email alias, a Slack workspace or channel, a Teams tenant or channel
  -> Front door (git)    doors/{name}.yml: entry, agents, languages, variables, guards, router, session, limits, channels
     -> Conversation     cv_...: the person, the transcript, the current agent and run, the session values
        -> Runs          run A (entry) -> run B (handoff) -> run B' (continuation)
  • A binding connects a phone number, an email alias, a Slack workspace, a Teams tenant or a web chat embed key to one door. Bindings are org state, not repo state. Nothing in git names a number or a key.
  • A front door is git state. A push deploys it with the agents.
  • A conversation is one exchange with one person on one channel. It has its own id (cv_...), its own transcript and its own retention.
  • A run does not change. It is one agent, one execution, and the unit of the trace and of billing. A conversation starts runs for its agents.

The door id is {repo}/{name}, for example support/support. The repo name is in the id, not the base path, so a base path change does not change the id.

Channels

A door lists its channels under channels. A channel that is not listed does not reach the door.

Channel How a person reaches the door Binding Read
web A chat on your site, or the hosted chat page. An embed key (rek_...). Web chat
phone A call to a number of the org. A phone number. Phone numbers
email A mail to {org}.{alias}@cloudraker.run. An email alias. Email
slack A mention of @cloudraker in Slack. A Slack workspace, or one of its channels. Slack
teams A message to the CloudRaker bot in Microsoft Teams. A Teams tenant, or one of its channels.
console A test chat in the console, or rakerun conversation start. None. Test in the console

One binding points to one door. One door can have many bindings. To move a binding to another door, unbind it first.

Bind a channel

You need the admin role. Bind on the Channels page of the console, or with the CLI:

rakerun channel bind phone +15145550100 --door support/support
rakerun channel bind email help --door support/support          # help: {org}.help@cloudraker.run
rakerun channel bind slack T0123ABCD --door support/support      # the whole workspace
rakerun channel bind slack T0123ABCD/C0456EFGH --door support/billing   # one channel wins over the workspace
rakerun channel list
rakerun channel unbind email help

Web chat uses embed keys, not channel bindings. Read Web chat.

A binding to a door that does not exist, or to a door without that channel, does not fail a push. The channel then answers door_not_found, and the Channels page shows the binding in red.

Email

Bind an alias to the door. The address is {org}.{alias}@cloudraker.run. The alias matches [a-z0-9][a-z0-9-]{0,30} and is unique in the org.

  • Only a sender whose From passes DMARC is verified. The agent replies only to a verified sender, unless channels.email.reply_unverified is true.
  • channels.email.allow_from lists the senders that can start a conversation. Mail from other senders is dropped with no bounce.
  • Mail with an Auto-Submitted header other than no, or with a List-Id header, is dropped.
  • A reply to an answer continues the same conversation, when it comes from the same sender. A mail from another sender opens a new conversation, also when it names the same thread.
  • The agent sends one reply per turn. A question becomes a numbered list. The person answers with the number or the exact text of a choice.
  • A body over 4,000 characters is cut, with the line [Message cut at 4000 characters.].
  • Attachments become files of the conversation, 5 MB each.

Entry, router and handoff

entry is the first agent of a new conversation. It can be one agent, or one agent per language:

entry:
  en: support/desk
  fr: support/accueil
languages: [en, fr]

agents is the handoff set: the agents that can take over a conversation. The entry agents are in the set without a line in agents. Each agent can have a when text. The router and the agents read it.

Router

The router picks the first agent from the first message of the person. It runs before any model call.

  1. The router.rules run in order. A rule matches when one of its keywords occurs in the message as a whole word or phrase. Case and accents do not matter. The first match wins.
  2. Else, when router.classify is true and at least 2 agents of the set have when text, a classifier scores the message against each when text. The top agent wins when its score is at least router.threshold (default 0.5), or at least router.min (default 0.3) and router.margin (default 2.5) times the second score.
  3. Else the entry agent starts.

A failed classifier call gives the entry agent. The router and the input checks run at the same time. When a check refuses the message, the router result is dropped.

Handoff

An agent of a door gets the tool handoff(to, reason). to is another agent of the handoff set. The current run ends with run.cancelled and by: handoff. A new run of the target agent starts at once, with the transcript and the line Handoff from {agent}: {reason}. The person stays on the same connection, and gets a handoff item.

  • A conversation hands off at most 3 times per message of the person. After the third handoff, the tool is not offered until the next message.
  • The reason is model text. Only console viewers see it. Other channels get the handoff item with reason: null.
  • A handoff never leaves the repo of the door.

Languages

When the door lists 2 or more languages, the agents get the tool switch_language(to). It sets the session language lang. When entry maps languages to agents and the agent of the new language is another agent, the switch is a handoff to that agent. A web chat can set lang when it starts the conversation. On a call, the voice changes its transcription language.

Session variables

variables declares typed values that the client sets, for example a reading level:

variables:
  simple: { type: boolean, default: false, description: Use plain words and short sentences. }
  plan: { type: enum, values: [free, pro, enterprise] }

The types are boolean, number (with min and max) and enum. There is no free text type, so no text from the client reaches the prompt this way. The run input gets one line before the message of the person, for example Session: lang=fr; simple=true. This line is never in the transcript, the events or the checks. lang is reserved.

Guards

Guards check the messages of the person and the replies of the agents. They use CloudRaker decision models, not your agent model. Guard calls are not billed in the beta.

Input checks

guards.input checks each message of the person before any model call. A refused message never reaches a model, is not kept, and gets a blocked item with the kinds that matched.

Kind What it checks
pii Personal details: names, health insurance numbers, addresses, postal codes, phone numbers, email addresses, dates of birth, file numbers and other identifiers. Fixed patterns run first, then a model.
decision A yes or no question about the message, with a statement, a when_true and a when_false text.
regex A pattern on the text. No model call.

A check that cannot run (time out, error) refuses the message with messages.unavailable. Set fail: open on a check to let the message pass instead.

The input checks do not read files. A door with guards.input refuses files unless guards.files is allow.

Output checks

guards.output checks each reply of an agent before the person sees it.

  • hold: reply (default): the person sees nothing until the whole reply passes.
  • hold: sentence: the reply streams one checked sentence at a time.

When a check flags a reply, the reply is dropped. The agent gets a new turn with the rewrite text of the check: The person did not see your last reply. {rewrite} Write the reply again. After strikes flagged replies in a row (default 3) for one message, the conversation ends with end_message. A reply that passes sets the count back to 0.

On a door with output checks, every text that the person sees is checked: questions with their choices, the fallback text of UI components and the data of custom events. Agent files do not go to the person. Only the console sees them.

Session and retention

Key Default Rule
session.idle_ttl 30m 1m to 30d. An open conversation with no input for this time ends with reason idle.
session.retention 30d 1m to 90d. The conversation and its runs are deleted this time after the conversation ends. Minutes give zero data retention.
session.max_turns 200 1 to 1000. At the limit, the conversation ends with reason max_turns.

After the retention, the transcript, the items and the identity of the person are deleted. A stub with the counts, the credits and the cost stays for 90 days. Read Conversations.

The door retention replaces the retention and idle_ttl of the agents for the runs of its conversations.

Limits and the kill switch

Key Rule
limits.daily_credits The credits of the door per UTC day. At the cap, the next message ends the conversation with at_capacity.
limits.daily_conversations New conversations per UTC day.
limits.per_participant.conversations_per_day New conversations per person per UTC day (1 to 1000).
limits.per_participant.turns_per_minute Messages per person per minute (1 to 60), over all their conversations of the door.

A cap gives the person the messages.at_capacity text. A web start answers 429 at_capacity. A call hears the text, then the call ends. A person is a web visitor IP address (IPv6 by its /64), a caller number, a sender address, or a Slack, Teams or console user. The platform stores only a keyed hash of it.

The kill switch closes a door at once. Turn it on in the console door page, or with rakerun door switch support/support --on --message "Back at 9 AM.". Open conversations end with reason maintenance. New ones get the message, or messages.maintenance. A web start answers 503 door_unavailable. Turn it off with --off.

Alerts

Set alerts.webhook to an org secret that holds an HTTPS URL. The platform posts when the error rate of the door is high, and again when it goes back to normal.

alerts:
  webhook: ${secret:INCIDENT_WEBHOOK_URL}
  token: ${secret:INCIDENT_WEBHOOK_TOKEN}   # optional, sent as Authorization: Bearer
  • An error is a turn that ends in run.failed, or a guard that cannot run.
  • The alert fires when the last 5 minutes have 10 errors or more, and 25 % or more of the turns failed. It resolves under 5 %. After a resolve, it waits 30 minutes before it fires again.
  • The body follows the incident.io HTTP alert source format: title, description, deduplication_key, status (firing or resolved), source_url and metadata with the counts. It never holds text of a conversation.

Test in the console

The console opens a chat with any agent through an implicit door: the agent is the entry, with no guards, no router and no limits. To test a file door with its router, guards and handoffs, add channels.console: {}. Then open the door in the console, or:

rakerun conversation start --door support/support --input "My invoice is wrong" --stream

On the console channel, approvals work as in a console chat. On every other channel, no person can approve a tool call. A run that needs an approval there fails the call with approval_unavailable. Lint warns with door_agent_approvals.

Deployments and previews

  • Doors deploy with the push, all or none, as agents do. A conversation keeps the door version of its start.
  • Only the live deployment of the default branch has doors. A preview has no doors, no bindings and no calls. Preview hosts answer 404 on /_cv and /_chat. The console channel can still test an agent of a preview branch.
  • doors/ is a reserved folder. It never holds an agent.

The console

  • Front doors lists the doors with their channels, the switch, the alert state and the counts of today. A door page shows the guards, the router, the agents, the session, the limits, the bindings, the recent conversations and the YAML. An admin edits the YAML there. The save is a commit.
  • Channels lists every binding of the org. An admin binds and unbinds there.
  • Embed on a door page manages its web chat keys and shows a preview.

Agents of a door

  • An agent of a door with channels.phone must be mode: turns (lint door_phone_needs_turns).
  • Runs of a conversation get the metadata keys conversation_id, door, channel and end_user. Run sets them. A caller cannot.
  • metadata.end_user scopes Structured Memory records. A verified person (a verified email sender, a Slack, Teams or console user) gives a stable value. Every other person gives a value per conversation, for example phone:cv:{conversation id}. Two calls from the same number never share records.
  • A conversation run with workspace_act_as and as.from: sender acts as the Slack, Teams or verified email sender. The agent must be in a door with channels.slack, channels.teams or channels.email. With email, the door also needs channels.email.allow_from (lint act_as_identity_source).

Type to search…

↑↓ navigate↵ selectEsc close