Skip to content

Commit c5e05ba

Browse files
committed
format, lint, and mypy all the files I touched.
1 parent 302291a commit c5e05ba

File tree

2 files changed

+10
-7
lines changed

2 files changed

+10
-7
lines changed

examples/agent_patterns/agents_as_tools_with_history.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import asyncio
22
import tempfile
3+
from typing import cast
34

45
from agents import Agent, Runner, SQLiteSession, trace
56
from agents.tool import function_tool
@@ -31,7 +32,6 @@
3132

3233

3334
async def main(session_id, file_path):
34-
3535
@function_tool
3636
async def check_tool() -> str:
3737
"""A tool that looks at the entire conversation, checks
@@ -61,8 +61,7 @@ async def check_tool() -> str:
6161
check_agent,
6262
input=input_messages,
6363
)
64-
return output.final_output
65-
64+
return cast(str, output.final_output)
6665

6766
orchestrator_agent = Agent(
6867
name="orchestrator_agent",
@@ -85,8 +84,8 @@ async def check_tool() -> str:
8584
tool_name="translate_to_italian",
8685
tool_description="Translate the user's message to Italian",
8786
),
88-
check_tool
89-
]
87+
check_tool,
88+
],
9089
)
9190

9291
msg = input("Hi! What would you like translated? ")

src/agents/run.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -844,11 +844,15 @@ async def _start_streaming(
844844
streamed_result.is_complete = True
845845

846846
# Save the conversation to session if enabled
847-
await AgentRunner._save_result_to_session(session, [], turn_result.new_step_items)
847+
await AgentRunner._save_result_to_session(
848+
session, [], turn_result.new_step_items
849+
)
848850

849851
streamed_result._event_queue.put_nowait(QueueCompleteSentinel())
850852
elif isinstance(turn_result.next_step, NextStepRunAgain):
851-
await AgentRunner._save_result_to_session(session, [], turn_result.new_step_items)
853+
await AgentRunner._save_result_to_session(
854+
session, [], turn_result.new_step_items
855+
)
852856
except AgentsException as exc:
853857
streamed_result.is_complete = True
854858
streamed_result._event_queue.put_nowait(QueueCompleteSentinel())

0 commit comments

Comments
 (0)