# set_runtime_overrides

> **Function** in `langsmith`

📖 [View in docs](https://reference.langchain.com/python/langsmith/_runtime_overrides/set_runtime_overrides)

Set LangSmith runtime overrides.

This allows customizing LangSmith's async runtime behavior for environments
with constrained async runtimes (e.g., Temporal, which doesn't support
``run_in_executor``).

## Signature

```python
set_runtime_overrides(
    aio_to_thread: Optional[AioToThread] = None,
) -> None
```

## Description

**Example:**

For Temporal or similar runtimes:

```python
import langsmith

async def temporal_aio_to_thread(
    default_aio_to_thread, ctx, func, /, *args, **kwargs
):
    # Use the default implementation when not in a workflow
    if not temporalio.workflow.in_workflow():
        return await default_aio_to_thread(ctx, func, *args, **kwargs)
    with temporalio.workflow.unsafe.sandbox_unrestricted():
        return ctx.run(func, *args, **kwargs)

langsmith.set_runtime_overrides(aio_to_thread=temporal_aio_to_thread)
```

Reset to defaults:

```python
langsmith.set_runtime_overrides()
```

## Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `aio_to_thread` | `Optional[AioToThread]` | No | Custom async function to run sync functions asynchronously. Should have signature: ``async def aio_to_thread(     default_aio_to_thread, ctx, func, /, *args, **kwargs )``. ``default_aio_to_thread`` is LangSmith's default implementation, which the override can call to fall back to default behavior. The implementation must invoke ``func`` inside ``ctx`` (e.g. ``ctx.run(func, *args, **kwargs)``) so that LangSmith's tracing state, which is read back from ``ctx`` after the call, is visible to downstream code. Pass ``None`` to use the default implementation. (default: `None`) |

---

[View source on GitHub](https://github.com/langchain-ai/langsmith-sdk/blob/ab5758006b8025d55c87c496c4b4205a069f78e5/python/langsmith/_runtime_overrides.py#L71)