Client¶
The murmur-client package ships separately and depends only on
httpx + pydantic. It deliberately does not import pydantic_ai /
faststream or any runtime-side machinery — the client knows the server
URL, agent / group names, and JSON schemas; nothing else.
Both client classes satisfy a shared _RunBackend Protocol — same
call surface, different transport.
MurmurClient¶
HTTP client. Use when calling a remote AgentServer over the network.
MurmurClient
¶
MurmurClient(
server_url: str,
*,
timeout: float = 30.0,
transport: AsyncBaseTransport | None = None,
sync_transport: BaseTransport | None = None,
auth_token: str | None = None,
)
Async HTTP client for an :class:AgentServer.
Use as an async context manager so the underlying httpx.AsyncClient
is closed cleanly. transport is an escape hatch for tests
(httpx.ASGITransport(app=server.app)).
Source code in packages/murmur-client/src/murmur_client/client.py
run_sync
¶
run_sync(
agent_name: str, task: TaskSpec, *, request_id: str | None = None
) -> AgentResult[BaseModel]
Blocking variant of :meth:run for notebook / REPL / script use.
Opens a one-shot :class:httpx.Client for the call — does not
share the persistent httpx.AsyncClient used by the async
methods. Cannot be called from inside a running event loop
(raises :class:RuntimeError).
Source code in packages/murmur-client/src/murmur_client/client.py
usage
async
¶
GET /usage — token usage rollup.
Pass group_by="model" for per-model breakdown (server-side
rollup); omit for the runtime-wide total. Returns the raw JSON
payload — shape depends on group_by and is documented under
docs/concepts/cost.md.
Source code in packages/murmur-client/src/murmur_client/client.py
runtime_stats
async
¶
GET /runtime/stats — fleet-wide runtime + worker stats.
list_tools
async
¶
GET /tools — registered tool descriptors.
stream_events
async
¶
Subscribe to GET /events/stream — every :class:RuntimeEvent
the server emits, not scoped to a single run.
Requires the server to have been built with an
:class:SSEEventEmitter. Yields decoded :class:RunEvent payloads;
terminate the iteration to disconnect.
Source code in packages/murmur-client/src/murmur_client/client.py
LocalClient¶
In-process client. Use when calling agents mounted in the same Python
process (typically via AgentRouter).
LocalClient
¶
LocalClient(
*,
server: AgentServer | None = None,
runtime: AgentRuntime | None = None,
run_store: RunStore | None = None,
)
Async in-process client. Same surface as
:class:murmur_client.MurmurClient.
Construct with either:
server=: wrap an existing :class:AgentServer(typical when the server is already shared with an :class:AgentRouter).runtime=/run_store=: build an internal server from these.
The two constructor shapes are mutually exclusive — pass one or the other, not both.
Source code in src/murmur/client/local.py
close
async
¶
No-op for the local client — kept for API symmetry with the
HTTP client. The backing :class:AgentServer and its runtime
own their own lifecycles; we don't tear them down here.
run_sync
¶
run_sync(
agent_name: str, task: TaskSpec, *, request_id: str | None = None
) -> AgentResult[BaseModel]
Blocking variant of :meth:run — wraps the async path in
:func:asyncio.run. Cannot be called from inside a running
event loop.
Source code in src/murmur/client/local.py
Run¶
Long-lived run handle returned by client.submit().
Run
¶
Handle for an asynchronously-dispatched run.
Backed by either :class:MurmurClient (HTTP) or
:class:murmur_client.LocalClient (in-process); the four _status /
_result / _cancel / _stream hooks satisfy a shared Protocol.