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
@@ -46,12 +46,13 @@ async def run_autogen() -> None:
async def run_agent_framework() -> None:
"""Agent Framework agent with @ai_function decorator."""
from agent_framework import ai_function
"""Agent Framework agent with @tool decorator."""
from agent_framework import tool
from agent_framework.openai import OpenAIChatClient
# Define tool with @ai_function decorator (automatic schema inference)
@ai_function
# Define tool with @tool decorator (automatic schema inference)
# NOTE: approval_mode="never_require" is for sample brevity. Use "always_require" in production; see samples/getting_started/tools/function_tool_with_approval.py and samples/getting_started/tools/function_tool_with_approval_and_threads.py.
@tool(approval_mode="never_require")
def get_weather(location: str) -> str:
"""Get the weather for a location.