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

# AgentSession

> Agent_Session utilities for livekit real-time communication integration utilities.

[View module source on GitHub](https://github.com/maximhq/maxim-py/blob/main/maxim/logger/livekit/agent_session.py)

#### intercept\_session\_start

```python theme={null}
def intercept_session_start(self: AgentSession, room, room_name, agent: Agent)
```

This function is called when a session starts.
This is the point where we create a new session for [Maxim](/sdk/python/references/maxim).
The session info along with room\_id, agent\_id, etc is stored in the thread-local store.

#### intercept\_update\_agent\_state

```python theme={null}
def intercept_update_agent_state(self, new_state)
```

This function is called when the agent state is updated.

#### intercept\_generate\_reply

```python theme={null}
def intercept_generate_reply(self, instructions)
```

This function is called when the agent generates a reply.

#### intercept\_user\_state\_changed

```python theme={null}
def intercept_user_state_changed(self, new_state)
```

This function is called when the user state is changed.

#### handle\_tool\_call\_executed

```python theme={null}
def handle_tool_call_executed(self, event: FunctionToolsExecutedEvent)
```

This function is called when the agent executes a tool call.
