Python: [BREAKING] changed AIFunction to FunctionTool and @ai_function to @tool (#3413)

* changed AIFunction to FunctionTool and @ai_function to @tool

* test and mypy fixes

* mypy fix

* switch function tool to always_require

* fix noop

* fix github copilot imports

* test fixes

* fix ollama test

* fixes for tests

* fix tests

* reverted change to always_require and extended timeout

* fix test
This commit is contained in:
Eduard van Valkenburg
2026-01-28 15:53:53 +01:00
committed by GitHub
Unverified
parent 15b43f2abe
commit a7d924a7d2
255 changed files with 1202 additions and 1290 deletions
@@ -12,11 +12,11 @@ This example demonstrates advanced AGUIChatClient features including:
import asyncio
import os
from agent_framework import ai_function
from agent_framework import tool
from agent_framework.ag_ui import AGUIChatClient
@ai_function
@tool
def get_weather(location: str) -> str:
"""Get the current weather for a location.
@@ -33,7 +33,7 @@ def get_weather(location: str) -> str:
return weather_data.get(location.lower(), f"Weather data not available for {location}")
@ai_function
@tool
def calculate(a: float, b: float, operation: str) -> str:
"""Perform basic arithmetic operations.
@@ -22,7 +22,7 @@ import asyncio
import logging
import os
from agent_framework import ChatAgent, ai_function
from agent_framework import ChatAgent, tool
from agent_framework.ag_ui import AGUIChatClient
# Enable debug logging
@@ -33,7 +33,7 @@ logging.basicConfig(
logger = logging.getLogger(__name__)
@ai_function(description="Get the current weather for a location.")
@tool(description="Get the current weather for a location.")
def get_weather(location: str) -> str:
"""Get the current weather for a location.
@@ -5,7 +5,7 @@
import logging
import os
from agent_framework import ChatAgent, ai_function
from agent_framework import ChatAgent, tool
from agent_framework.ag_ui import add_agent_framework_fastapi_endpoint
from agent_framework.azure import AzureOpenAIChatClient
from dotenv import load_dotenv
@@ -87,7 +87,7 @@ async def verify_api_key(api_key: str | None = Security(API_KEY_HEADER)) -> None
# Server-side tool (executes on server)
@ai_function(description="Get the time zone for a location.")
@tool(description="Get the time zone for a location.")
def get_time_zone(location: str) -> str:
"""Get the time zone for a location.