> 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.

# run_app

> Main entry point that starts a LiveWire agent server.

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

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

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

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

### run_app

**run_app**(`server`) -> `None`

The main entry point for a LiveWire application. It prints the ASCII banner,
runs the setup function (if registered on the server), creates a
[`JobContext`][jobcontext], invokes the
registered entrypoint, prints a random tip, and starts the underlying SignalWire agent.

This mirrors `livekit.agents.cli.run_app`. It is also available as `cli_ns.run_app`.

#### Parameters

**`server`** `AgentServer` — required

The [`AgentServer`][agentserver] instance
with a registered entrypoint.

---

#### Returns

`None` -- This function blocks while the agent is running.

#### Lifecycle

1. Prints the LiveWire ASCII banner to stderr.
2. If `server.setup_fnc` is set, calls it with a fresh
   [`JobProcess`][jobprocess] instance.
3. Creates a [`JobContext`][jobcontext].
4. Calls the entrypoint registered via
   [`@server.rtc_session()`][server-rtc-session].
   If the entrypoint is a coroutine, it is awaited.
5. Prints a random "Did you know?" tip to stderr.
6. Starts the underlying SignalWire agent (blocking).

#### Example

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

@function_tool
def lookup_order(order_id: str) -> str:
    """Look up an order by ID."""
    return f"Order {order_id} shipped yesterday."

server = AgentServer()

def on_setup(proc: JobProcess):
    proc.userdata["db_url"] = "postgres://localhost/orders"

server.setup_fnc = on_setup

@server.rtc_session()
async def entrypoint(ctx: JobContext):
    await ctx.connect()
    agent = Agent(
        instructions="You are an order tracking assistant.",
        tools=[lookup_order],
    )
    session = AgentSession()
    await session.start(agent, room=ctx.room)
    session.say("Hello! I can help you track your orders.")

run_app(server)
```