MCPcopy Create free account
hub / github.com/AgentOps-AI/agentops / run

Method run

examples/agno/agno_workflow_setup.py:55–84  ·  view source on GitHub ↗

Execute the workflow with caching logic. This method: 1. Checks if the response is already cached 2. Returns cached response immediately if found 3. Generates new response if not cached 4. Caches the new response for future use Args:

(self, message: str)

Source from the content-addressed store, hash-verified

53 agent = Agent(model=OpenAIChat(id="gpt-4o-mini"), description="General purpose agent for generating responses")
54
55 def run(self, message: str) -> Iterator[RunResponse]:
56 """
57 Execute the workflow with caching logic.
58
59 This method:
60 1. Checks if the response is already cached
61 2. Returns cached response immediately if found
62 3. Generates new response if not cached
63 4. Caches the new response for future use
64
65 Args:
66 message: The input query to process
67
68 Yields:
69 RunResponse: Streamed response chunks
70 """
71 logger.info(f"Checking cache for '{message}'")
72
73 if self.session_state.get(message):
74 logger.info(f"Cache hit for '{message}'")
75 # Return cached response immediately (no API call needed)
76 yield RunResponse(run_id=self.run_id, content=self.session_state.get(message))
77 return
78
79 logger.info(f"Cache miss for '{message}'")
80
81 yield from self.agent.run(message, stream=True)
82
83 self.session_state[message] = self.agent.run_response.content
84 logger.info("Cached response for future use")
85
86
87def demonstrate_workflows():

Callers 8

demonstrate_workflowsFunction · 0.95
ag2_async_agent.pyFile · 0.45
MathAgent.pyFile · 0.45
AgentChat.pyFile · 0.45
demonstrate_basic_agentsFunction · 0.45

Calls 1

getMethod · 0.45

Tested by

no test coverage detected