You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Running Tasks docs say that with cf.run_tasks() "All of the tasks will be run as part of the same flow (if you are not already operating in a flow context), ..."
I'm not observing that behavior with the code snippet below.
A flow run is created if you use the @cf.flow decorator.
Example Code
importcontrolflowascffromlangchain_community.toolsimportDuckDuckGoSearchRunsummarizer=cf.Agent(
name="Headline Summarizer",
instructions="An AI agent that fetches and summarizes current events",
tools=[DuckDuckGoSearchRun()],
)
extractor=cf.Agent(
name="Entity Extractor",
instructions="An AI agent that does named entity recognition",
)
# @cf.flow() # uncomment and the flow is createddefget_headlines():
summarizer_task=cf.Task(
"Retrieve and summarize today's two top business headlines",
agents=[summarizer],
result_type=list[str],
)
extractor_task=cf.Task(
"Extract any fortune 500 companies mentioned in the headlines and whether the sentiment is positive, neutral, or negative",
agents=[extractor],
depends_on=[summarizer_task],
)
results=cf.run_tasks([summarizer_task, extractor_task])
returnresultsif__name__=="__main__":
results=get_headlines()
print(results)
Description
Running Tasks docs say that with
cf.run_tasks()
"All of the tasks will be run as part of the same flow (if you are not already operating in a flow context), ..."I'm not observing that behavior with the code snippet below.
A flow run is created if you use the
@cf.flow
decorator.Example Code
Version Information
The text was updated successfully, but these errors were encountered: