DAGWorks-Inc / burr

Build applications that make decisions (chatbots, agents, simulations, etc...). Monitor, trace, persist, and execute on your own infrastructure.
https://burr.dagworks.io
BSD 3-Clause Clear License
1.14k stars 62 forks source link

Add ability to reset an application #335

Open skrawcz opened 1 month ago

skrawcz commented 1 month ago

Is your feature request related to a problem? Please describe. Instead of creating a new application every time, what if we could reset some "state" and "application-y" things about it?

Describe the solution you'd like Things that could be helpful:

Describe alternatives you've considered You just reinstantiate the graph each time.

Additional context This is mainly an edge case around stateless web-services. Do you create new, or reset the state?

elijahbenizzy commented 1 month ago

Is your feature request related to a problem? Please describe. Instead of creating a new application every time, what if we could reset some "state" and "application-y" things about it?

Describe the solution you'd like Things that could be helpful:

  • .set_state(...)
  • .set_identifiers(...)
  • .set_next_action(action_name)

Describe alternatives you've considered You just reinstantiate the graph each time.

Additional context This is mainly an edge case around stateless web-services. Do you create new, or reset the state?

.set_state is already supported. .set_next_action could be interesting, but why would we do it out of band? .set_identifiers is iffy -- we shouldn't have the same application object have two separate set of IDs.

I think we want to create new, and make it easier for that to happen.

app = ...
new_app = app.fork(reinitialize=True)

There is almost no case in which the object management here is going to be problematic (if you have billions of them you'll probably have the scale to back it up).