***

title: rtc_session
slug: /reference/python/agents/livewire/agent-server/rtc-session
description: Decorator that registers the session entrypoint function.
max-toc-depth: 3
---------------------

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

[jobcontext]: /docs/server-sdks/reference/python/agents/livewire/job-context

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

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

Decorator that registers the session entrypoint function. The entrypoint receives
a [`JobContext`][jobcontext] and is
responsible for creating an
[`Agent`][agent],
[`AgentSession`][agentsession], and
calling `session.start()`.

## **Parameters**

<ParamField path="func" type="Optional[Callable]" default="None" toc={true}>
  The entrypoint function. When used as `@server.rtc_session()` with parentheses,
  `func` is `None` and the decorator returns a wrapper. When used as
  `@server.rtc_session` without parentheses, the function is passed directly.
</ParamField>

<ParamField path="agent_name" type="str" default="&#x22;&#x22;" toc={true}>
  A name for the agent. Stored on the server for identification.
</ParamField>

<ParamField path="type" type="str" default="&#x22;room&#x22;" toc={true}>
  Session type. Only `"room"` is supported on SignalWire. Other values are accepted
  for API compatibility but log an informational message.
</ParamField>

<ParamField path="on_request" type="Any" default="None" toc={true}>
  Callback for incoming requests. Accepted for API compatibility.
</ParamField>

<ParamField path="on_session_end" type="Any" default="None" toc={true}>
  Callback for session end. Accepted for API compatibility.
</ParamField>

## **Returns**

`Callable` -- The decorated function, unmodified.

## **Example**

```python {17}
from signalwire.livewire import (
    Agent,
    AgentSession,
    AgentServer,
    JobContext,
    JobProcess,
    run_app,
)

server = AgentServer()

def setup(proc: JobProcess):
    proc.userdata["api_key"] = "sk-..."

server.setup_fnc = setup

@server.rtc_session(agent_name="support-bot")
async def entrypoint(ctx: JobContext):
    await ctx.connect()
    agent = Agent(instructions="You are a support bot.")
    session = AgentSession()
    await session.start(agent, room=ctx.room)

run_app(server)
```