> This page is for Server SDKs.

> Fetch clean Markdown by appending `.md` to any page URL under https://signalwire.com/docs or requesting it with the HTTP header `Accept: text/markdown`. The root index at https://signalwire.com/docs/llms.txt lists the available documentation indexes.

# rtc_session

> Decorator that registers the session entrypoint function.

[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**

**`func`** `Callable | None` — default: None

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.

---

**`agent_name`** `str` — default: ""

A name for the agent. Stored on the server for identification.

---

**`type`** `str` — default: "room"

Session type. Only `"room"` is supported on SignalWire. Other values are accepted
for API compatibility but log an informational message.

---

**`on_request`** `Any` — default: None

Callback for incoming requests. Accepted for API compatibility.

---

**`on_session_end`** `Any` — default: None

Callback for session end. Accepted for API compatibility.

---

## **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)
```