Skip to content

Commit af01a3f

Browse files
committed
revert agent code
1 parent 92460d3 commit af01a3f

File tree

1 file changed

+17
-31
lines changed

1 file changed

+17
-31
lines changed

libs/agno/agno/agent/agent.py

Lines changed: 17 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
from agno.run.team import TeamRunResponse
4040
from agno.storage.base import Storage
4141
from agno.storage.session.agent import AgentSession
42-
from agno.tools.function import Function, FunctionCallResult
42+
from agno.tools.function import Function
4343
from agno.tools.toolkit import Toolkit
4444
from agno.utils.log import (
4545
log_debug,
@@ -783,25 +783,11 @@ def _run(
783783
}
784784
# Process tool calls
785785
for tool_call_dict in new_tool_calls_list:
786-
print("--> 1")
787786
tool_call_id = tool_call_dict.get("tool_call_id")
788787
index = tool_call_index_map.get(tool_call_id)
789788
if index is not None:
790-
print("--> 2")
791-
# process the FunctionCallResult
792-
tool_result = tool_call_dict.get("tool_result")
793-
if isinstance(tool_result, FunctionCallResult):
794-
# Add any images from the tool result
795-
print("--> 3")
796-
if tool_result.images:
797-
for image in tool_result.images:
798-
self.add_image(image)
799-
print("--> tool result images", tool_result)
800-
tool_call_dict["tool_result"] = str(tool_result)
801-
802789
self.run_response.tools[index] = tool_call_dict
803790
else:
804-
print("--> 4")
805791
self.run_response.tools = new_tool_calls_list
806792

807793
# Only iterate through new tool calls
@@ -878,14 +864,6 @@ def _run(
878864

879865
# For Reasoning/Thinking/Knowledge Tools update reasoning_content in RunResponse
880866
for tool_call in model_response.tool_calls:
881-
tool_result = tool_call.get("tool_result")
882-
if isinstance(tool_result, FunctionCallResult):
883-
# Add any images from the tool result
884-
if tool_result.images:
885-
for image in tool_result.images:
886-
self.add_image(image)
887-
# Update the tool call result with the string content
888-
tool_call_dict["tool_result"] = str(tool_result)
889867
tool_name = tool_call.get("tool_name", "")
890868
if tool_name.lower() in ["think", "analyze"]:
891869
tool_args = tool_call.get("tool_args", {})
@@ -1673,7 +1651,8 @@ async def _arun(
16731651
# Add AgentRun to memory
16741652
self.memory.add_run(session_id=session_id, run=self.run_response)
16751653

1676-
await self._amake_memories_and_summaries(run_messages, session_id, user_id, messages) # type: ignore
1654+
# type: ignore
1655+
await self._amake_memories_and_summaries(run_messages, session_id, user_id, messages)
16771656

16781657
if self.session_metrics is None:
16791658
self.session_metrics = self.calculate_metrics(run_messages.messages) # Calculate metrics for the run
@@ -2620,7 +2599,8 @@ def add_introduction(self, introduction: str) -> None:
26202599
response=RunResponse(
26212600
content=introduction,
26222601
messages=[
2623-
Message(role=self.model.assistant_message_role, content=introduction) # type: ignore
2602+
# type: ignore
2603+
Message(role=self.model.assistant_message_role, content=introduction)
26242604
],
26252605
)
26262606
)
@@ -2731,7 +2711,8 @@ def get_system_message(self, session_id: str, user_id: Optional[str] = None) ->
27312711
and (not self.use_json_mode or self.structured_outputs is True)
27322712
)
27332713
):
2734-
sys_message_content += f"\n{get_json_output_prompt(self.response_model)}" # type: ignore
2714+
# type: ignore
2715+
sys_message_content += f"\n{get_json_output_prompt(self.response_model)}"
27352716

27362717
# type: ignore
27372718
return Message(role=self.system_message_role, content=sys_message_content)
@@ -2965,7 +2946,8 @@ def get_system_message(self, session_id: str, user_id: Optional[str] = None) ->
29652946
(self.model.supports_native_structured_outputs or self.model.supports_json_schema_outputs)
29662947
and (not self.use_json_mode or self.structured_outputs is True)
29672948
):
2968-
system_message_content += f"{get_json_output_prompt(self.response_model)}" # type: ignore
2949+
# type: ignore
2950+
system_message_content += f"{get_json_output_prompt(self.response_model)}"
29692951

29702952
# Return the system message
29712953
return (
@@ -3489,7 +3471,8 @@ def get_relevant_docs_from_knowledge(
34893471
if invalid_keys:
34903472
# type: ignore
34913473
log_warning(f"Invalid filter keys provided: {invalid_keys}. These filters will be ignored.")
3492-
log_info(f"Valid filter keys are: {self.knowledge.valid_metadata_filters}") # type: ignore
3474+
# type: ignore
3475+
log_info(f"Valid filter keys are: {self.knowledge.valid_metadata_filters}")
34933476

34943477
# Only use valid filters
34953478
filters = valid_filters
@@ -3546,7 +3529,8 @@ async def aget_relevant_docs_from_knowledge(
35463529
# Warn about invalid filter keys
35473530
if invalid_keys: # type: ignore
35483531
log_warning(f"Invalid filter keys provided: {invalid_keys}. These filters will be ignored.")
3549-
log_info(f"Valid filter keys are: {self.knowledge.valid_metadata_filters}") # type: ignore
3532+
# type: ignore
3533+
log_info(f"Valid filter keys are: {self.knowledge.valid_metadata_filters}")
35503534

35513535
# Only use valid filters
35523536
filters = valid_filters
@@ -4036,7 +4020,8 @@ def reason(self, run_messages: RunMessages, session_id: Optional[str] = None) ->
40364020
from agno.reasoning.helpers import get_next_action, update_messages_with_reasoning
40374021

40384022
# Get default reasoning agent
4039-
reasoning_agent: Optional[Agent] = self.reasoning_agent # type: ignore
4023+
# type: ignore
4024+
reasoning_agent: Optional[Agent] = self.reasoning_agent
40404025
if reasoning_agent is None:
40414026
reasoning_agent = get_default_reasoning_agent(
40424027
reasoning_model=reasoning_model,
@@ -4247,7 +4232,8 @@ async def areason(self, run_messages: RunMessages, session_id: Optional[str] = N
42474232
from agno.reasoning.helpers import get_next_action, update_messages_with_reasoning
42484233

42494234
# Get default reasoning agent
4250-
reasoning_agent: Optional[Agent] = self.reasoning_agent # type: ignore
4235+
# type: ignore
4236+
reasoning_agent: Optional[Agent] = self.reasoning_agent
42514237
if reasoning_agent is None:
42524238
reasoning_agent = get_default_reasoning_agent(
42534239
reasoning_model=reasoning_model,

0 commit comments

Comments
 (0)