[PR #930] [CLOSED] WIP DRAFT - feat(langgraph): add exec function #1117

Closed
opened 2026-02-15 19:17:17 -05:00 by yindo · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/langchain-ai/langgraphjs/pull/930
Author: @benjamincburns
Created: 3/3/2025
Status: Closed

Base: mainHead: ben/typed-exec


📝 Commits (4)

  • e588833 feat(langgraph): add strictly-typed exec function
  • 7f90225 values works, updates, etc todo
  • c651fa5 working for single layer graphs
  • cc0e209 formatting

📊 Changes

9 files changed (+534 additions, -15 deletions)

View changed files

📝 libs/langgraph/package.json (+1 -0)
📝 libs/langgraph/src/graph/annotation.ts (+7 -1)
📝 libs/langgraph/src/pregel/algo.ts (+1 -7)
📝 libs/langgraph/src/pregel/debug.ts (+6 -3)
libs/langgraph/src/pregel/exec.ts (+272 -0)
📝 libs/langgraph/src/pregel/messages.ts (+4 -3)
📝 libs/langgraph/src/pregel/types.ts (+61 -1)
libs/langgraph/src/tests/exec.test.ts (+174 -0)
📝 yarn.lock (+8 -0)

📄 Description

This is very draft, and naming is very placeholder, TBD.

Goals:

  • Super tightly constrained types for streaming events
    • Make it so consumers know exactly what runtime checks they actually need and don't feel compelled to implement runtime checks for unioned types that are never emitted
  • Gives us an option to get ahead of the "combinatorial explosion" that comes from having multiple ways to invoke the graph
    • Single function for configuring the graph, single function for invocation that works regardless of whether the user wants to await a Promise or consume a stream/generator/event emitter.
    • Importantly, these are separate functions, which opens the possibility to pass multiple graph input args in the future on invocation

TODO:

  • Way more test cases
  • Subgraphs
  • Further Update type refinements
    • Can we get the type system to be aware of what each node actually returns so the type of each node key in the update event matches that rather than the update type for the entire schema?
    • Can we get the type system to detect subgraphs so we can type updates event keys correctly?
  • More intentional design for resume (rn it's passed in place of the input as before - do we want to keep doing that?)
  • Potentially emit events for interrupt, error, etc?
    • Right now the promise rejects, and I don't think we have an explicit error event
  • Potentially buffer events so they can be inspected post await

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/langchain-ai/langgraphjs/pull/930 **Author:** [@benjamincburns](https://github.com/benjamincburns) **Created:** 3/3/2025 **Status:** ❌ Closed **Base:** `main` ← **Head:** `ben/typed-exec` --- ### 📝 Commits (4) - [`e588833`](https://github.com/langchain-ai/langgraphjs/commit/e5888336705032efa4b1373c3eb5ba9addbdd087) feat(langgraph): add strictly-typed `exec` function - [`7f90225`](https://github.com/langchain-ai/langgraphjs/commit/7f9022521124f28e8572bcf0bd6822abb504b9d1) values works, updates, etc todo - [`c651fa5`](https://github.com/langchain-ai/langgraphjs/commit/c651fa5c9a8251bdb548813797297a1609c640fc) working for single layer graphs - [`cc0e209`](https://github.com/langchain-ai/langgraphjs/commit/cc0e20987bcc3989466766b9eb3747f8d0932618) formatting ### 📊 Changes **9 files changed** (+534 additions, -15 deletions) <details> <summary>View changed files</summary> 📝 `libs/langgraph/package.json` (+1 -0) 📝 `libs/langgraph/src/graph/annotation.ts` (+7 -1) 📝 `libs/langgraph/src/pregel/algo.ts` (+1 -7) 📝 `libs/langgraph/src/pregel/debug.ts` (+6 -3) ➕ `libs/langgraph/src/pregel/exec.ts` (+272 -0) 📝 `libs/langgraph/src/pregel/messages.ts` (+4 -3) 📝 `libs/langgraph/src/pregel/types.ts` (+61 -1) ➕ `libs/langgraph/src/tests/exec.test.ts` (+174 -0) 📝 `yarn.lock` (+8 -0) </details> ### 📄 Description This is very draft, and naming is very placeholder, TBD. Goals: - Super tightly constrained types for streaming events - Make it so consumers know exactly what runtime checks they _actually_ need and don't feel compelled to implement runtime checks for unioned types that are never emitted - Gives us an option to get ahead of the "combinatorial explosion" that comes from having multiple ways to invoke the graph - Single function for configuring the graph, single function for invocation that works regardless of whether the user wants to `await` a `Promise` or consume a stream/generator/event emitter. - Importantly, these are separate functions, which opens the possibility to pass multiple graph input args in the future on invocation TODO: - [ ] Way more test cases - [ ] Subgraphs - [ ] Further Update type refinements - [ ] Can we get the type system to be aware of what each node _actually_ returns so the type of each node key in the update event matches that rather than the update type for the entire schema? - [ ] Can we get the type system to detect subgraphs so we can type `updates` event keys correctly? - [ ] More intentional design for resume (rn it's passed in place of the input as before - do we want to keep doing that?) - [ ] Potentially emit events for interrupt, error, etc? - Right now the promise rejects, and I don't think we have an explicit `error` event - [ ] Potentially buffer events so they can be inspected post `await` --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
yindo added the pull-request label 2026-02-15 19:17:17 -05:00
yindo closed this issue 2026-02-15 19:17:17 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langchain-ai/langgraphjs#1117