Python: [BREAKING] Renamed create_agent to as_agent (#3249)

* Renamed create_agent to as_agent

* Override for as_agent

* Added override
This commit is contained in:
Dmytro Struk
2026-01-16 19:21:52 +00:00
committed by GitHub
parent a151f10cc2
commit 5687e13221
163 changed files with 498 additions and 358 deletions
@@ -33,7 +33,7 @@ async def run_agent_framework() -> None:
# AF constructs a lightweight ChatAgent backed by OpenAIChatClient
client = OpenAIChatClient(model_id="gpt-4.1-mini")
agent = client.create_agent(
agent = client.as_agent(
name="assistant",
instructions="You are a helpful assistant. Answer in one sentence.",
)
@@ -65,7 +65,7 @@ async def run_agent_framework() -> None:
# Create agent with tool
client = OpenAIChatClient(model_id="gpt-4.1-mini")
agent = client.create_agent(
agent = client.as_agent(
name="assistant",
instructions="You are a helpful assistant. Use available tools to answer questions.",
tools=[get_weather],
@@ -40,7 +40,7 @@ async def run_agent_framework() -> None:
from agent_framework.openai import OpenAIChatClient
client = OpenAIChatClient(model_id="gpt-4.1-mini")
agent = client.create_agent(
agent = client.as_agent(
name="assistant",
instructions="You are a helpful math tutor.",
)
@@ -54,7 +54,7 @@ async def run_agent_framework() -> None:
client = OpenAIChatClient(model_id="gpt-4.1-mini")
# Create specialized writer agent
writer = client.create_agent(
writer = client.as_agent(
name="writer",
instructions="You are a creative writer. Write short, engaging content.",
)
@@ -68,7 +68,7 @@ async def run_agent_framework() -> None:
)
# Create coordinator agent with writer tool
coordinator = client.create_agent(
coordinator = client.as_agent(
name="coordinator",
instructions="You coordinate with specialized agents. Delegate writing tasks to the writer agent.",
tools=[writer_tool],