mirror of
https://github.com/langchain-ai/langgraphjs.git
synced 2026-07-21 16:45:24 -04:00
Feature or docs request: Better/more explicit support for stateful tools #74
Closed
opened 2026-02-15 17:15:25 -05:00 by yindo
·
5 comments
No Branch/Tag Specified
main
fix/usestream-hydrate-null-thread-reconnect
chore/dependabot-docker-root-coverage
open-swe/accept-semver-ranges
wfh/fix_store
cb/reconnect-upstream
nh/integration-managed-runtime-tests
open-swe/usestream-status-enum
hunter/bump-checkpoint-dep
cb/bundle-uuid-cjs-66cc
cb/dedup-stream-sse-decoder-96cd
dependabot/npm_and_yarn/internal/bench/npm_and_yarn-18a2f9e291
cb/normalize-openai-function-call-tool-calls
cb/tmp
cb/remove-docs
nh/sdk-normalize-base-message-v2
nh/sdk-reencode-tool-call-chunks
nh/sdk-normalize-base-message
nh/stream-v2-final-split
open-swe/c802e0ea-c9e5-c8c6-824a-c065dd2bfd6f
hunter/memory-investigation-2
ramonn/checkpoint-durable-objects
open-swe/776ee51f-5e2f-752b-acb1-4584467156d4
hunter/issue-2303-regression-test
cb/api-stream-reducer
open-swe/77892c09-3e94-9f8a-5f5b-3d2787c5f6b9
cb/in-process-streaming
cb/langgraph-streaming-protocol-683b
cb/protocol-v2-tests-6203
cb/fix-custom-submit-options-ad3e
cb/protocol-thread-binding-clean-6303
hunter/keep-important-ids
cb/fix-protocol-thread-binding-6303
cb/react-protocol-runtime-8ca7
cb/pregel-eli5-doc-1103
cb/-bc-5a4705b9-850e-4f7d-95ea-67c0741e9977-92c3
cb/pr-branch-rebase-4816
cb/-bc-2d03efa3-5ef0-4b68-bf53-63005b8e748f-8924-angular-svelte
cb/-bc-2d03efa3-5ef0-4b68-bf53-63005b8e748f-8924
cb/langchain-react-ssr-proposal-972b
cb/agent-streaming-protocol-design-25d1
cb/custom-transport-queue-parity-2bb9
cb/frontend-integration-strategy-64ce
brydar/fix/parallel-interrupt-accumulation
cb/agent-multi-app-support-d2d0
cb/svelte-5-idiomatic-patterns-16ed
cb/frontend-sdks-developer-experience-8030
cb/ui-packages-idiomatic-review-35a4
hunter/fix-vercel-ci
fix/test-exports-vercel-next16-lint
dependabot/npm_and_yarn/internal/environment_tests/test-exports-vercel/npm_and_yarn-229c191f58
cb/stream-protocol-improvements
jdr/fix-sdk-errors
cb/async_hooks-fix
cwlbraa/fix-getmessages-null-state
chore/fix-dependabot-config
hunter/fix-symbol-types
hunter/symbol-fix
hunter/symbol-annotations
test-ci-trigger
hunter/lg-resolve-symbols
colifran/tool-stream-types
colifran/tool-stream-types-temp
dqbd/sdk-ui-other-fw
colifran/tool-streaming-example
colifran/tool-stream-example
fix/security-alerts-2026-02-19
cb/perf-improvements
jk/fix-rolldown-panic
cb/better-node-version-definition
cb/tsdown-setup
cb/create-changesets
cb/pnpm-fix4
cb/pnpm-fix2
wfh/fix_release
demo
cb/browser-tools
v0.3
pr/christymanthara/1787
cb/type-safe-streaming
mdrxy/delete-docs
changeset-release/v1
v1
v0
rd3
isaac/vb
dqbd/remove-get-graph-non-async
dqbd/serde-v1
dqbd/1.0.0-alpha.1
dqbd/max-version-cache
parker/custom-studio-url-cli
dqbd/standard-schema
dqbd/create-agent-middleware
dqbd/1.0.0-alpha
parker/api-linting
dqbd/prebuilt-restart-subgraph
dqbd/api-thread-join-stream
dqbd/persist-resume-map-values
wfh/default
dqbd/node-recursion-limit
sam_support_description_for_mcp
hunter/dedupe-signal-listeners
wfh/studio_auth_access
wfh/consistent_kind
release
brace/pass-update-generic-msgs-zod
dqbd/merge-api
hunter/zod-intersection
vb/add-forward-message-tool
dqbd/zod-metadata-json-schema-extra
wfh/js_node_finished
ben/checkpoint-metadata-custom-fields
dqbd/release-0.2.56-second
ben/docs-learning-path
ben/typed-exec
vb/support-checkpointer-true
dqbd/stream-mode-messages-input-no-emit
dqbd/tsc-module-es2020
jacob/nits
cc/docs_layout
dqbd/tasks-results
brace/update-how-to-hitl-index
jacob/sendv2
dqbd/command-goto
jacob/stream_messages
jacob/supabase
brace/updated-mem-conceptual
471
allan/first-agent-tutorial
brace/req-config
nc/23sep/stream-output
allan/subgraphs
brace/stores
brace/memory
jacob/rc
isaac/contextchannel
brace/subgraphs
wfh/typedocs
0.1
isaac/doclink
jacob/mongo
testing
nc/11aug/archs
jacob/streaming_tool_call
jacob/messagesstate
wfh/pae
wfh/moore_tutorials_tsc
wfh/drd
wfh/edgy
brace/langgraph-self-rag-oss
brace/prebuilt
brace/state-graph
brace/bump-lc-core
brace/typing
brace/examples
nc/fixup
brace/package-infra
brace/allow-channel-string
@langchain/vue@1.0.28
@langchain/svelte@1.0.28
@langchain/react@1.0.28
@langchain/langgraph-sdk@1.9.27
@langchain/angular@1.0.28
@langchain/vue@1.0.27
@langchain/svelte@1.0.27
@langchain/react@1.0.27
@langchain/langgraph@1.4.8
@langchain/langgraph-ui@1.4.3
@langchain/langgraph-sdk@1.9.26
@langchain/langgraph-cli@1.4.3
@langchain/langgraph-api@1.4.3
@langchain/angular@1.0.27
@langchain/langgraph-ui@1.4.2
@langchain/langgraph-cli@1.4.2
@langchain/langgraph-api@1.4.2
@langchain/langgraph@1.4.7
@langchain/vue@1.0.26
@langchain/svelte@1.0.26
@langchain/react@1.0.26
@langchain/langgraph@1.4.6
@langchain/langgraph-ui@1.4.1
@langchain/langgraph-sdk@1.9.25
@langchain/langgraph-cli@1.4.1
@langchain/langgraph-checkpoint@1.1.3
@langchain/langgraph-checkpoint-postgres@1.0.4
@langchain/langgraph-api@1.4.1
@langchain/angular@1.0.26
@langchain/vue@1.0.25
@langchain/svelte@1.0.25
@langchain/react@1.0.25
@langchain/langgraph@1.4.5
@langchain/langgraph-ui@1.4.0
@langchain/langgraph-sdk@1.9.24
@langchain/langgraph-cli@1.4.0
@langchain/langgraph-checkpoint-mongodb@1.4.0
@langchain/langgraph-api@1.4.0
@langchain/angular@1.0.25
@langchain/vue@1.0.24
@langchain/svelte@1.0.24
@langchain/react@1.0.24
@langchain/langgraph@1.4.4
@langchain/langgraph-sdk@1.9.23
@langchain/langgraph-checkpoint@1.1.2
@langchain/langgraph-checkpoint-redis@1.0.10
@langchain/angular@1.0.24
@langchain/vue@1.0.23
@langchain/svelte@1.0.23
@langchain/react@1.0.23
@langchain/langgraph@1.4.2
@langchain/langgraph-ui@1.3.1
@langchain/langgraph-supervisor@1.1.1
@langchain/langgraph-sdk@1.9.22
@langchain/langgraph-cli@1.3.1
@langchain/langgraph-checkpoint@1.1.1
@langchain/langgraph-checkpoint-redis@1.0.9
@langchain/langgraph-api@1.3.1
@langchain/angular@1.0.23
@langchain/vue@1.0.22
@langchain/svelte@1.0.22
@langchain/react@1.0.22
@langchain/langgraph@1.4.1
@langchain/langgraph-supervisor@1.1.0
@langchain/langgraph-sdk@1.9.21
@langchain/angular@1.0.22
@langchain/vue@1.0.21
@langchain/svelte@1.0.21
@langchain/react@1.0.21
@langchain/langgraph@1.4.0
@langchain/langgraph-checkpoint@1.1.0
@langchain/langgraph-checkpoint-sqlite@1.0.3
@langchain/langgraph-checkpoint-redis@1.0.8
@langchain/langgraph-checkpoint-postgres@1.0.3
@langchain/langgraph-checkpoint-mongodb@1.3.4
@langchain/angular@1.0.21
@langchain/vue@1.0.20
@langchain/svelte@1.0.20
@langchain/react@1.0.20
@langchain/langgraph-sdk@1.9.20
@langchain/angular@1.0.20
@langchain/vue@1.0.19
@langchain/svelte@1.0.19
@langchain/react@1.0.19
@langchain/langgraph@1.3.7
@langchain/langgraph-ui@1.3.0
@langchain/langgraph-sdk@1.9.19
@langchain/langgraph-cli@1.3.0
@langchain/langgraph-checkpoint-validation@1.1.0
@langchain/langgraph-checkpoint-sqlite@1.0.2
@langchain/langgraph-api@1.3.0
@langchain/angular@1.0.19
@langchain/vue@1.0.18
@langchain/svelte@1.0.18
@langchain/react@1.0.18
@langchain/langgraph-sdk@1.9.18
@langchain/angular@1.0.18
@langchain/vue@1.0.17
@langchain/svelte@1.0.17
@langchain/react@1.0.17
@langchain/langgraph@1.3.6
@langchain/langgraph-ui@1.2.5
@langchain/langgraph-sdk@1.9.17
@langchain/langgraph-cli@1.2.5
@langchain/langgraph-api@1.2.5
@langchain/angular@1.0.17
@langchain/vue@1.0.16
@langchain/svelte@1.0.16
@langchain/react@1.0.16
@langchain/langgraph@1.3.5
@langchain/langgraph-sdk@1.9.16
@langchain/angular@1.0.16
@langchain/vue@1.0.15
@langchain/svelte@1.0.15
@langchain/react@1.0.15
@langchain/langgraph-sdk@1.9.15
@langchain/angular@1.0.15
@langchain/vue@1.0.14
@langchain/svelte@1.0.14
@langchain/react@1.0.14
@langchain/langgraph-sdk@1.9.14
@langchain/angular@1.0.14
@langchain/vue@1.0.13
@langchain/svelte@1.0.13
@langchain/react@1.0.13
@langchain/langgraph-sdk@1.9.13
@langchain/angular@1.0.13
@langchain/vue@1.0.12
@langchain/svelte@1.0.12
@langchain/react@1.0.12
@langchain/langgraph@1.3.4
@langchain/langgraph-sdk@1.9.12
@langchain/langgraph-checkpoint-mongodb@1.3.3
@langchain/angular@1.0.12
@langchain/vue@1.0.11
@langchain/svelte@1.0.11
@langchain/react@1.0.11
@langchain/langgraph@1.3.3
@langchain/langgraph-ui@1.2.4
@langchain/langgraph-supervisor@1.0.4
@langchain/langgraph-sdk@1.9.11
@langchain/langgraph-cli@1.2.4
@langchain/langgraph-checkpoint@1.0.4
@langchain/langgraph-checkpoint-redis@1.0.7
@langchain/langgraph-checkpoint-postgres@1.0.2
@langchain/langgraph-checkpoint-mongodb@1.3.2
@langchain/langgraph-api@1.2.4
@langchain/angular@1.0.11
@langchain/vue@1.0.10
@langchain/svelte@1.0.10
@langchain/react@1.0.10
@langchain/langgraph-ui@1.2.3
@langchain/langgraph-sdk@1.9.10
@langchain/langgraph-cli@1.2.3
@langchain/langgraph-checkpoint@1.0.3
@langchain/langgraph-checkpoint-redis@1.0.6
@langchain/langgraph-api@1.2.3
@langchain/angular@1.0.10
@langchain/vue@1.0.9
@langchain/svelte@1.0.9
@langchain/react@1.0.9
@langchain/langgraph-sdk@1.9.9
@langchain/angular@1.0.9
@langchain/vue@1.0.8
@langchain/svelte@1.0.8
@langchain/react@1.0.8
@langchain/langgraph-sdk@1.9.8
@langchain/angular@1.0.8
@langchain/vue@1.0.7
@langchain/svelte@1.0.7
@langchain/react@1.0.7
@langchain/langgraph-sdk@1.9.7
@langchain/angular@1.0.7
@langchain/vue@1.0.6
@langchain/svelte@1.0.6
@langchain/react@1.0.6
@langchain/langgraph-sdk@1.9.6
@langchain/angular@1.0.6
@langchain/vue@1.0.5
@langchain/svelte@1.0.5
@langchain/react@1.0.5
@langchain/langgraph-supervisor@1.0.3
@langchain/langgraph-sdk@1.9.5
@langchain/langgraph-checkpoint-redis@1.0.5
@langchain/angular@1.0.5
@langchain/vue@1.0.4
@langchain/svelte@1.0.4
@langchain/react@1.0.4
@langchain/langgraph@1.3.2
@langchain/langgraph-sdk@1.9.4
@langchain/angular@1.0.4
@langchain/vue@1.0.3
@langchain/svelte@1.0.3
@langchain/langgraph@1.3.1
@langchain/langgraph-swarm@1.0.2
@langchain/langgraph-supervisor@1.0.2
@langchain/angular@1.0.3
@langchain/vue@1.0.2
@langchain/svelte@1.0.2
@langchain/react@1.0.2
@langchain/langgraph-sdk@1.9.2
@langchain/angular@1.0.2
@langchain/vue@1.0.1
@langchain/angular@1.0.1
@langchain/vue@1.0.0
@langchain/react@1.0.0
@langchain/langgraph-cli@1.2.0
@langchain/langgraph-api@1.2.0
@langchain/angular@1.0.0
@langchain/vue@0.4.7
@langchain/svelte@0.4.7
@langchain/react@0.3.5
@langchain/angular@0.4.7
@langchain/vue@0.4.6
@langchain/svelte@0.4.6
@langchain/react@0.3.4
@langchain/langgraph-sdk@1.8.10
@langchain/angular@0.4.6
@langchain/langgraph-checkpoint-mongodb@1.3.0
@langchain/langgraph@1.2.9
@langchain/langgraph-sdk@1.8.9
@langchain/langgraph@1.2.8
@langchain/vue@0.4.5
@langchain/svelte@0.4.5
@langchain/react@0.3.3
@langchain/langgraph-sdk@1.8.8
@langchain/angular@0.4.5
@langchain/vue@0.4.4
@langchain/svelte@0.4.4
@langchain/angular@0.4.4
@langchain/vue@0.4.3
@langchain/svelte@0.4.3
@langchain/angular@0.4.3
@langchain/vue@0.4.2
@langchain/svelte@0.4.2
@langchain/react@0.3.2
@langchain/langgraph-sdk@1.8.7
@langchain/angular@0.4.2
@langchain/vue@0.4.1
@langchain/svelte@0.4.1
@langchain/react@0.3.1
@langchain/langgraph-sdk@1.8.6
@langchain/angular@0.4.1
@langchain/vue@0.4.0
@langchain/svelte@0.4.0
@langchain/react@0.3.0
@langchain/langgraph@1.2.7
@langchain/angular@0.4.0
@langchain/vue@0.3.4
@langchain/svelte@0.3.2
@langchain/react@0.2.4
@langchain/langgraph-sdk@1.8.5
@langchain/angular@0.3.3
@langchain/vue@0.3.3
@langchain/langgraph-sdk@1.8.4
@langchain/vue@0.3.2
@langchain/langgraph-sdk@1.8.3
@langchain/angular@0.3.2
@langchain/react@0.2.3
@langchain/langgraph-sdk@1.8.2
@langchain/langgraph-ui@1.1.17
@langchain/langgraph-cli@1.1.17
@langchain/langgraph-api@1.1.17
@langchain/vue@0.3.1
@langchain/svelte@0.3.1
@langchain/react@0.2.2
@langchain/langgraph@1.2.6
@langchain/langgraph-sdk@1.8.1
@langchain/angular@0.3.1
@langchain/vue@0.3.0
@langchain/svelte@0.3.0
@langchain/react@0.2.1
@langchain/langgraph@1.2.5
@langchain/langgraph-sdk@1.8.0
@langchain/angular@0.3.0
@langchain/vue@0.2.0
@langchain/svelte@0.2.0
@langchain/react@0.2.0
@langchain/langgraph@1.2.4
@langchain/langgraph-sdk@1.7.5
@langchain/angular@0.2.0
@langchain/langgraph-sdk@1.7.4
@langchain/langgraph@1.2.3
@langchain/langgraph-ui@1.1.16
@langchain/langgraph-sdk@1.7.3
@langchain/langgraph-cli@1.1.16
@langchain/langgraph-checkpoint@1.0.1
@langchain/langgraph-checkpoint-redis@1.0.4
@langchain/langgraph-api@1.1.16
@langchain/langgraph-sdk@1.7.2
@langchain/vue@0.1.3
@langchain/svelte@0.1.3
@langchain/react@0.1.3
@langchain/langgraph-sdk@1.7.1
@langchain/angular@0.1.3
@langchain/vue@0.1.2
@langchain/svelte@0.1.2
@langchain/react@0.1.2
@langchain/angular@0.1.2
@langchain/langgraph@1.2.1
@langchain/langgraph-ui@1.1.15
@langchain/langgraph-cli@1.1.15
@langchain/langgraph-checkpoint-redis@1.0.3
@langchain/langgraph-api@1.1.15
@langchain/langgraph@1.2.0
@langchain/langgraph-ui@1.1.14
@langchain/langgraph-sdk@1.6.5
@langchain/langgraph-cli@1.1.14
@langchain/langgraph-checkpoint-mongodb@1.2.0
@langchain/langgraph-api@1.1.14
@langchain/langgraph-sdk@1.6.4
@langchain/langgraph-checkpoint-postgres@1.0.1
@langchain/langgraph-sdk@1.6.3
@langchain/langgraph@1.1.5
@langchain/langgraph-ui@2.0.0
@langchain/langgraph-sdk@2.0.0
@langchain/langgraph-cli@2.0.0
@langchain/langgraph-api@2.0.0
@langchain/langgraph-ui@1.1.13
@langchain/langgraph-sdk@1.6.2
@langchain/langgraph-cli@1.1.13
@langchain/langgraph-api@1.1.13
@langchain/langgraph-sdk@1.6.1
@langchain/langgraph@1.1.4
@langchain/langgraph-sdk@1.6.0
@langchain/langgraph-ui@1.1.12
@langchain/langgraph-sdk@1.5.6
@langchain/langgraph-cli@1.1.12
@langchain/langgraph-checkpoint-redis@1.0.2
@langchain/langgraph-checkpoint-mongodb@1.1.7
@langchain/langgraph-api@1.1.12
@langchain/langgraph@1.1.3
@langchain/langgraph-checkpoint-sqlite@1.0.1
@langchain/langgraph@1.1.2
@langchain/langgraph@1.1.1
@langchain/langgraph-sdk@1.5.5
@langchain/langgraph@1.1.0
@langchain/langgraph-sdk@1.5.4
@langchain/langgraph-sdk@1.5.3
@langchain/langgraph-checkpoint-validation@1.0.9
@langchain/langgraph-sdk@1.5.2
@langchain/langgraph-sdk@1.5.1
@langchain/langgraph@1.0.15
@langchain/langgraph-ui@1.1.11
@langchain/langgraph-sdk@1.5.0
@langchain/langgraph-cli@1.1.11
@langchain/langgraph-api@1.1.11
create-langgraph@1.1.5
@langchain/langgraph@1.0.14
@langchain/langgraph-ui@1.1.10
@langchain/langgraph-sdk@1.4.6
@langchain/langgraph-cli@1.1.10
@langchain/langgraph-checkpoint-validation@1.0.8
@langchain/langgraph-checkpoint-mongodb@1.1.6
@langchain/langgraph-api@1.1.10
@langchain/langgraph-api@1.1.9
@langchain/langgraph@1.0.13
@langchain/langgraph-ui@1.1.9
@langchain/langgraph-sdk@1.4.5
@langchain/langgraph-cli@1.1.9
@langchain/langgraph-checkpoint-validation@1.0.7
@langchain/langgraph-checkpoint-mongodb@1.1.5
create-langgraph@1.1.4
@langchain/langgraph-api@1.1.8
@langchain/langgraph@1.0.12
@langchain/langgraph-ui@1.1.8
@langchain/langgraph-sdk@1.4.4
@langchain/langgraph-cli@1.1.8
@langchain/langgraph-checkpoint-validation@1.0.6
@langchain/langgraph-checkpoint-mongodb@1.1.4
create-langgraph@1.1.3
@langchain/langgraph-ui@0.0.43
@langchain/langgraph-cli@0.0.43
@langchain/langgraph-api@0.0.43
@langchain/langgraph-api@0.0.42
@langchain/langgraph-ui@0.0.42
@langchain/langgraph-cli@0.0.42
@langchain/langgraph-sdk@0.0.90
0.3.6
0.3.5
0.3.4
supervisor==0.0.14
0.3.3
@langgraph-supervisor@0.0.14
0.3.2
0.3.1
0.3.0
checkpoint==0.0.18
swarm==0.0.4
supervisor==0.0.13
cua==0.0.6
0.2.74
0.2.73
checkpoint-sqlite==0.1.5
supervisor==0.0.12
0.2.72
0.2.71
0.2.70
0.2.69
checkpoint-postgres==0.0.5
@langchain/langgraph-checkpoint-postgres==0.0.5
0.2.68
0.2.67
0.2.66
0.2.65
0.2.64
supervisor==0.0.11
supervisor==0.0.10
0.2.63
0.2.57
0.2.56
0.2.35
0.2.59
0.2.40
0.2.58
0.2.62
0.2.61
0.2.60
0.2.55
0.2.54
checkpoint==0.0.16
swarm==0.0.3
supervisor==0.0.9
swarm==0.0.2
supervisor==0.0.8
0.2.53
0.2.52
swarm==0.0.1
supervisor==0.0.7
0.2.51
supervisor==0.0.6
supervisor==0.0.5
0.2.50
0.2.49
0.2.48
0.2.47
checkpoint-mongodb==0.0.6
checkpoint-postgres==0.0.4
0.2.46
0.2.45
0.2.44
checkpoint-postgres==0.0.3
checkpoint-sqlite==0.1.4
checkpoint-mongodb=0.0.5
checkpoint==0.0.15
0.2.43
0.2.42
checkpoint==0.0.14
0.2.41
0.2.39
0.2.38
0.2.37
0.2.36
0.2.34
0.2.33
0.2.32
0.2.31
0.2.30
0.2.29
0.2.28
0.2.27
0.2.26
0.2.25
0.2.24
0.2.23
0.2.22
0.2.21
0.2.20
0.2.19
0.2.18
0.2.17
0.2.16
0.2.15
0.2.14
0.2.13
0.2.12
0.2.11
0.2.10
0.2.9
0.2.8
0.2.7
0.2.6
0.2.5
0.2.4
0.2.3
0.2.2
0.2.1
0.2.0
0.1.9
0.1.8
0.1.7
0.1.6
0.1.5
0.1.4
0.1.3
0.1.2
0.1.1
0.1.0
0.0.34
0.0.33
0.0.32
0.0.31
0.0.30
0.0.29
0.0.28
0.0.27
0.0.26
0.0.25
0.0.24
0.0.23
0.0.22
0.0.21
0.0.20
0.0.19
0.0.18
0.0.17
0.0.16
0.0.15
0.0.14
0.0.13
0.0.12
0.0.11
0.0.10
0.0.9
0.0.8
0.0.7
0.0.6
0.0.5
0.0.4
0.0.3
0.0.2
0.0.1
No Label
Milestone
No items
No Milestone
Projects
Clear projects
No project
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: langchain-ai/langgraphjs#74
Reference in New Issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @benjamincburns on GitHub (Aug 27, 2024).
I may be missing something, but at present it doesn't look like LangGraph.js has addressed the concern of stateful tools, or if it has, I don't think this is well covered in documentation yet.
For example, let's say that I have an agent with query and analysis functionality. Perhaps it queries a database for some data, and then analyzes that data in a code execution environment. How do I plumb that together via the state management system?
Let's say that I use a
ToolNodefor this. The query tool can be written to return an artifact, which arguably solves the first step of getting the data from the query tool into the state manager. However I'm not seeing a clear path for how I'd then go about providing this artifact as part of the input to tool calls to the code execution tool.I suppose I could intercept the artifact via a reducer on the message state, and then provide it to the code execution environment at that stage, but it feels quite wrong to have side-effects in a reducer object.
Is there an intended approach for something like this? One way I could see to do it without modifications to LangGraph or LangChain would be to define a node for each tool handler that needs to manage state, and then handle the routing to tool handlers via conditional edges, but this seems rather cumbersome, especially if you may want to dynamically manage which tools are available, or if you want to allow for fully modular tool definitions.
Edit: the idea in the paragraph below was flawed. See this comment for details.
If there isn't an intended approach, perhaps a solution would be to make it possible to specify custom input state transform logic for each tool in theToolNode, defaulting to the current state transform logic in the case (to avoid breaking existing code). That way I can specify an input state transformer as part of my tool module, and autowire that up to the ToolNode on application initialization, without having to have tool-specific logic defined in myToolNodeinitialization logic.I'm not particularly convinced that this is the only or best way to solve this, though - and if there's already a solution for this, I'd be very happy if the only outcome of this issue were for it to be discussed more explicitly/clearly in the docs.
@benjamincburns commented on GitHub (Aug 27, 2024):
Edit: this strategy was flawed - see this comment for an explanation.
Happy to submit this as a PR if you guys like it, but here's the customToolNodeimplementation that I wrote for my own project. Just attaching it here to see if it passes the sniff test before I refactor it for inclusion into your repo. Note that this is not yet tested in my application, but hopefully it gets the gist across.@benjamincburns commented on GitHub (Aug 28, 2024):
Sigh - it just occurred to me that I've written the above against 0.0.34, not 0.1.x.
I'll have a crack at refactoring it for 0.1.4 tomorrow.
@benjamincburns commented on GitHub (Aug 28, 2024):
On further reflection, I don't think the strategy above will work, due to the need to bind the tools to the model. The input schema that is used during binding is used to check the inputs passed to
StructuredTool.invoke.That is, if I modify the input type of my tool to be something like
{ args: LLMGeneratedToolArgsT, artifacts: ArtifactT }, the LLM will be prompted to generate inputs that match that type, not theLLMGeneratedToolArgsTtype. Back to the drawing board, I guess.@benjamincburns commented on GitHub (Aug 29, 2024):
I think I've reached the conclusion that
ToolNodeis really only the right approach for stateless tools. The moment you add any stateful tools, you'll either need to roll your ownToolNode, or implement a graph structure where you have a node per tool handler, and you use conditional branching for parallel execution in the case when the LLM makes multiple tool calls.Rolling your own
ToolNodeis probably fine for smaller projects, but as the complexity of the project goes it seems likely to become an incohesive dumping ground for state transform logic for a bunch of unrelated tools.Personally I'd like it better if LangGraph could ship some prebuilt components to make the latter approach (a node per tool handler) the easy default, as that would make tools feel more like first-class citizens w.r.t. state management data flows, and make it easier to implement tools in a more modular, pluggable fashion. The major benefit there would be that it would allow me to point a new team member at some well-defined existing structures and just say "use that and fill in the blanks."
In the meantime I'll be reworking my own project for this approach, and if I happen to come up with some nice reusable structure for this, I'll be happy to share details here and/or submit it as a PR. That said, I expect that the LangGraph team would want some degree of parity between the Python and JS projects for this, and I'm not sure that I can address both sides of that equation here, as this is day job work for me, and it'll be difficult to explain to my bosses why I'm submitting PRs for libraries/frameworks that we're not using in our product 😅.
@benjamincburns commented on GitHub (Sep 29, 2024):
Closing this, as I'm not sure it's in a good state for discussion - I won't be offended if the maintainers decide to reopen, however.
My solution in the end was a bit convoluted. I had to decouple the type expected as the input argument for the
StructuredTool._callmethod from the type described by the schema that gets used during thellm.bindToolscall.To do this, I wrote an abstract
StateAugmentedToolclass that extendsStructuredTooland allows child classes to define aaugmentedInputSchemaand aaugmentInputmethod. I'm using zod in my application, so the schema defines the actual input argument type for the_callmethod, and theaugmentInputmethod gets called by a conditional edge. It gets the application state and the input arg that the LLM generated as input, and returns an object that conforms to theautmentedInputSchema.The conditional edge that calls the
augmentInputmethod creates a fake/transformedAIMessagefrom the augmented input objects, and sends this fake message to theToolNoderather than the real state by returning something likenew Send('tools', { messages: [ aiMessageWithAugmentedToolCalls ] }).Hope this helps, in case there's anyone who needs something similar.
Personally I think there needs to be some consideration given as to how to officially support this sort of pattern, as I think the current
ToolNodeis too "tight" of an encapsulation, in that there's no direct way to allow individual tools to inspect application state. Or at least - no direct way that I'm currently aware of, but this project is moving fast, so I wouldn't be surprised if I missed something.