Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: add a how-to on updating state from tools #2670

Merged
merged 37 commits into from
Dec 10, 2024

Conversation

vbarda
Copy link
Collaborator

@vbarda vbarda commented Dec 6, 2024

No description provided.

@vbarda vbarda requested a review from eyurtsev December 6, 2024 22:38
@eyurtsev
Copy link
Contributor

eyurtsev commented Dec 7, 2024

for how to guide:

MAJOR:

  1. The how-to guide makes it seem like it works for any tool, but it only works for tools that are executed using the create react agent.

MINOR:

  1. the snippet at the top of the how-to guide is doing the reverse of what the code does
  • snippet shows something based on state and looks up customer id
  • actual code takes id from config and looks up user info

NIT:

  1. Perhaps separate the user info information into a separate cell so it doesn't appear above the imports (a bit jarring to see that)

@vbarda
Copy link
Collaborator Author

vbarda commented Dec 8, 2024

  1. The how-to guide makes it seem like it works for any tool, but it only works for tools that are executed using the create react agent.

Thanks for the feedback! addressed (2) and (3) and added a callout for (1)

@ShetRo
Copy link

ShetRo commented Dec 9, 2024

I tested the above code, by commenting out the state modifier as below, and still get the same result.. also when i try to print out the state status, i only see Message , i dont see other parameter such as last_name and user_info.

agent = create_react_agent(
model,
# pass the tool that can update state
[lookup_user_info],
state_schema=State,
# pass dynamic prompt function
#state_modifier=state_modifier,
)

@vbarda
Copy link
Collaborator Author

vbarda commented Dec 9, 2024

I tested the above code, by commenting out the state modifier as below, and still get the same result.. also when i try to print out the state status, i only see Message , i dont see other parameter such as last_name and user_info.

agent = create_react_agent( model, # pass the tool that can update state [lookup_user_info], state_schema=State, # pass dynamic prompt function #state_modifier=state_modifier, )

@ShetRo note that this notebook is on top of another PR that hasn't been merged and released yet. you'd need to install langgraph from source if you want to test this

@vbarda vbarda marked this pull request as ready for review December 9, 2024 14:58
@ShetRo
Copy link

ShetRo commented Dec 9, 2024

thanks my bad

Base automatically changed from vb/tool-node-support-command to main December 10, 2024 15:18
@vbarda vbarda enabled auto-merge (squash) December 10, 2024 15:47
@vbarda vbarda disabled auto-merge December 10, 2024 16:20
@vbarda vbarda merged commit 97a5101 into main Dec 10, 2024
57 checks passed
@vbarda vbarda deleted the vb/add-tool-state-update-howto branch December 10, 2024 16:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants