> This page is for Server SDKs.

> Fetch clean Markdown by appending `.md` to any page URL under https://signalwire.com/docs or requesting it with the HTTP header `Accept: text/markdown`. The root index at https://signalwire.com/docs/llms.txt lists the available documentation indexes.

# FrontDeskAgent

> A business's front desk that puts callers through to open departments, books appointments, takes messages, and answers from documents.

[service-agent]: /docs/server-sdks/reference/python/agents/operations/service-agent

[operations]: /docs/server-sdks/reference/python/agents/operations/operations

[appointments]: /docs/server-sdks/reference/python/agents/operations/appointments

[messages]: /docs/server-sdks/reference/python/agents/operations/messages

[info-bot]: /docs/server-sdks/reference/python/agents/operations/info-bot-knowledge

[wording]: /docs/server-sdks/reference/python/agents/operations/wording

[connect]: /docs/server-sdks/reference/python/agents/function-result/connect

`FrontDeskAgent` is a business's front desk, built on [`ServiceAgent`][service-agent].
It puts callers through to the department they ask for while that department takes
calls, books appointments, takes messages, and answers from documents, each when you
give it the matching part.

The departments become a `transfer_to_human` tool with a `to` argument listing the
department names. The tool runs as soon as the caller names a department, without
first asking whether they want a person. An open department is reached with a
permanent [`connect`][connect] transfer (`final=True`), so the call leaves the agent. A closed
department, or a request from a chat, is refused, and the model offers a message when
there's a `Messages` pack.

```python
from signalwire.prefabs import Department, FrontDeskAgent
```

## Parameters

**`name`** `str` — default: front_desk

The agent's name.

---

**`role`** `str` — required

Keyword-only, as are all the parameters below. Who the agent is and how it sounds.
Becomes the prompt's Role section.

---

**`departments`** `Mapping[str, Department] | None` — default: None

Where callers can be put through to, keyed by the name callers use for each.

---

**`appointments`** `Appointments | None` — default: None

An [`Appointments`][appointments] pack, to book appointments.

---

**`messages`** `Messages | None` — default: None

A [`Messages`][messages] pack, to take messages and to offer one when a department
isn't taking calls.

---

**`knowledge`** `InfoBotKnowledge | None` — default: None

An [`InfoBotKnowledge`][info-bot] to answer from the business's documents. Offered
before the caller is identified.

---

**`caller_id`** `str | None` — default: None

The number calls put through come from. The platform's default when `None`.

---

**`desk_wording`** `Mapping[str, str] | None` — default: None

Replacements for the desk's own words, keyed like `FrontDeskAgent.WORDING`. See
[wording][wording].

---

**`**kwargs`** `Any`

`ServiceAgent`'s arguments: every [`Operations`][operations] keyword argument
(`rules`, `wording`, `currency`, `medium`, and the rest) and every `AgentBase`
argument.

---

## Department

`Department(description, to, open=None)` is a frozen dataclass for one place the desk
puts callers through to.

**`Department.description`** `str` — required

What callers go to it for, as the model reads it: "questions about a bill".

---

**`Department.to`** `str` — required

Where the call goes: a phone number in E.164 form, or a SIP address.

---

**`Department.open`** `Callable[[CallContext], bool] | None` — default: None

`open(call)` returns whether the department takes calls now. May be `async`. `None`
means always.

---

## Example

```python
from signalwire.operations import Messages
from signalwire.prefabs import Department, FrontDeskAgent


def billing_open(call):
    return True  # replace with your own business-hours check


desk = FrontDeskAgent(
    role="You answer the phone for Bayside Dental. You are warm and brief.",
    departments={
        "billing": Department("questions about a bill", "+15550100001", open=billing_open),
    },
    messages=Messages(save=lambda call, message: print(message)),
)

if __name__ == "__main__":
    desk.run()
```