***

title: on_user_turn_completed
slug: /reference/python/agents/livewire/agent/on-user-turn-completed
description: Lifecycle hook called when the user finishes speaking.
max-toc-depth: 3
---------------------

For a complete index of all SignalWire documentation pages, fetch https://signalwire.com/docs/llms.txt

Lifecycle hook called when the user finishes speaking. Override in a subclass to
inspect or modify the conversation before the LLM generates a reply.

## **Parameters**

<ParamField path="turn_ctx" type="Any" default="None" toc={true}>
  Turn context object. Accepted for API compatibility.
</ParamField>

<ParamField path="new_message" type="Any" default="None" toc={true}>
  The new message from the user. Accepted for API compatibility.
</ParamField>

## **Returns**

`None`

## **Example**

```python {6}
from signalwire.livewire import Agent, AgentSession, AgentServer, JobContext, run_app

server = AgentServer()

class LoggingAgent(Agent):
    async def on_user_turn_completed(self, turn_ctx=None, new_message=None):
        print(f"User finished speaking.")
        print(f"Conversation history: {self.session.history}")

@server.rtc_session()
async def entrypoint(ctx: JobContext):
    await ctx.connect()
    agent = LoggingAgent(instructions="You are a helpful assistant.")
    session = AgentSession()
    await session.start(agent, room=ctx.room)

run_app(server)
```