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
@@ -71,5 +71,5 @@ Swap the script path for any other workflow or process sample. Deactivate the sa
## Tips for Migration
- Keep the original SK sample open while iterating on the AF equivalent; the code is intentionally formatted so you can copy/paste across SDKs.
- Threads/conversation state are explicit in AF. When porting SK code that relies on implicit thread reuse, call `agent.get_new_thread()` and pass it into each `run`/`run_stream` call.
- Tools map cleanly: SK `@kernel_function` plugins translate to AF `@ai_function` callables. Hosted tools (code interpreter, web search, MCP) are available only in AF—introduce them once parity is achieved.
- Tools map cleanly: SK `@kernel_function` plugins translate to AF `@tool` callables. Hosted tools (code interpreter, web search, MCP) are available only in AF—introduce them once parity is achieved.
- For multi-agent orchestration, AF workflows expose checkpoints and resume capabilities that SK Process/Team abstractions do not. Use the workflow samples as a blueprint when modernizing complex agent graphs.
@@ -34,10 +34,10 @@ async def run_semantic_kernel() -> None:
async def run_agent_framework() -> None:
from agent_framework._tools import ai_function
from agent_framework._tools import tool
from agent_framework.openai import OpenAIChatClient
@ai_function(name="specials", description="List daily specials")
@tool(name="specials", description="List daily specials")
async def specials() -> str:
return "Clam chowder, Cobb salad, Chai tea"
@@ -55,10 +55,10 @@ async def run_semantic_kernel() -> None:
async def run_agent_framework() -> None:
from agent_framework._tools import ai_function
from agent_framework._tools import tool
from agent_framework.openai import OpenAIAssistantsClient
@ai_function(
@tool(
name="get_forecast",
description="Look up the forecast for a city and day.",
)
@@ -34,10 +34,10 @@ async def run_semantic_kernel() -> None:
async def run_agent_framework() -> None:
from agent_framework import ChatAgent
from agent_framework._tools import ai_function
from agent_framework._tools import tool
from agent_framework.openai import OpenAIResponsesClient
@ai_function(name="add", description="Add two numbers")
@tool(name="add", description="Add two numbers")
async def add(a: float, b: float) -> float:
return a + b
@@ -13,6 +13,7 @@ from agent_framework import (
RequestInfoEvent,
WorkflowEvent,
WorkflowOutputEvent,
tool,
)
from agent_framework.azure import AzureOpenAIChatClient
from azure.identity import AzureCliCredential
@@ -19,6 +19,7 @@ from agent_framework import (
WorkflowExecutor,
WorkflowOutputEvent,
handler,
tool,
)
from pydantic import BaseModel, Field