# livekit-examples/outbound-caller-python architecture

> Architecture diagram of the GitHub repository livekit-examples/outbound-caller-python, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-29). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/livekit-examples/outbound-caller-python
- Repository: https://github.com/livekit-examples/outbound-caller-python

## Overview

This is a compact LiveKit Python example for placing an AI-driven outbound appointment call. A dispatch supplies the phone and transfer numbers; the worker connects a room, starts the voice session, and dials through SIP. The agent handles appointment conversation, availability and confirmation tools, voicemail, call ending, and confirmed human transfer. The source is concentrated in `agent.py`; the README documents model alternatives and capabilities, while the sampled implementation uses placeholder appointment and availability data rather than a scheduling store.

Main entry points: [`agent.py`](https://github.com/livekit-examples/outbound-caller-python/blob/main/agent.py) (Outbound caller)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_call_flow["Outbound call flow"]
  node_worker["LiveKit worker<br/>[agent.py]"]
  node_entrypoint["Call entrypoint<br/>[agent.py]"]
  node_room["LiveKit room"]
end

subgraph group_voice_agent["Voice agent"]
  node_session["Agent session<br/>[agent.py]"]
  node_caller_agent["Outbound caller<br/>[agent.py]"]
end

subgraph group_call_actions["Call actions"]
  node_availability["Availability lookup<br/>[agent.py]"]
  node_confirmation["Appointment confirmation<br/>[agent.py]"]
  node_voicemail["Voicemail detection<br/>[agent.py]"]
  node_call_ending["End call<br/>[agent.py]"]
  node_transfer["Human transfer<br/>[agent.py]"]
end

subgraph group_integrations["External services"]
  node_dialer["SIP dialer"]
  node_speech_models["Speech and language models"]
  node_noise_cancellation["Noise cancellation"]
end

node_dispatcher(("Dispatch requester"))
node_patient(("Patient"))
node_human_operator(("Human operator"))

node_dispatcher -->|"dispatches job"| node_worker
node_worker -->|"runs"| node_entrypoint
node_entrypoint -->|"connects"| node_room
node_entrypoint -->|"creates"| node_caller_agent
node_entrypoint -->|"starts"| node_session
node_entrypoint -->|"requests outbound call"| node_dialer
node_dialer -->|"calls"| node_patient
node_session -->|"joins"| node_room
node_session -->|"runs agent"| node_caller_agent
node_session -->|"uses STT, LLM, TTS"| node_speech_models
node_session -->|"uses"| node_noise_cancellation
node_patient -->|"provides voice"| node_session
node_caller_agent -->|"invokes"| node_availability
node_caller_agent -->|"invokes"| node_confirmation
node_caller_agent -->|"invokes"| node_voicemail
node_caller_agent -->|"invokes"| node_call_ending
node_caller_agent -->|"invokes"| node_transfer
node_transfer -->|"requests SIP transfer"| node_dialer
node_dialer -->|"transfers call"| node_human_operator
node_voicemail -->|"deletes room"| node_room
node_call_ending -->|"deletes room"| node_room
node_transfer -->|"deletes on failure"| node_room

click node_worker "https://github.com/livekit-examples/outbound-caller-python/blob/main/agent.py"
click node_entrypoint "https://github.com/livekit-examples/outbound-caller-python/blob/main/agent.py"
click node_session "https://github.com/livekit-examples/outbound-caller-python/blob/main/agent.py"
click node_caller_agent "https://github.com/livekit-examples/outbound-caller-python/blob/main/agent.py"
click node_availability "https://github.com/livekit-examples/outbound-caller-python/blob/main/agent.py"
click node_confirmation "https://github.com/livekit-examples/outbound-caller-python/blob/main/agent.py"
click node_voicemail "https://github.com/livekit-examples/outbound-caller-python/blob/main/agent.py"
click node_call_ending "https://github.com/livekit-examples/outbound-caller-python/blob/main/agent.py"
click node_transfer "https://github.com/livekit-examples/outbound-caller-python/blob/main/agent.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_worker,node_entrypoint,node_room toneBlue
class node_session,node_caller_agent toneAmber
class node_availability,node_confirmation,node_voicemail,node_call_ending,node_transfer,node_dispatcher toneMint
class node_dialer,node_speech_models,node_noise_cancellation toneRose
class node_patient,node_human_operator toneIndigo
```

## Components

### Outbound call flow

- [LiveKit worker](https://github.com/livekit-examples/outbound-caller-python/blob/main/agent.py): `agent.py`
- [Call entrypoint](https://github.com/livekit-examples/outbound-caller-python/blob/main/agent.py): `agent.py`
- **LiveKit room**

### Voice agent

- [Agent session](https://github.com/livekit-examples/outbound-caller-python/blob/main/agent.py): `agent.py`
- [Outbound caller](https://github.com/livekit-examples/outbound-caller-python/blob/main/agent.py): `agent.py`

### Call actions

- [Availability lookup](https://github.com/livekit-examples/outbound-caller-python/blob/main/agent.py): `agent.py`
- [Appointment confirmation](https://github.com/livekit-examples/outbound-caller-python/blob/main/agent.py): `agent.py`
- [Voicemail detection](https://github.com/livekit-examples/outbound-caller-python/blob/main/agent.py): `agent.py`
- [End call](https://github.com/livekit-examples/outbound-caller-python/blob/main/agent.py): `agent.py`
- [Human transfer](https://github.com/livekit-examples/outbound-caller-python/blob/main/agent.py): `agent.py`

### External services

- **SIP dialer**
- **Speech and language models**
- **Noise cancellation**

### Other components

- **Dispatch requester**
- **Patient**
- **Human operator**

## Connections

- Dispatch requester → LiveKit worker: dispatches job
- LiveKit worker → Call entrypoint: runs
- Call entrypoint → LiveKit room: connects
- Call entrypoint → Outbound caller: creates
- Call entrypoint → Agent session: starts
- Call entrypoint → SIP dialer: requests outbound call
- SIP dialer → Patient: calls
- Agent session → LiveKit room: joins
- Agent session → Outbound caller: runs agent
- Agent session → Speech and language models: uses STT, LLM, TTS
- Agent session → Noise cancellation: uses
- Patient → Agent session: provides voice
- Outbound caller → Availability lookup: invokes
- Outbound caller → Appointment confirmation: invokes
- Outbound caller → Voicemail detection: invokes
- Outbound caller → End call: invokes
- Outbound caller → Human transfer: invokes
- Human transfer → SIP dialer: requests SIP transfer
- SIP dialer → Human operator: transfers call
- Voicemail detection → LiveKit room: deletes room
- End call → LiveKit room: deletes room
- Human transfer → LiveKit room: deletes on failure
