> For clean Markdown content of this page, append .md to this URL. For the complete documentation index, see https://docs.nvidia.com/dynamo/llms.txt. For full content including API reference and SDK examples, see https://docs.nvidia.com/dynamo/llms-full.txt.

# dynamo.runtime

`dynamo.runtime` publishes 7 classes and 10 functions. Source: [`lib/bindings/python/src/dynamo/runtime/__init__.py`](https://github.com/ai-dynamo/dynamo/blob/main/lib/bindings/python/src/dynamo/runtime/__init__.py)

#### Client (class)

A client capable of calling served instances of an endpoint

```python
from dynamo.runtime import Client
```

[`lib/bindings/python/src/dynamo/_core.pyi#L288`](https://github.com/ai-dynamo/dynamo/blob/main/lib/bindings/python/src/dynamo/_core.pyi#L288)

**Public methods**

<h4 id="api-dynamo-core-client-instance-ids">
  instance_ids
</h4>

```python
instance_ids() -> List[int]
```

Get list of current instance IDs.

**Returns**

* `List[int]` — A list of currently available instance IDs

[source](https://github.com/ai-dynamo/dynamo/blob/main/lib/bindings/python/src/dynamo/_core.pyi#L295)

<h4 id="api-dynamo-core-client-instances">
  instances
</h4>

```python
instances() -> List[Instance]
```

Get a snapshot of the current instances with full transport details.

Like `instance_ids()`, the result is a snapshot of the watched
instance set; pair with `wait_for_instances()` to block until
instances exist.

**Returns**

* `List[Instance]` — A list of `Instance` for the currently available instances,
* `List[Instance]` — across all transports (TCP, NATS, ...).

[source](https://github.com/ai-dynamo/dynamo/blob/main/lib/bindings/python/src/dynamo/_core.pyi#L304)

<h4 id="api-dynamo-core-client-wait-for-instances">
  wait_for_instances
</h4>

```python
wait_for_instances() -> List[int]
```

Wait for instances to be available for work and return their IDs.

**Returns**

* `List[int]` — A list of instance IDs that are available for work

[source](https://github.com/ai-dynamo/dynamo/blob/main/lib/bindings/python/src/dynamo/_core.pyi#L318)

<h4 id="api-dynamo-core-client-wait-for-instance-by-runtime-data">
  wait_for_instance_by_runtime_data
</h4>

```python
wait_for_instance_by_runtime_data(key: str, value: str, timeout_s: float | None = None) -> int
```

Wait for exactly one instance whose MDC runtime\_data contains the given string value.

[source](https://github.com/ai-dynamo/dynamo/blob/main/lib/bindings/python/src/dynamo/_core.pyi#L327)

<h4 id="api-dynamo-core-client-random">
  random
</h4>

```python
random(request: JsonLike, annotated: bool | None = True, context: Context | None = None) -> AsyncIterator[JsonLike]
```

Pick a random instance of the endpoint and issue the request

[source](https://github.com/ai-dynamo/dynamo/blob/main/lib/bindings/python/src/dynamo/_core.pyi#L338)

<h4 id="api-dynamo-core-client-round-robin">
  round_robin
</h4>

```python
round_robin(request: JsonLike, annotated: bool | None = True, context: Context | None = None) -> AsyncIterator[JsonLike]
```

Pick the next instance of the endpoint in a round-robin fashion

[source](https://github.com/ai-dynamo/dynamo/blob/main/lib/bindings/python/src/dynamo/_core.pyi#L349)

<h4 id="api-dynamo-core-client-direct">
  direct
</h4>

```python
direct(request: JsonLike, instance_id: int, annotated: bool | None = True, context: Context | None = None) -> AsyncIterator[JsonLike]
```

Pick a specific instance of the endpoint

[source](https://github.com/ai-dynamo/dynamo/blob/main/lib/bindings/python/src/dynamo/_core.pyi#L360)

<h4 id="api-dynamo-core-client-generate">
  generate
</h4>

```python
generate(request: JsonLike, annotated: bool | None = True, context: Context | None = None) -> AsyncIterator[JsonLike]
```

Generate a response from the endpoint

[source](https://github.com/ai-dynamo/dynamo/blob/main/lib/bindings/python/src/dynamo/_core.pyi#L372)

#### Context (class)

Context wrapper around AsyncEngineContext for Python bindings. Provides tracing and cancellation capabilities for request handling.

```python
from dynamo.runtime import Context
```

```python
Context(id: Optional[str] = None, metadata: Optional[Dict[str, str]] = None) -> None
```

[`lib/bindings/python/src/dynamo/_core.pyi#L460`](https://github.com/ai-dynamo/dynamo/blob/main/lib/bindings/python/src/dynamo/_core.pyi#L460)

**Public methods**

<h4 id="api-dynamo-core-context-init">
  **init**
</h4>

```python
__init__(id: Optional[str] = None, metadata: Optional[Dict[str, str]] = None) -> None
```

Create a new Context instance.

**Parameters**

**`id`** `Optional[str]`

Optional request ID. If None, a default ID will be generated.

---

**`metadata`** `Optional[Dict[str, str]]`

Optional propagated metadata map.

---

[source](https://github.com/ai-dynamo/dynamo/blob/main/lib/bindings/python/src/dynamo/_core.pyi#L466)

<h4 id="api-dynamo-core-context-is-stopped">
  is_stopped
</h4>

```python
is_stopped() -> bool
```

Check if the context has been stopped (synchronous).

**Returns**

* `bool` — True if the context is stopped, False otherwise.

[source](https://github.com/ai-dynamo/dynamo/blob/main/lib/bindings/python/src/dynamo/_core.pyi#L480)

<h4 id="api-dynamo-core-context-is-killed">
  is_killed
</h4>

```python
is_killed() -> bool
```

Check if the context has been killed (synchronous).

**Returns**

* `bool` — True if the context is killed, False otherwise.

[source](https://github.com/ai-dynamo/dynamo/blob/main/lib/bindings/python/src/dynamo/_core.pyi#L489)

<h4 id="api-dynamo-core-context-stop-generating">
  stop_generating
</h4>

```python
stop_generating() -> None
```

Issue a stop generating signal to the context.

[source](https://github.com/ai-dynamo/dynamo/blob/main/lib/bindings/python/src/dynamo/_core.pyi#L498)

<h4 id="api-dynamo-core-context-id">
  id
</h4>

```python
id() -> str
```

Get the context ID.

**Returns**

* `str` — The context identifier string.

[source](https://github.com/ai-dynamo/dynamo/blob/main/lib/bindings/python/src/dynamo/_core.pyi#L504)

<h4 id="api-dynamo-core-context-detached">
  detached
</h4>

```python
detached(id: str) -> Context
```

Create a context with a fresh cancellation controller and request ID while preserving trace parentage and a metadata snapshot.

[source](https://github.com/ai-dynamo/dynamo/blob/main/lib/bindings/python/src/dynamo/_core.pyi#L513)

<h4 id="api-dynamo-core-context-async-killed-or-stopped">
  async_killed_or_stopped
</h4>

```python
async_killed_or_stopped() -> asyncio.Future[bool]
```

Asynchronously wait until the context is killed or stopped.

**Returns**

* `asyncio.Future[bool]` — True when the context is killed or stopped.

[source](https://github.com/ai-dynamo/dynamo/blob/main/lib/bindings/python/src/dynamo/_core.pyi#L520)

<h4 id="api-dynamo-core-context-notify-first-token">
  notify_first_token
</h4>

```python
notify_first_token() -> None
```

Fire the first-token signal so the framework can release any deferred `engine.abort()`. Idempotent; no-op on non-decode requests. Engines normally don't need this — the framework auto-fires on the first non-empty chunk in the response stream.

[source](https://github.com/ai-dynamo/dynamo/blob/main/lib/bindings/python/src/dynamo/_core.pyi#L529)

<h4 id="api-dynamo-core-context-trace-headers">
  trace_headers
</h4>

```python
trace_headers() -> Optional[dict[str, str]]
```

Build W3C trace headers for propagating to downstream inference engines.

**Returns**

* `Optional[dict[str, str]]` — `{"traceparent": "00-<trace_id>-<span_id>-<flags>"}` when this
* `Optional[dict[str, str]]` — request carries trace context, `None` otherwise. Also emits `tracestate`,
* `Optional[dict[str, str]]` — `x-request-id`, `request-id` when upstream propagated them.
* `Optional[dict[str, str]]` — Forward unchanged to the inference engine's `trace_headers` kwarg.

[source](https://github.com/ai-dynamo/dynamo/blob/main/lib/bindings/python/src/dynamo/_core.pyi#L576)

<h4 id="api-dynamo-core-context-current-span">
  current_span
</h4>

```python
current_span() -> SpanProxy
```

Handle on the framework's `engine.generate` span. Use it to `set_attribute` / `add_event` / `set_status` on the parent span. Returns a silent no-op proxy when no parent was plumbed in (test contexts) or the OTel bridge isn't installed.

Engines normally reach this through
`dynamo.common.backend.telemetry.current_span(context)`.

[source](https://github.com/ai-dynamo/dynamo/blob/main/lib/bindings/python/src/dynamo/_core.pyi#L588)

<h4 id="api-dynamo-core-context-start-span">
  start_span
</h4>

```python
start_span(name: str, attrs: Optional[dict[str, Any]] = None) -> SpanProxy
```

Open a child span under `engine.generate` with a dynamic name. The returned `SpanProxy` is a context manager — the span ends on `__exit__` / `close()` / drop.

Engines normally reach this through
`dynamo.common.backend.telemetry.start_span(context, name)`.

[source](https://github.com/ai-dynamo/dynamo/blob/main/lib/bindings/python/src/dynamo/_core.pyi#L600)

#### DistributedRuntime (class)

The runtime object for dynamo applications

```python
from dynamo.runtime import DistributedRuntime
```

[`lib/bindings/python/src/dynamo/_core.pyi#L58`](https://github.com/ai-dynamo/dynamo/blob/main/lib/bindings/python/src/dynamo/_core.pyi#L58)

**Public methods**

<h4 id="api-dynamo-core-distributedruntime-endpoint">
  endpoint
</h4>

```python
endpoint(path: str) -> Endpoint
```

Get an endpoint directly by path.

**Parameters**

**`path`** `str`

Endpoint path in format 'namespace.component.endpoint'
or 'dyn://namespace.component.endpoint'

---

**Returns**

* `Endpoint` — The requested endpoint

**Raises**

* `ValueError` — If path format is invalid (not 3 parts separated by dots)
* `Exception` — If namespace or component creation fails

endpoint = runtime.endpoint("demo.backend.generate")
endpoint = runtime.endpoint("dyn://demo.backend.generate")

[source](https://github.com/ai-dynamo/dynamo/blob/main/lib/bindings/python/src/dynamo/_core.pyi#L84)

<h4 id="api-dynamo-core-distributedruntime-shutdown">
  shutdown
</h4>

```python
shutdown() -> None
```

Shutdown the runtime by triggering the cancellation token

[source](https://github.com/ai-dynamo/dynamo/blob/main/lib/bindings/python/src/dynamo/_core.pyi#L105)

<h4 id="api-dynamo-core-distributedruntime-set-health-status">
  set_health_status
</h4>

```python
set_health_status(ready: bool) -> None
```

Explicitly set the system-level health status (Ready / NotReady).

[source](https://github.com/ai-dynamo/dynamo/blob/main/lib/bindings/python/src/dynamo/_core.pyi#L111)

<h4 id="api-dynamo-core-distributedruntime-register-engine-route">
  register_engine_route
</h4>

```python
register_engine_route(route_name: str, callback: Callable[[dict], Awaitable[dict]]) -> None
```

Register an async callback for /engine/\{route\_name} on the system status server.

**Parameters**

**`route_name`** `str`

The route path (e.g., "control/start\_profile" creates /engine/control/start\_profile)

---

**`callback`** `Callable[[dict], Awaitable[dict]]`

Async function with signature: async def(body: dict) -> dict

---

async def start\_profile(body: dict) -> dict:
await engine.start\_profile(\*\*body)
return \{"status": "ok", "message": "Profiling started"}

runtime.register\_engine\_route("control/start\_profile", start\_profile)

The callback receives the JSON request body as a dict and should return
a dict that will be serialized as the JSON response.

For GET requests or empty bodies, an empty dict \{} is passed.

[source](https://github.com/ai-dynamo/dynamo/blob/main/lib/bindings/python/src/dynamo/_core.pyi#L117)

#### Endpoint (class)

An Endpoint is a single API endpoint

```python
from dynamo.runtime import Endpoint
```

[`lib/bindings/python/src/dynamo/_core.pyi#L144`](https://github.com/ai-dynamo/dynamo/blob/main/lib/bindings/python/src/dynamo/_core.pyi#L144)

**Public methods**

<h4 id="api-dynamo-core-endpoint-serve-endpoint">
  serve_endpoint
</h4>

```python
serve_endpoint(handler: RequestHandler, graceful_shutdown: bool = True, metrics_labels: Optional[List[Tuple[str, str]]] = None, health_check_payload: Optional[Dict[str, Any]] = None) -> None
```

Serve an endpoint discoverable by all connected clients at `{{ namespace }}/components/{{ component_name }}/endpoints/{{ endpoint_name }}`

**Parameters**

**`handler`** `RequestHandler`

The request handler function

---

**`graceful_shutdown`** `bool`

Whether to wait for inflight requests to complete during shutdown (default: True)

---

**`metrics_labels`** `Optional[List[Tuple[str, str]]]`

Optional list of metrics labels to add to the metrics

---

**`health_check_payload`** `Optional[Dict[str, Any]]`

Optional dict containing the health check request payload
that will be used to verify endpoint health

---

[source](https://github.com/ai-dynamo/dynamo/blob/main/lib/bindings/python/src/dynamo/_core.pyi#L151)

<h4 id="api-dynamo-core-endpoint-serve-bidirectional-endpoint">
  serve_bidirectional_endpoint
</h4>

```python
serve_bidirectional_endpoint(handler: Callable[..., AsyncIterator[JsonLike]], graceful_shutdown: bool = True, metrics_labels: Optional[List[Tuple[str, str]]] = None) -> None
```

Serve a bidirectional (streaming-input, streaming-output) endpoint.

The handler is an async generator function — `async def
generate(request_stream)` or `async def generate(request_stream,
context)` — so calling it returns an async iterator of response frames
directly (it is not awaited). `request_stream` is a
`PyAsyncRequestStream` yielding inbound frames as JSON-like Python
objects; the generator yields response frames as JSON-like Python
objects.

Request-stream end (when `__anext__` raises `StopAsyncIteration`)
is not a cancellation signal: the caller has merely stopped sending
input. The engine must keep yielding response chunks until it
chooses to return or observes `context.is_stopped()`.

**Parameters**

**`handler`** `Callable[..., AsyncIterator[JsonLike]]`

The async generator factory described above

---

**`graceful_shutdown`** `bool`

Whether to wait for inflight requests to complete during shutdown (default: True)

---

**`metrics_labels`** `Optional[List[Tuple[str, str]]]`

Optional list of metrics labels to add to the metrics

---

[source](https://github.com/ai-dynamo/dynamo/blob/main/lib/bindings/python/src/dynamo/_core.pyi#L165)

<h4 id="api-dynamo-core-endpoint-client">
  client
</h4>

```python
client(router_mode: Optional[RouterMode] = None) -> Client
```

Create a `Client` capable of calling served instances of this endpoint.

By default this uses round-robin routing when `router_mode` is not provided.

[source](https://github.com/ai-dynamo/dynamo/blob/main/lib/bindings/python/src/dynamo/_core.pyi#L194)

<h4 id="api-dynamo-core-endpoint-connection-id">
  connection_id
</h4>

```python
connection_id() -> int
```

Opaque unique ID for this worker. May change over worker lifetime.

[source](https://github.com/ai-dynamo/dynamo/blob/main/lib/bindings/python/src/dynamo/_core.pyi#L202)

<h4 id="api-dynamo-core-endpoint-unregister-endpoint-instance">
  unregister_endpoint_instance
</h4>

```python
unregister_endpoint_instance() -> None
```

Unregister this endpoint instance from discovery.

This removes the endpoint from the instances bucket, preventing the router
from sending requests to this worker. Use this when a worker is sleeping
and should not receive any requests.

[source](https://github.com/ai-dynamo/dynamo/blob/main/lib/bindings/python/src/dynamo/_core.pyi#L218)

<h4 id="api-dynamo-core-endpoint-register-endpoint-instance">
  register_endpoint_instance
</h4>

```python
register_endpoint_instance() -> None
```

Re-register this endpoint instance to discovery.

This adds the endpoint back to the instances bucket, allowing the router
to send requests to this worker again. Use this when a worker wakes up
and should start receiving requests.

[source](https://github.com/ai-dynamo/dynamo/blob/main/lib/bindings/python/src/dynamo/_core.pyi#L228)

#### LogHandler (class)

Custom logging handler that sends log messages to the Rust env\_logger

```python
from dynamo.runtime.logging import LogHandler
```

[`lib/bindings/python/src/dynamo/runtime/logging.py#L28`](https://github.com/ai-dynamo/dynamo/blob/main/lib/bindings/python/src/dynamo/runtime/logging.py#L28)

**Public methods**

<h4 id="api-dynamo-runtime-logging-loghandler-emit">
  emit
</h4>

```python
emit(record: logging.LogRecord) -> None
```

Emit a log record

[source](https://github.com/ai-dynamo/dynamo/blob/main/lib/bindings/python/src/dynamo/runtime/logging.py#L33)

#### PyAsyncRequestStream (class)

Python-visible inbound iterator handed to bidirectional engine handlers as the first positional argument. Yields request frames as JSON-like Python objects.

```python
from dynamo.runtime import PyAsyncRequestStream
```

Request-stream end is not a cancellation signal: when this iterator
raises `StopAsyncIteration`, the caller has merely stopped sending
input. The engine should keep yielding response chunks until it
chooses to return or observes `context.is_stopped()`.

[`lib/bindings/python/src/dynamo/_core.pyi#L238`](https://github.com/ai-dynamo/dynamo/blob/main/lib/bindings/python/src/dynamo/_core.pyi#L238)

#### VllmColorFormatter (class)

Formatter that matches Rust tracing's compact colored output style.

```python
from dynamo.runtime.logging import VllmColorFormatter
```

Used for vLLM logs routed through a StreamHandler (bypassing the Rust
bridge) so that VLLM\_LOGGING\_LEVEL is respected independently of DYN\_LOG
while still producing visually consistent colored output.

[`lib/bindings/python/src/dynamo/runtime/logging.py#L65`](https://github.com/ai-dynamo/dynamo/blob/main/lib/bindings/python/src/dynamo/runtime/logging.py#L65)

**Public methods**

<h4 id="api-dynamo-runtime-logging-vllmcolorformatter-format">
  format
</h4>

```python
format(record: logging.LogRecord) -> str
```

No summary available.

[source](https://github.com/ai-dynamo/dynamo/blob/main/lib/bindings/python/src/dynamo/runtime/logging.py#L83)

#### configure\_dynamo\_logging (function)

A single place to configure logging for Dynamo.

```python
from dynamo.runtime.logging import configure_dynamo_logging
```

```python
configure_dynamo_logging(service_name: str | None = None, worker_id: int | None = None) -> None
```

[`lib/bindings/python/src/dynamo/runtime/logging.py#L140`](https://github.com/ai-dynamo/dynamo/blob/main/lib/bindings/python/src/dynamo/runtime/logging.py#L140)

#### configure\_logger (function)

Called once to configure the Python logger to use the LogHandler

```python
from dynamo.runtime.logging import configure_logger
```

```python
configure_logger(service_name: str | None, worker_id: int | None, level: int = logging.INFO) -> None
```

[`lib/bindings/python/src/dynamo/runtime/logging.py#L106`](https://github.com/ai-dynamo/dynamo/blob/main/lib/bindings/python/src/dynamo/runtime/logging.py#L106)

#### configure\_sglang\_logging (function)

SGLang allows us to create a custom logging config file

```python
from dynamo.runtime.logging import configure_sglang_logging
```

```python
configure_sglang_logging(dyn_level: int) -> None
```

[`lib/bindings/python/src/dynamo/runtime/logging.py#L218`](https://github.com/ai-dynamo/dynamo/blob/main/lib/bindings/python/src/dynamo/runtime/logging.py#L218)

#### configure\_vllm\_logging (function)

Configure vLLM logging for the main process and subprocesses.

```python
from dynamo.runtime.logging import configure_vllm_logging
```

```python
configure_vllm_logging(dyn_level: int) -> None
```

Main process: replaces vLLM's StreamHandler with a new StreamHandler that
uses VllmColorFormatter and writes directly to stderr.  This bypasses the
Rust LogHandler bridge so that VLLM\_LOGGING\_LEVEL is respected independently
of DYN\_LOG (the Rust bridge filters based on DYN\_LOG).

Subprocesses (EngineCore, workers): use vLLM's DEFAULT\_LOGGING\_CONFIG
(StreamHandler to stderr) since the Rust runtime is not initialized there.
Setting VLLM\_CONFIGURE\_LOGGING=1 without VLLM\_LOGGING\_CONFIG\_PATH causes
vLLM to use its built-in default config in spawned subprocesses.

The dyn\_level param is kept for signature compatibility but does not control
the vLLM logger level. Use VLLM\_LOGGING\_LEVEL env var instead.

[`lib/bindings/python/src/dynamo/runtime/logging.py#L255`](https://github.com/ai-dynamo/dynamo/blob/main/lib/bindings/python/src/dynamo/runtime/logging.py#L255)

#### construct\_formatter\_prefix (function)

No summary available.

```python
from dynamo.runtime.logging import construct_formatter_prefix
```

```python
construct_formatter_prefix(service_name: str | None, worker_id: int | None) -> str
```

[`lib/bindings/python/src/dynamo/runtime/logging.py#L129`](https://github.com/ai-dynamo/dynamo/blob/main/lib/bindings/python/src/dynamo/runtime/logging.py#L129)

#### dynamo\_endpoint (function)

Decorator that can parse a request payload into a Pydantic model before the endpoint runs.

```python
from dynamo.runtime import dynamo_endpoint
```

```python
dynamo_endpoint(request_model: Union[Type[BaseModel], Type[Any]], response_model: Type[BaseModel]) -> Callable
```

Parsing applies only when `request_model` is a `BaseModel` subclass
*and* the wrapper receives one or two positional arguments -- `(request)`
or `(self, request)`. With three or more positional arguments, or when the
payload arrives by keyword, it is forwarded untouched. A `str` payload is
parsed with `parse_raw` and a `dict` with `parse_obj`; any other type,
including an already-constructed `request_model` instance, is rejected.
`response_model` is reserved for future validation; yielded items pass
through unchanged today.

**Parameters**

**`request_model`** `Union[Type[BaseModel], Type[Any]]`

Request class used to parse `str` or `dict` payloads.
Pass a non-`BaseModel` type, as `examples/custom_backend`
does with `str`, to skip parsing entirely.

---

**`response_model`** `Type[BaseModel]`

Expected response class. Currently accepted but not enforced.

---

**Raises**

* `ValueError` — On the first `__anext__()` of the returned generator, not when the decorated function is called, because the wrapper is itself an async generator. Raised when the payload fails validation or is neither `str` nor `dict`.

**Examples**

```python
>>> from pydantic import BaseModel
>>> from dynamo.runtime import dynamo_endpoint
>>>
>>> class Request(BaseModel):
...     data: str
>>> class Response(BaseModel):
...     char: str
>>>
>>> @dynamo_endpoint(Request, Response)
... async def generate(request):
...     for char in request.data:
...         yield char
```

[`lib/bindings/python/src/dynamo/runtime/__init__.py#L54`](https://github.com/ai-dynamo/dynamo/blob/main/lib/bindings/python/src/dynamo/runtime/__init__.py#L54)

#### dynamo\_worker (function)

Decorator that creates a DistributedRuntime and passes it to the worker function.

```python
from dynamo.runtime import dynamo_worker
```

```python
dynamo_worker(enable_nats: Optional[bool] = None)
```

**Parameters**

**`enable_nats`** `Optional[bool]`

Deprecated. NATS enablement is now determined automatically
from the event-plane configuration. This parameter is accepted for
backwards compatibility but will be removed in a future release.

---

[`lib/bindings/python/src/dynamo/runtime/__init__.py#L21`](https://github.com/ai-dynamo/dynamo/blob/main/lib/bindings/python/src/dynamo/runtime/__init__.py#L21)

#### get\_bool\_env\_var (function)

No summary available.

```python
from dynamo.runtime.logging import get_bool_env_var
```

```python
get_bool_env_var(name: str, default: str = 'false') -> bool
```

[`lib/bindings/python/src/dynamo/runtime/logging.py#L317`](https://github.com/ai-dynamo/dynamo/blob/main/lib/bindings/python/src/dynamo/runtime/logging.py#L317)

#### log\_level\_mapping (function)

The DYN\_LOG variable is set using "debug" or "trace" or "info. This function maps those to the appropriate logging level and defaults to INFO if the variable is not set or a bad value.

```python
from dynamo.runtime.logging import log_level_mapping
```

```python
log_level_mapping(level: str) -> int
```

[`lib/bindings/python/src/dynamo/runtime/logging.py#L174`](https://github.com/ai-dynamo/dynamo/blob/main/lib/bindings/python/src/dynamo/runtime/logging.py#L174)

#### python\_log\_level\_mapping (function)

Return the lowest Python level enabled by a Rust-style DYN\_LOG filter.

```python
from dynamo.runtime.logging import python_log_level_mapping
```

```python
python_log_level_mapping(filters: str) -> int
```

[`lib/bindings/python/src/dynamo/runtime/logging.py#L196`](https://github.com/ai-dynamo/dynamo/blob/main/lib/bindings/python/src/dynamo/runtime/logging.py#L196)