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

# Infrastructure

> JobContext, JobProcess, and Room stubs for connection lifecycle.

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

[runapp]: /docs/server-sdks/reference/python/agents/livewire/run-app

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

These classes mirror the LiveKit infrastructure types used in agent entrypoints.
On SignalWire, connection lifecycle and room management are handled automatically
by the control plane, so these are lightweight stubs that maintain API compatibility.

## JobContext

Mirrors a LiveKit `JobContext`. Provides access to the room and process objects,
and lifecycle methods that the entrypoint calls before starting a session.

```python
from signalwire.livewire import JobContext

async def entrypoint(ctx: JobContext):
    await ctx.connect()
    await ctx.wait_for_participant()
    # ctx.room and ctx.proc are available
```

### Properties

**`room`** `Room`

A [`Room`](#room) stub instance.

---

**`proc`** `JobProcess`

A [`JobProcess`](#jobprocess) instance with a `userdata` dict, populated by the
setup function if one was registered on
[`AgentServer`][agentserver].

---

### Methods

#### connect

**connect**() -> `None`

No-op. SignalWire's control plane handles connection lifecycle automatically. The
agent connects when the platform invokes the SWML endpoint.

---

#### wait\_for\_participant

**wait\_for\_participant**(`identity=None`) -> `None`

No-op. SignalWire handles participant management automatically.

**`identity`** `Optional[str]` — default: None

Participant identity to wait for. Accepted for API compatibility.

---

---

## JobProcess

Mirrors a LiveKit `JobProcess`. Used for prewarm and setup tasks. The setup
function registered on
[`AgentServer.setup_fnc`][agentserver-setupfnc]
receives a `JobProcess` instance.

```python
from signalwire.livewire import JobProcess

def on_setup(proc: JobProcess):
    proc.userdata["db_connection"] = connect_to_db()
```

### Properties

**`userdata`** `dict[str, Any]`

Arbitrary data dict for sharing state between the setup function and the
entrypoint. Defaults to an empty dict.

---

---

## Room

A stub representing the LiveKit room abstraction. On SignalWire, rooms are
managed by the control plane and this object is a placeholder for API
compatibility.

### Properties

**`name`** `str` — default: "livewire-room"

The room name. Always `"livewire-room"` in the current implementation.

---

#### Example

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

server = AgentServer()

def setup(proc: JobProcess):
    # Pre-warm: load config, connect to databases, etc.
    proc.userdata["greeting"] = "Welcome to Acme Corp!"

server.setup_fnc = setup

@server.rtc_session()
async def entrypoint(ctx: JobContext):
    await ctx.connect()
    await ctx.wait_for_participant()

    greeting = ctx.proc.userdata.get("greeting", "Hello!")

    agent = Agent(instructions="You are a helpful assistant.")
    session = AgentSession()
    await session.start(agent, room=ctx.room)
    session.say(greeting)

run_app(server)
```