Skip to content

Conversation

tylerslaton
Copy link
Contributor

@tylerslaton tylerslaton commented Sep 24, 2025

Port of #415 for testing + small chore fixes

Original description

There was a small bug in the llama-index examples that used state

Basically, the tools that modify state need to save it at the end. Otherwise, there is a final state snapshot event emitted from the integration code that will erase all the modifications that have been made to the state so far

The fix is just to add await ctx.store.set("state", state) -- however, newer versions of llama-index workflows have an async context manager to make it even easier to access and modify state safely. Within the context manager, no other tool can modify state, so its safe if the agent makes multiple tool calls at once.

@tylerslaton tylerslaton changed the title Run tests for "Logan/fix stateful examples" Run tests, remove fixmes for #415 Sep 24, 2025
@tylerslaton tylerslaton changed the title Run tests, remove fixmes for #415 fix stateful llama-index examples Sep 24, 2025
@tylerslaton tylerslaton force-pushed the logan/fix_stateful_examples branch from fa3bc53 to a68e5b7 Compare September 24, 2025 19:12
@tylerslaton tylerslaton merged commit f5940f6 into main Sep 24, 2025
18 checks passed
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.

2 participants