Skip to content

Commit

Permalink
Merge pull request #250 from PrefectHQ/thread-kwarg
Browse files Browse the repository at this point in the history
fix flow thread kwarg
  • Loading branch information
jlowin authored Aug 5, 2024
2 parents ba2338c + 5e88a61 commit 4625028
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
20 changes: 20 additions & 0 deletions examples/memory_between_flows.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import controlflow as cf

thread_id = "test-thread"


@cf.flow(thread=thread_id)
def flow_1():
task = cf.Task("get the user's name", result_type=str, user_access=True)
return task


@cf.flow(thread=thread_id)
def flow_2():
task = cf.Task("write the user's name backwards, if you don't know it, say so")
return task


if __name__ == "__main__":
flow_1()
flow_2()
2 changes: 1 addition & 1 deletion src/controlflow/decorators.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ def wrapper(
flow_kwargs = kwargs | (flow_kwargs or {})

if thread is not None:
flow_kwargs.setdefault("thread", thread)
flow_kwargs.setdefault("thread_id", thread)
if tools is not None:
flow_kwargs.setdefault("tools", tools)
if agents is not None:
Expand Down

0 comments on commit 4625028

Please sign in to comment.