mirror of
https://github.com/trycua/computer.git
synced 2026-01-08 22:40:06 -06:00
Merge pull request #155 from trycua/feature/agent/demo-video-maker
[Agent] Add standardized agent trajectory logging
This commit is contained in:
@@ -279,6 +279,8 @@ class AnthropicLoop(BaseLoop):
|
||||
messages,
|
||||
model=self.model,
|
||||
)
|
||||
# Log standardized response for ease of parsing
|
||||
self._log_api_call("agent_response", request=None, response=openai_compatible_response)
|
||||
await queue.put(openai_compatible_response)
|
||||
|
||||
if not should_continue:
|
||||
|
||||
@@ -670,6 +670,8 @@ class OmniLoop(BaseLoop):
|
||||
parsed_screen=parsed_screen,
|
||||
parser=self.parser
|
||||
)
|
||||
# Log standardized response for ease of parsing
|
||||
self._log_api_call("agent_response", request=None, response=openai_compatible_response)
|
||||
|
||||
# Yield the response to the caller
|
||||
yield openai_compatible_response
|
||||
|
||||
@@ -276,6 +276,10 @@ class OpenAILoop(BaseLoop):
|
||||
)
|
||||
# Don't reset last_response_id to None - keep the previous value if available
|
||||
|
||||
|
||||
# Log standardized response for ease of parsing
|
||||
# Since this is the openAI responses format, we don't need to convert it to agent response format
|
||||
self._log_api_call("agent_response", request=None, response=response)
|
||||
# Process API response
|
||||
await queue.put(response)
|
||||
|
||||
|
||||
@@ -440,7 +440,7 @@ class UITARSLoop(BaseLoop):
|
||||
# MAIN LOOP - IMPLEMENTING ABSTRACT METHOD
|
||||
###########################################
|
||||
|
||||
async def run(self, messages: List[Dict[str, Any]]) -> AsyncGenerator[Dict[str, Any], None]:
|
||||
async def run(self, messages: List[Dict[str, Any]]) -> AsyncGenerator[AgentResponse, None]:
|
||||
"""Run the agent loop with provided messages.
|
||||
|
||||
Args:
|
||||
@@ -513,6 +513,8 @@ class UITARSLoop(BaseLoop):
|
||||
messages,
|
||||
model=self.model,
|
||||
)
|
||||
# Log standardized response for ease of parsing
|
||||
self._log_api_call("agent_response", request=None, response=agent_response)
|
||||
yield agent_response
|
||||
|
||||
# Check if we should continue this conversation
|
||||
|
||||
Reference in New Issue
Block a user