Python: [BREAKING] update to v1.0.0 (#5062)

* updates to final deprecated pieces and versions

* fix mypy

* fix readme links
This commit is contained in:
Eduard van Valkenburg
2026-04-02 15:26:30 +00:00
committed by GitHub
parent 5f06b68535
commit 3446eb8d5d
171 changed files with 2580 additions and 2392 deletions
@@ -44,7 +44,7 @@ async def main():
metadata = {"thread_id": thread_id} if thread_id else None
stream = client.get_response(
[Message(role="user", text=message)],
[Message(role="user", contents=[message])],
stream=True,
options={"metadata": metadata} if metadata else None,
)
@@ -73,7 +73,7 @@ async def streaming_example(client: AGUIChatClient, thread_id: str | None = None
print("Assistant: ", end="", flush=True)
stream = client.get_response(
[Message(role="user", text="Tell me a short joke")],
[Message(role="user", contents=["Tell me a short joke"])],
stream=True,
options={"metadata": metadata} if metadata else None,
)
@@ -100,7 +100,7 @@ async def non_streaming_example(client: AGUIChatClient, thread_id: str | None =
print("\nUser: What is 2 + 2?\n")
response = await client.get_response([Message(role="user", text="What is 2 + 2?")], metadata=metadata)
response = await client.get_response([Message(role="user", contents=["What is 2 + 2?"])], metadata=metadata)
print(f"Assistant: {response.text}")
@@ -139,7 +139,9 @@ async def tool_example(client: AGUIChatClient, thread_id: str | None = None):
print("(Server must be configured with matching tools to execute them)\n")
response = await client.get_response(
[Message(role="user", text="What's the weather in Seattle?")], tools=[get_weather, calculate], metadata=metadata
[Message(role="user", contents=["What's the weather in Seattle?"])],
tools=[get_weather, calculate],
metadata=metadata,
)
print(f"Assistant: {response.text}")
@@ -174,7 +176,7 @@ async def conversation_example(client: AGUIChatClient):
# First turn
print("User: My name is Alice\n")
response1 = await client.get_response([Message(role="user", text="My name is Alice")])
response1 = await client.get_response([Message(role="user", contents=["My name is Alice"])])
print(f"Assistant: {response1.text}")
thread_id = response1.additional_properties.get("thread_id")
print(f"\n[Thread: {thread_id}]")
@@ -182,7 +184,7 @@ async def conversation_example(client: AGUIChatClient):
# Second turn - using same thread
print("\nUser: What's my name?\n")
response2 = await client.get_response(
[Message(role="user", text="What's my name?")], options={"metadata": {"thread_id": thread_id}}
[Message(role="user", contents=["What's my name?"])], options={"metadata": {"thread_id": thread_id}}
)
print(f"Assistant: {response2.text}")
@@ -193,7 +195,7 @@ async def conversation_example(client: AGUIChatClient):
# Third turn
print("\nUser: Can you also tell me what 10 * 5 is?\n")
response3 = await client.get_response(
[Message(role="user", text="Can you also tell me what 10 * 5 is?")],
[Message(role="user", contents=["Can you also tell me what 10 * 5 is?"])],
options={"metadata": {"thread_id": thread_id}},
tools=[calculate],
)
+2 -2
View File
@@ -1,6 +1,6 @@
[project]
name = "agent-framework-ag-ui"
version = "1.0.0b260330"
version = "1.0.0b260402"
description = "AG-UI protocol integration for Agent Framework"
readme = "README.md"
license-files = ["LICENSE"]
@@ -22,7 +22,7 @@ classifiers = [
"Typing :: Typed",
]
dependencies = [
"agent-framework-core>=1.0.0rc6",
"agent-framework-core>=1.0.0,<2",
"ag-ui-protocol==0.1.13",
"fastapi>=0.115.0,<0.133.1",
"uvicorn[standard]>=0.30.0,<0.42.0"
@@ -67,8 +67,8 @@ class TestAGUIChatClient:
"""Test state extraction when no state is present."""
client = StubAGUIChatClient(endpoint="http://localhost:8888/")
messages = [
Message(role="user", text="Hello"),
Message(role="assistant", text="Hi there"),
Message(role="user", contents=["Hello"]),
Message(role="assistant", contents=["Hi there"]),
]
result_messages, state = client.extract_state_from_messages(messages)
@@ -87,7 +87,7 @@ class TestAGUIChatClient:
state_b64 = base64.b64encode(state_json.encode("utf-8")).decode("utf-8")
messages = [
Message(role="user", text="Hello"),
Message(role="user", contents=["Hello"]),
Message(
role="user",
contents=[Content.from_uri(uri=f"data:application/json;base64,{state_b64}")],
@@ -125,8 +125,8 @@ class TestAGUIChatClient:
"""Test message conversion to AG-UI format."""
client = StubAGUIChatClient(endpoint="http://localhost:8888/")
messages = [
Message(role="user", text="What is the weather?"),
Message(role="assistant", text="Let me check.", message_id="msg_123"),
Message(role="user", contents=["What is the weather?"]),
Message(role="assistant", contents=["Let me check."], message_id="msg_123"),
]
agui_messages = client.convert_messages_to_agui_format(messages)
@@ -173,7 +173,7 @@ class TestAGUIChatClient:
client = StubAGUIChatClient(endpoint="http://localhost:8888/")
monkeypatch.setattr(client.http_service, "post_run", mock_post_run)
messages = [Message(role="user", text="Test message")]
messages = [Message(role="user", contents=["Test message"])]
chat_options = ChatOptions()
updates: list[ChatResponseUpdate] = []
@@ -206,7 +206,7 @@ class TestAGUIChatClient:
client = StubAGUIChatClient(endpoint="http://localhost:8888/")
monkeypatch.setattr(client.http_service, "post_run", mock_post_run)
messages = [Message(role="user", text="Test message")]
messages = [Message(role="user", contents=["Test message"])]
chat_options = {}
response = await client.inner_get_response(messages=messages, options=chat_options)
@@ -249,7 +249,7 @@ class TestAGUIChatClient:
client = StubAGUIChatClient(endpoint="http://localhost:8888/")
monkeypatch.setattr(client.http_service, "post_run", mock_post_run)
messages = [Message(role="user", text="Test with tools")]
messages = [Message(role="user", contents=["Test with tools"])]
chat_options = ChatOptions(tools=[test_tool])
response = await client.inner_get_response(messages=messages, options=chat_options)
@@ -273,7 +273,7 @@ class TestAGUIChatClient:
client = StubAGUIChatClient(endpoint="http://localhost:8888/")
monkeypatch.setattr(client.http_service, "post_run", mock_post_run)
messages = [Message(role="user", text="Test server tool execution")]
messages = [Message(role="user", contents=["Test server tool execution"])]
updates: list[ChatResponseUpdate] = []
async for update in client.get_response(messages, stream=True):
@@ -315,7 +315,7 @@ class TestAGUIChatClient:
client = StubAGUIChatClient(endpoint="http://localhost:8888/")
monkeypatch.setattr(client.http_service, "post_run", mock_post_run)
messages = [Message(role="user", text="Test server tool execution")]
messages = [Message(role="user", contents=["Test server tool execution"])]
async for _ in client.get_response(
messages, stream=True, options={"tool_choice": "auto", "tools": [client_tool]}
@@ -331,7 +331,7 @@ class TestAGUIChatClient:
state_b64 = base64.b64encode(state_json.encode("utf-8")).decode("utf-8")
messages = [
Message(role="user", text="Hello"),
Message(role="user", contents=["Hello"]),
Message(
role="user",
contents=[Content.from_uri(uri=f"data:application/json;base64,{state_b64}")],
@@ -388,7 +388,7 @@ class TestAGUIChatClient:
client = StubAGUIChatClient(endpoint="http://localhost:8888/")
monkeypatch.setattr(client.http_service, "post_run", mock_post_run)
messages = [Message(role="user", text="Test")]
messages = [Message(role="user", contents=["Test"])]
response = await client.inner_get_response(messages=messages, options={}, stream=False)
assert response is not None
@@ -416,7 +416,7 @@ class TestAGUIChatClient:
client = StubAGUIChatClient(endpoint="http://localhost:8888/")
monkeypatch.setattr(client.http_service, "post_run", mock_post_run)
messages = [Message(role="user", text="Test")]
messages = [Message(role="user", contents=["Test"])]
updates: list[ChatResponseUpdate] = []
async for update in client._inner_get_response(messages=messages, stream=True, options={"tools": [my_tool]}):
updates.append(update)
@@ -451,7 +451,7 @@ class TestAGUIChatClient:
client = StubAGUIChatClient(endpoint="http://localhost:8888/")
monkeypatch.setattr(client.http_service, "post_run", mock_post_run)
messages = [Message(role="user", text="continue")]
messages = [Message(role="user", contents=["continue"])]
options = {
"available_interrupts": available_interrupts,
"resume": resume_payload,