I am trying to run the CacheWorkflow example (What are Workflows? - Agno).
However, when I call the .run() method, I get the following error:
TypeError: Workflow.run_workflow() takes 1 positional argument but 2 were given
I am trying to run the CacheWorkflow example (What are Workflows? - Agno).
However, when I call the .run() method, I get the following error:
TypeError: Workflow.run_workflow() takes 1 positional argument but 2 were given
This is the code I am using
class CacheWorkflow(Workflow):
# Purely descriptive, not used by the workflow
description: str = "A workflow that caches previous outputs"
# Add agents or teams as attributes on the workflow
agent = Agent(model=model)
# Write the logic in the `run()` method
def run(self, message: str) -> Iterator[RunResponse]:
logger.info(f"Checking cache for '{message}'")
# Check if the output is already cached
if self.session_state.get(message):
logger.info(f"Cache hit for '{message}'")
yield RunResponse(run_id=self.run_id, content=self.session_state.get(message))
return
logger.info(f"Cache miss for '{message}'")
# Run the agent and yield the response
yield from self.agent.run(message, stream=True)
# Cache the output after response is yielded
self.session_state[message] = self.agent.run_response.content
foo = CacheWorkflow()
response = foo.run("What time is it?")
This is the error message:
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
Cell In[1], line 55
51 self.session_state[message] = self.agent.run_response.content
54 foo = CacheWorkflow()
---> 55 response = foo.run("What time is it?")
TypeError: Workflow.run_workflow() takes 1 positional argument but 2 were given
I am using version 1.5.10. I have also updated to the current version 1.6.2 and get the same error.
Hey @foo_bar
thanks for reaching out and supporting Agno. I’ve shared this with the team, we’re working through all requests one by one and will get back to you soon.
If it’s urgent, please let us know. We appreciate your patience!
Hi @foo_bar
You will have to pass the message like this , since run function take message as input
response = foo.run(message="What time is it?")
Its working for me when i do it like the above.