Commit Graph
8 Commits
Author SHA1 Message Date
Mason DaughertyGitHubopen-swe[bot] <open-swe@users.noreply.github.com>
bdb8a9c7a4 feat: route LangSmith traces from thread streams (#8723)
## Description
Expose the existing `langsmith_tracing` option on Python sync and async
thread-stream run starts and forward it through the protocol.

## Release Note
Python thread streams can route traces to an additional LangSmith
project per run.

## Test Plan
- [x] Verify sync and async run-start payloads include tracing settings

## Related PRs
- langchain-ai/agent-protocol#95
- langchain-ai/langgraphjs#2745
- langchain-ai/langgraph-api#4033

Made by [Open
SWE](https://openswe.vercel.app/agents/f9e34294-b9c3-52f0-815a-0102188e1181)

Co-authored-by: open-swe[bot] <open-swe@users.noreply.github.com>
2026-08-26 16:57:39 -04:00
Nick HollonandGitHub 1fcb768182 feat(sdk-py): extract stream decoders and add interleave_projections (#7935)
## Summary

Refactors the four (now five) sdk-py streaming projections into
reusable, transport-agnostic `Decoder` classes and adds a new
`interleave_projections(channels)` method to `AsyncThreadStream` and
`SyncThreadStream` that drives multiple decoders from one shared
subscription, yielding `(channel_name, item)` tuples in arrival order
(the SDK analog of local `GraphRunStream.interleave`).

- **New `langgraph_sdk/stream/decoders.py`**: pure `feed(event) ->
Iterable[item]` state machines — `ValuesDecoder`, `MessagesDecoder`,
`ToolCallsDecoder`, `SubgraphsDecoder`, `ExtensionsDecoder` — behind a
`Decoder` Protocol. No subscription/queue/thread access.
- **Projection migration (async + sync)**: the five existing projections
now delegate their per-event logic to the decoders. Behavior-preserving
— the existing test suite is the regression net. Thread-coupled side
effects (active-stream registration, terminal-error-on-close, root-inbox
forwarding) stay in the projection wrappers; sync messages/tool_calls
keep their pre-dispatch contract (handle/stream resolved on yield) via a
FIFO-head buffer.
- **`interleave_projections`**: flat-namespace channel list (built-ins +
extension names), `tool_calls`↔`tools` wire mapping, subgraphs fed every
event, extensions keyed by bare name.

### Notable
- Fixes a latent sync bug surfaced by the refactor: two tool calls /
messages whose events interleave previously dropped the second; both now
surface. Locked in with a regression test.
- `Decoder.feed` takes `Mapping[str, Any]` (read-only), so the Protocol
is load-bearing in both stream files.

### Deferred (not in this PR)
- Wiring `RemoteGraph._RemoteGraphRunStream.interleave` to
`interleave_projections` (gated on #7927).
- Migrating the handle-scoped projections (`_Handle*Projection`) to the
decoders — hence the small, verified-identical helper duplication
between `decoders.py` and `_async/stream.py`.
- `interleave_projections` handles aren't registered for thread-close
cleanup (additive follow-up).

## Test Plan
- [x] `make test` in `libs/sdk-py` — 464 passed, 0 failures
- [x] `make format` / `make lint` (ruff + ty) clean
- [x] Per-decoder unit tests in `tests/streaming/test_decoders.py`
- [x] `interleave_projections` tests (single-channel, multi-channel
arrival order, builtin+extension mix, tool_calls public-name, subgraphs
discovery) async + sync
- [x] Existing projection suites pass unchanged (regression net for the
migration)
2026-05-29 17:14:14 -04:00
Nick HollonandGitHub 8cb0f3a96d feat(sdk-py): add thread stream helpers (#7833) 2026-05-27 17:02:59 -04:00
Nick HollonandGitHub fd4257300e feat(sdk-py): wire websocket stream selection (#7832) 2026-05-27 16:48:22 -04:00
Nick HollonandGitHub 4f3ab2f969 feat(sdk-py): harden streaming reconnects (#7829) 2026-05-27 15:24:25 -04:00
Nick HollonandGitHub 3282ac10e3 feat(sdk-py): add sync scoped subgraphs (#7828) 2026-05-27 14:23:56 -04:00
Nick HollonandGitHub 3d61d1b32f feat(sdk-py): add sync messages and tool calls (#7827) 2026-05-27 14:04:34 -04:00
Nick HollonandGitHub fe1c683fe1 feat(sdk-py): add sync thread stream core (#7826) 2026-05-27 13:41:55 -04:00