Skip to content

Commit 52d1925

Browse files
author
Pierre
committed
refactor(examples): update agent function signatures
- Change return type from Run[Output] to Output directly - Add .run() method calls to execute agent functions - Clean up imports ordering
1 parent b440b6c commit 52d1925

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

examples/02_agent_with_tools.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,12 @@
99

1010
import asyncio
1111
from datetime import date, datetime
12+
from zoneinfo import ZoneInfo
1213

1314
from pydantic import BaseModel, Field
14-
from zoneinfo import ZoneInfo
1515

1616
import workflowai
17-
from workflowai import Model, Run
17+
from workflowai import Model
1818

1919

2020
def get_current_date() -> str:
@@ -65,7 +65,7 @@ class HistoricalEventOutput(BaseModel):
6565
model=Model.GEMINI_1_5_FLASH_LATEST,
6666
tools=[get_current_date, calculate_days_between],
6767
)
68-
async def analyze_historical_event(event_input: HistoricalEventInput) -> Run[HistoricalEventOutput]:
68+
async def analyze_historical_event(event_input: HistoricalEventInput) -> HistoricalEventOutput:
6969
"""
7070
Find information about historical events and calculate days since they occurred.
7171
@@ -88,7 +88,7 @@ async def main():
8888
# Example: Query about the moon landing
8989
print("\nExample: First Moon Landing")
9090
print("-" * 50)
91-
result = await analyze_historical_event(
91+
result = await analyze_historical_event.run(
9292
HistoricalEventInput(query="When was the first moon landing?"),
9393
)
9494
print(result.output)
@@ -99,7 +99,7 @@ async def main():
9999
# Example: Query about World War II
100100
print("\nExample: End of World War II")
101101
print("-" * 50)
102-
result = await analyze_historical_event(
102+
result = await analyze_historical_event.run(
103103
HistoricalEventInput(query="When did World War II end?"),
104104
)
105105
print(result.output)

0 commit comments

Comments
 (0)