# build_stream_config

> **Function** in `deepagents_code`

📖 [View in docs](https://reference.langchain.com/python/deepagents-code/config/build_stream_config)

Build the LangGraph stream config dict.

Injects the dcode version into `metadata["lc_versions"]` so LangSmith traces
can be correlated with specific releases. `create_deep_agent` supplies the
SDK version through the compiled graph config, and LangChain merges nested
metadata dictionaries so both versions survive at stream time.

Also records `dcode_client_deepagents_version` as a dcode-client diagnostic.
This describes the Deep Agents package installed alongside the TUI, which
can differ from a remote graph's Deep Agents runtime version.

Includes `ls_integration` metadata so LangSmith traces originating from
the app are distinguishable from bare SDK usage.

## Signature

```python
build_stream_config(
    thread_id: str,
    assistant_id: str | None,
    *,
    sandbox_type: str | None = None,
) -> RunnableConfig
```

## Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `thread_id` | `str` | Yes | The app session thread identifier. |
| `assistant_id` | `str \| None` | Yes | The dcode agent identifier, if any. When set, it is surfaced in trace metadata under `dcode_agent_name` and `agent_name`. |
| `sandbox_type` | `str \| None` | No | Sandbox provider name for trace metadata, or `None` if no sandbox is active. (default: `None`) |

## Returns

`RunnableConfig`

Config dict with `configurable` and `metadata` keys.

---

[View source on GitHub](https://github.com/langchain-ai/deepagents/blob/a98f0dfa8d534d8a1885b524632400e52db22ac6/libs/code/deepagents_code/config.py#L1008)