> ## Documentation Index
> Fetch the complete documentation index at: https://docs.liveavatar.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Lifecycle

> The three phases of a FULL Mode LiveAvatar session

## 1. Starting a Session

1. Generate a session token configured for FULL Mode on your backend
2. Pass the token to your frontend application
3. Call the start session endpoint
4. Establish a WebRTC connection to the LiveAvatar-managed room

```mermaid theme={null}
sequenceDiagram
    participant User as End User
    participant Frontend as Developer Frontend
    participant Backend as Developer API
    participant API as LiveAvatar API
    participant Room as LiveAvatar Managed Room

    User->>Frontend: User visits site
    Frontend->>Backend: Start session flow
    Backend->>API: POST /v1/sessions/token
    API-->>Backend: Session-scoped token
    Backend-->>Frontend: Send token back
    User->>Frontend: User starts the session
    Frontend->>API: POST /v1/sessions/start (with token)
    API->>Room: Start room with avatar
    API-->>Frontend: Room client token + session details
    Frontend->>Room: Establish room connection with client token
    Room-->>Frontend: Conversation starts
    Frontend-->>User: User sees avatar conversation
```

<Tip>
  Make sure the session token has `mode` set to `"FULL"`. Token configuration determines which mode initializes.
</Tip>

## 2. Managing the Session

### Session participants

A FULL Mode session is a LiveKit room with three participants: the end user, the LiveAvatar agent, and the avatar. The agent and avatar are both managed by LiveAvatar — they join the room on your behalf.

```mermaid theme={null}
graph LR
    User["End User"]
    subgraph LA["LiveAvatar Managed"]
        Room["LiveKit Room"]
        Agent["Agent"]
        Avatar["Avatar"]
    end
    User <-->|"audio, video, events"| Room
    Room <-->|"events"| Agent
    Room <-->|"avatar stream"| Avatar
    Agent -->|"drives"| Avatar
```

### Session initialization

A session is fully initialized once all three conditions are met:

1. The room is created
2. The avatar joins the room
3. The LiveAvatar agent joins the room

The agent's responsibility is to manage the room and process events. It consumes everything happening inside the LiveKit room and drives the avatar to reflect it.

### Event-driven control

After connecting to the room, session management is entirely **event-driven**. You control the session by sending and receiving events through LiveKit data channels.

Events let you:

* Track speaker state (user speaking, avatar speaking)
* Capture transcript data
* Control avatar behaviors (interrupt, idle, listening)
* Direct avatar responses and audio input processing

### Recommended architecture

We recommend making your **frontend the primary controller** for emitting events from the LiveKit room — this minimizes latency between user interactions and avatar responses. Event data can be relayed to your backend for downstream processing, logging, and analytics.

```mermaid theme={null}
graph LR
    Frontend["Developer Frontend"] <-->|"send/receive events"| Room["LiveAvatar Managed Room"]
    Frontend <-->|"avatar video stream"| Room
    Frontend -->|"relay event data"| Backend["Developer API"]
    Agent["LiveAvatar Agent"] <--> Room
```

## 3. Ending the Session

When the session ends:

1. The LiveKit room closes
2. The avatar leaves the room
3. The user is removed if still present
4. External resources are cleaned up

You can end a session by calling the [Stop Session](/api-reference/sessions/stop-session) endpoint or by the session timing out.

## Next steps

* [Configuration](/docs/full-mode/configuration) — customize avatar, voice, context, and interactivity
* [Events](/docs/full-mode/events) — full reference of command and response events
