***

title: on_enter
slug: /reference/python/agents/livewire/agent/on-enter
description: Lifecycle hook called when the agent enters a session.
max-toc-depth: 3
---------------------

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

[agentsession]: /docs/server-sdks/reference/python/agents/livewire/agent-session

Lifecycle hook called when the agent enters a session. Override in a subclass to
run custom initialization logic when the agent is first bound to an
[`AgentSession`][agentsession].

## **Parameters**

None.

## **Returns**

`None`

## **Example**

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

server = AgentServer()

class GreeterAgent(Agent):
    async def on_enter(self):
        if self.session:
            self.session.say("Welcome! I just started up.")

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

run_app(server)
```