Skip to content

doors.yml reference

Every key of a front door file.

Updated

A front door is one file, doors/{name}.yml, at the root of a Run repo. The name matches [a-z0-9][a-z0-9-]{0,62}. The door id is {repo}/{name}. Read Front doors for the concepts. An unknown key fails lint with door_invalid.

Full example

name: Acme support                # display name, 1 to 80 characters
description: Questions about orders, invoices and the API.
entry:                            # one agent, or one agent per language
  en: support/desk
  fr: support/accueil
agents:                           # the handoff set; the entry agents are in it
  - billing
  - agent: support/tech
    when: Errors, outages and questions about the API.
languages: [en, fr]
variables:
  simple: { type: boolean, default: false, description: Use plain words. }
  plan: { type: enum, values: [free, pro, enterprise] }

guards:
  input:
    - kind: pii
      types: [person_name, health_insurance_number, email_address, phone_number]
      message: Please do not send personal details in this chat.
    - kind: decision
      name: medical_advice
      statement: The message asks for a diagnosis or a treatment.
      when_true: The person asks what illness they have, or what medicine to take.
      when_false: The person asks about opening hours, prices or an appointment.
      threshold: 0.6
    - kind: regex
      name: card_number
      pattern: '\b(?:\d[ -]?){13,16}\b'
  files: refuse
  output:
    hold: reply
    strikes: 3
    end_message: This conversation has ended. Please call us.
    checks:
      - kind: decision
        name: advice
        statement: The reply gives medical advice.
        when_true: The reply names a diagnosis, a medicine or a dose.
        when_false: The reply gives general information or points to a clinic.
        rewrite: Do not give medical advice. Point the person to a clinic.

router:
  rules:
    - keywords: [invoice, refund, facture]
      agent: billing
  classify: true
  threshold: 0.5
  min: 0.3
  margin: 2.5

session:
  idle_ttl: 30m
  retention: 7d
  max_turns: 200

limits:
  daily_credits: 50000
  daily_conversations: 500
  per_participant:
    turns_per_minute: 10
    conversations_per_day: 5

messages:
  at_capacity: We cannot take new conversations right now. Please try again later.
  maintenance: This service is not available right now. Please try again later.
  unavailable: We could not check your message. Please try again.

alerts:
  webhook: ${secret:INCIDENT_WEBHOOK_URL}
  token: ${secret:INCIDENT_WEBHOOK_TOKEN}

channels:
  web:
    origins: [https://www.acme.com, https://*.acme.com]
    greeting: Hello. How can we help?
    files: false
    theme: { accent: '#5361c1', radius: 12px, font: system }
    gate:
      title: Before you start
      body: This chat is an automated assistant. Do not send personal details.
      accept: I understand
      links:
        - { label: Privacy policy, url: https://www.acme.com/privacy }
    events: [booking_confirmed]
  phone:
    greeting: 'Hello, you reached Acme support. How can I help?'
    voice: marin
    transfers:
      sales: { number: '+15145550123', label: 'the sales team' }
  email:
    allow_from: ['@acme.com', partner@example.com]
    reply_all: false
  slack:
    access: { users: members, channels: any }
    follow_ups: true
    history_limit: 20
  teams:
    follow_ups: true
  console: {}

Door

Key Type Default Rule
name string, 1 to 80 characters Required. The display name, for example the title of the hosted chat page.
description string, 1 to 300 characters none Shown in the console.
entry agent path, or a map of language to agent path Required. The first agent of a new conversation. A map key must be in languages.
agents list, at most 20 entries [] The handoff set. An entry is an agent path, or {agent, when} with when 1 to 200 characters. The entry agents are in the set.
languages list of 1 to 10 language tags none For example en, fr, fr-CA. The first one is the default. With 2 or more, the agents get switch_language.
variables map, at most 16 names none Session values that the client sets. Read Variables.

Every agent path names an agent of the same repo.

Variables

A name matches [a-z][a-z0-9_]{0,31}. lang is reserved.

Type Keys A valid value
boolean default, description true or false
number min, max, default, description A number from min to max
enum values (1 to 20, each at most 40 characters), default, description One of values

description is 1 to 200 characters. A value that does not match its type or range is refused with invalid_item, or invalid_request at the start.

guards

Key Type Default Rule
guards.input list of checks, at most 8 none Checks on each message of the person, before any model call.
guards.files refuse or allow refuse With guards.input, files are refused (unsupported_item) unless this is allow. The checks do not read files.
guards.output.checks list of 1 to 8 checks Required in output. Checks on each reply of an agent.
guards.output.hold reply or sentence reply reply: nothing shows before the whole reply passes. sentence: checked sentences stream.
guards.output.strikes integer, 1 to 10 3 Flagged replies in a row for one message before the conversation ends with reason guard.
guards.output.end_message string, 1 to 500 characters This conversation has ended. Thank you. The text of the ended item after the strikes.

Checks

Every check has a kind and a name ([a-z][a-z0-9_]{0,31}). Two checks of one side cannot have the same name. An input check can set message, the text the person sees with blocked (1 to 500 characters). An output check needs rewrite (1 to 500 characters), the instruction for the rewrite turn.

Kind Keys Flags when
pii name (default pii), types, threshold (default 0.5), fail The fixed patterns match, or the model finds an entity of types with a probability at or above threshold.
decision name, statement (max 300), when_true (max 600), when_false (max 600), threshold (default 0.5), fail The probability that statement is true is at or above threshold.
regex name, pattern (max 500 characters), flags (i or empty, default i) The pattern matches. It compiles as a JavaScript regex with the u flag.

threshold is 0.05 to 0.99. fail is closed (default: a check that cannot run refuses the message) or open (the check passes).

types of a pii check (default: all):

Type Examples
person_name A first or last name of a person. Not a clinic, a store, a street or a city.
health_insurance_number A RAMQ number.
street_address An address with a civic number.
postal_code A full Canadian postal code. The first 3 characters alone pass.
phone_number A 10-digit number. Toll-free numbers, 811 and 911 pass.
email_address An email address.
date_of_birth A full date after a birth keyword.
file_number A file, chart, case or reference number.
other_identifier A SIN and other ids.

Text over 20,000 characters is checked in parts. An empty message passes with no call.

router

Key Type Default Rule
router.rules list, at most 20 none {keywords, agent}. keywords is 1 to 50 strings of at most 60 characters. agent must be in the handoff set.
router.classify boolean true Score the first message against the when texts. Needs 2 agents with when, else it is skipped.
router.threshold number, 0.05 to 0.99 0.5 A score at or above it wins.
router.min number, 0.05 to 0.99 0.3 A lower score wins when it is also margin times the second score.
router.margin number, 1 to 10 2.5

Without a router key, the entry agent takes every new conversation.

session

Key Type Default Rule
session.idle_ttl duration, 1m to 30d 30m An open conversation with no input for this time ends with reason idle. A web session token also expires after it.
session.retention duration, 1m to 90d 30d The time after the end before the content is deleted, for the conversation and its runs.
session.max_turns integer, 1 to 1000 200 Messages of the person. At the limit, the conversation ends with reason max_turns.

limits

Key Type Rule
limits.daily_credits integer, 1 or more Credits of all the runs of the door per UTC day.
limits.daily_conversations integer, 1 or more New conversations per UTC day.
limits.per_participant.turns_per_minute integer, 1 to 60 Messages per person per minute.
limits.per_participant.conversations_per_day integer, 1 to 1000 New conversations per person per UTC day.

A limit that is not set does not apply. The plan limits always apply.

messages

Key Default When
messages.at_capacity We cannot take new conversations right now. Please try again later. A limit of the door is reached.
messages.maintenance This service is not available right now. Please try again later. The kill switch is on.
messages.unavailable We could not check your message. Please try again. A fail: closed check cannot run.

Each one is 1 to 500 characters.

alerts

Key Type Rule
alerts.webhook secret reference Required in alerts. An org secret that holds the HTTPS URL. Lint door_alert_secret.
alerts.token secret reference Optional. Sent as Authorization: Bearer {token}.

Read Alerts.

channels

Required. A channel key that is not set does not reach the door. An empty channels gives the warning door_no_channel.

channels.web

Key Type Default Rule
channels.web.origins list of 1 to 20 origins Required. https://host[:port] or https://*.domain. No path. Only these pages can start a chat.
channels.web.greeting string, 1 to 500 characters none Shown before the first message. It is not a model call.
channels.web.files boolean false true shows the upload control. A door with guards.input also needs guards.files: allow.
channels.web.theme object none background, foreground, accent, accent_foreground, muted, border (hex colors), radius (0 to 32px or 2rem), font (system, serif or mono).
channels.web.gate object none A notice to accept before the first message: title (max 120), body (Markdown, max 2000), accept (max 40, default Accept), links (max 5 {label, url}, HTTPS).
channels.web.events list of at most 20 event names none Custom event.{name} names that the page gets as event items.

A wildcard on a shared host suffix fails lint with door_origin_shared_suffix: *.github.io, *.pages.dev, *.workers.dev, *.vercel.app, *.netlify.app, *.web.app, *.firebaseapp.com, *.herokuapp.com, *.cloudraker.run and public suffixes such as *.com or *.co.uk. Read Web chat.

channels.phone

Every key is optional. Read Phone numbers.

Key Type Default
channels.phone.greeting string, max 600 characters Hello, you reached {name}. How can I help?
channels.phone.record boolean true
channels.phone.voice voice name marin
channels.phone.language BCP 47 tag the caller language
channels.phone.style string, max 500 characters none
channels.phone.turn_timeout duration, 5s to 60s 8s
channels.phone.max_duration duration, 1m to 60m 20m
channels.phone.after_call boolean true
channels.phone.transfers.{name} {number, label} none
channels.phone.outbound boolean false

channels.email

Key Type Default Rule
channels.email.allow_from list of at most 50 addresses or @domain none (anyone) Only these senders start or continue a conversation. Only a DMARC-verified From can match.
channels.email.allow_to list of at most 50 addresses or @domain none (anyone) A reply goes only to these addresses.
channels.email.reply_all boolean false true also replies to every original To and Cc address.
channels.email.reply_unverified boolean false true also replies to a sender that DMARC does not verify.

A reply goes to at most 50 addresses. It carries Auto-Submitted: auto-replied, so two agents cannot answer each other in a loop. Read Email.

channels.slack and channels.teams

Key Type Default Rule
access.users members, any or a list members A list holds user ids, emails and groups (@finance).
access.channels any or a list any Channel names or ids. A list denies direct messages unless it holds im.
access.external boolean false Users and channels of another workspace or tenant.
access.guests boolean false Guests.
follow_ups boolean true true: every reply of the person in the thread goes to the agent. false: only replies that mention the bot.
history_limit integer, 0 to 100 20 Earlier thread messages that a new conversation reads.

Read Slack.

channels.console

channels.console: {} lets the console and rakerun conversation start open a test chat on the door. It takes no keys and needs no binding.

Lint rules

Lint runs on push, as for agent.yml. A binding to a missing door is not a lint error: the channel answers door_not_found.

Rule Level Cause
door_invalid error A YAML or schema error. The message has the key path.
door_name_invalid error The file name does not match [a-z0-9][a-z0-9-]{0,62}.
door_unknown_agent error entry, agents[] or router.rules[].agent names no agent of the repo.
door_router_agent_not_in_set error A router rule names an agent that is not in the handoff set.
door_entry_lang_unknown error A key of the entry map is not in languages.
door_entry_lang_missing warning A language has no entry agent. It falls back to the agent of the first language.
door_variable_reserved error A variable is named lang.
door_variable_default error A default does not match its type, range or values.
door_variable_type error A variable has type: string. Use enum.
door_regex_invalid error A regex pattern does not compile, or is over 500 characters.
door_check_name_duplicate error Two checks of one side have the same name.
door_origin_invalid error An origin is not https://host[:port] or https://*.domain.
door_origin_shared_suffix error A wildcard origin on a shared host suffix.
door_theme_invalid error A theme value fails its pattern.
door_phone_output_guard warning guards.output and channels.phone are both set. The voice speaks before the check.
door_phone_needs_turns error An agent of a door with channels.phone is not mode: turns.
phone_number_format error A transfer number is not E.164, not a US or CA number, or a premium number.
phone_text_length error greeting over 600 or style over 500 characters.
phone_voice error A voice that is not one of the ten voices.
phone_durations error turn_timeout out of 5s to 60s, or max_duration out of 1m to 60m.
door_classify_no_when warning router.classify is on, but fewer than 2 agents have when text. The classifier is skipped.
door_no_channel warning channels is empty.
door_alert_secret error alerts.webhook or alerts.token is not a secret reference.
door_agent_approvals warning An agent of a door without channels.console has approvals that need a person. No person can approve there.

Type to search…

↑↓ navigate↵ selectEsc close