Skip to content

armgit / burr

Public Imported from GitHub
0

Build applications that make decisions (chatbots, agents, simulations, etc...). Monitor, trace, persist, and execute on your own infrastructure.

Resets counter app to entrypoint on completion of count

elijahbenizzy4b332b7a007e
diff --git a/burr/core/application.py b/burr/core/application.py
index 69591f00..98091af0 100644
--- a/burr/core/application.py
+++ b/burr/core/application.py
@@ -561,7 +561,8 @@ class Application:
return next_action, result, new_state
def reset_to_entrypoint(self) -> None:
- """Resets the state machine to the entrypoint action."""
+ """Resets the state machine to the entrypoint action -- you probably want to consider having a loop
+ in your graph, but this will do the trick if you need it!"""
self._set_state(self._state.wipe(delete=[PRIOR_STEP]))
def _update_internal_state_value(self, new_state: State, next_action: Action) -> State:
diff --git a/examples/hello-world-counter/streamlit_app.py b/examples/hello-world-counter/streamlit_app.py
index 255bfaa4..4bc37b67 100644
--- a/examples/hello-world-counter/streamlit_app.py
+++ b/examples/hello-world-counter/streamlit_app.py
@@ -22,6 +22,7 @@ def counter_view(app_state: AppState):
set_slider_to_current()
else:
application.update_state(application.state.update(counter=0))
+ application.reset_to_entrypoint()
action, result, state = application.step()
app_state.history.append(Record(state.get_all(), action.name, result))