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 17:26:30 +02:00
committed by GitHub
Unverified
parent 5f06b68535
commit 3446eb8d5d
171 changed files with 2580 additions and 2392 deletions
@@ -240,11 +240,11 @@ def build_agent_executor_response(
Returns:
AgentExecutorResponse with reconstructed conversation
"""
final_text = response_text
final_text: str = response_text or ""
if structured_response:
final_text = json.dumps(structured_response)
assistant_message = Message(role="assistant", text=final_text)
assistant_message = Message(role="assistant", contents=[final_text])
agent_response = AgentResponse(
messages=[assistant_message],
@@ -255,7 +255,7 @@ def build_agent_executor_response(
if isinstance(previous_message, AgentExecutorResponse) and previous_message.full_conversation:
full_conversation.extend(previous_message.full_conversation)
elif isinstance(previous_message, str):
full_conversation.append(Message(role="user", text=previous_message))
full_conversation.append(Message(role="user", contents=[previous_message]))
full_conversation.append(assistant_message)
@@ -4,7 +4,7 @@ description = "Azure Functions integration for Microsoft Agent Framework."
authors = [{ name = "Microsoft", email = "af-support@microsoft.com"}]
readme = "README.md"
requires-python = ">=3.10"
version = "1.0.0b260330"
version = "1.0.0b260402"
license-files = ["LICENSE"]
urls.homepage = "https://aka.ms/agent-framework"
urls.source = "https://github.com/microsoft/agent-framework/tree/main/python"
@@ -22,7 +22,7 @@ classifiers = [
"Typing :: Typed",
]
dependencies = [
"agent-framework-core>=1.0.0rc6",
"agent-framework-core>=1.0.0,<2",
"agent-framework-durabletask",
"azure-functions>=1.24.0,<2",
"azure-functions-durable>=1.3.1,<2",
@@ -357,7 +357,7 @@ class TestAgentEntityOperations:
"""Test that entity can run agent operation."""
mock_agent = Mock()
mock_agent.run = AsyncMock(
return_value=AgentResponse(messages=[Message(role="assistant", text="Test response")])
return_value=AgentResponse(messages=[Message(role="assistant", contents=["Test response"])])
)
entity = AgentEntity(mock_agent, state_provider=_InMemoryStateProvider(thread_id="test-conv-123"))
@@ -374,7 +374,9 @@ class TestAgentEntityOperations:
async def test_entity_stores_conversation_history(self) -> None:
"""Test that the entity stores conversation history."""
mock_agent = Mock()
mock_agent.run = AsyncMock(return_value=AgentResponse(messages=[Message(role="assistant", text="Response 1")]))
mock_agent.run = AsyncMock(
return_value=AgentResponse(messages=[Message(role="assistant", contents=["Response 1"])])
)
entity = AgentEntity(mock_agent, state_provider=_InMemoryStateProvider(thread_id="conv-1"))
@@ -406,7 +408,9 @@ class TestAgentEntityOperations:
async def test_entity_increments_message_count(self) -> None:
"""Test that the entity increments the message count."""
mock_agent = Mock()
mock_agent.run = AsyncMock(return_value=AgentResponse(messages=[Message(role="assistant", text="Response")]))
mock_agent.run = AsyncMock(
return_value=AgentResponse(messages=[Message(role="assistant", contents=["Response"])])
)
entity = AgentEntity(mock_agent, state_provider=_InMemoryStateProvider(thread_id="conv-1"))
@@ -445,7 +449,9 @@ class TestAgentEntityFactory:
def test_entity_function_handles_run_operation(self) -> None:
"""Test that the entity function handles the run operation."""
mock_agent = Mock()
mock_agent.run = AsyncMock(return_value=AgentResponse(messages=[Message(role="assistant", text="Response")]))
mock_agent.run = AsyncMock(
return_value=AgentResponse(messages=[Message(role="assistant", contents=["Response"])])
)
entity_function = create_agent_entity(mock_agent)
@@ -470,7 +476,9 @@ class TestAgentEntityFactory:
def test_entity_function_handles_run_agent_operation(self) -> None:
"""Test that the entity function handles the deprecated run_agent operation for backward compatibility."""
mock_agent = Mock()
mock_agent.run = AsyncMock(return_value=AgentResponse(messages=[Message(role="assistant", text="Response")]))
mock_agent.run = AsyncMock(
return_value=AgentResponse(messages=[Message(role="assistant", contents=["Response"])])
)
entity_function = create_agent_entity(mock_agent)
@@ -19,7 +19,9 @@ FuncT = TypeVar("FuncT", bound=Callable[..., Any])
def _agent_response(text: str | None) -> AgentResponse:
"""Create an AgentResponse with a single assistant message."""
message = Message(role="assistant", text=text) if text is not None else Message(role="assistant", text="")
message = (
Message(role="assistant", contents=[text]) if text is not None else Message(role="assistant", contents=[""])
)
return AgentResponse(messages=[message])
@@ -206,7 +206,7 @@ class TestSerializationRoundtrip:
def test_roundtrip_chat_message(self) -> None:
"""Test Message survives encode → decode roundtrip."""
original = Message(role="user", text="Hello")
original = Message(role="user", contents=["Hello"])
encoded = serialize_value(original)
decoded = deserialize_value(encoded)
@@ -216,7 +216,7 @@ class TestSerializationRoundtrip:
def test_roundtrip_agent_executor_request(self) -> None:
"""Test AgentExecutorRequest with nested Messages roundtrips."""
original = AgentExecutorRequest(
messages=[Message(role="user", text="Hi")],
messages=[Message(role="user", contents=["Hi"])],
should_respond=True,
)
encoded = serialize_value(original)
@@ -231,8 +231,8 @@ class TestSerializationRoundtrip:
"""Test AgentExecutorResponse with nested AgentResponse roundtrips."""
original = AgentExecutorResponse(
executor_id="test_exec",
agent_response=AgentResponse(messages=[Message(role="assistant", text="Reply")]),
full_conversation=[Message(role="assistant", text="Reply")],
agent_response=AgentResponse(messages=[Message(role="assistant", contents=["Reply"])]),
full_conversation=[Message(role="assistant", contents=["Reply"])],
)
encoded = serialize_value(original)
decoded = deserialize_value(encoded)
@@ -272,8 +272,8 @@ class TestSerializationRoundtrip:
def test_roundtrip_list_of_objects(self) -> None:
"""Test list of typed objects roundtrips."""
original = [
Message(role="user", text="Q"),
Message(role="assistant", text="A"),
Message(role="user", contents=["Q"]),
Message(role="assistant", contents=["A"]),
]
encoded = serialize_value(original)
decoded = deserialize_value(encoded)
@@ -284,7 +284,7 @@ class TestSerializationRoundtrip:
def test_roundtrip_dict_of_objects(self) -> None:
"""Test dict with typed values roundtrips (used for shared state)."""
original = {"count": 42, "msg": Message(role="user", text="Hi")}
original = {"count": 42, "msg": Message(role="user", contents=["Hi"])}
encoded = serialize_value(original)
decoded = deserialize_value(encoded)
@@ -155,7 +155,7 @@ class TestAgentResponseHelpers:
# Simulate successful entity task completion
entity_task.state = TaskState.SUCCEEDED
entity_task.result = AgentResponse(messages=[Message(role="assistant", text="Test response")]).to_dict()
entity_task.result = AgentResponse(messages=[Message(role="assistant", contents=["Test response"])]).to_dict()
# Clear pending_tasks to simulate that parent has processed the child
task.pending_tasks.clear()
@@ -197,7 +197,9 @@ class TestAgentResponseHelpers:
# Simulate successful entity task with JSON response
entity_task.state = TaskState.SUCCEEDED
entity_task.result = AgentResponse(messages=[Message(role="assistant", text='{"answer": "42"}')]).to_dict()
entity_task.result = AgentResponse(
messages=[Message(role="assistant", contents=['{"answer": "42"}'])]
).to_dict()
# Clear pending_tasks to simulate that parent has processed the child
task.pending_tasks.clear()
@@ -177,10 +177,10 @@ class TestBuildAgentExecutorResponse:
# Create a previous response with conversation history
previous = AgentExecutorResponse(
executor_id="prev",
agent_response=AgentResponse(messages=[Message(role="assistant", text="Previous")]),
agent_response=AgentResponse(messages=[Message(role="assistant", contents=["Previous"])]),
full_conversation=[
Message(role="user", text="First"),
Message(role="assistant", text="Previous"),
Message(role="user", contents=["First"]),
Message(role="assistant", contents=["Previous"]),
],
)
@@ -211,8 +211,8 @@ class TestExtractMessageContent:
"""Test extracting from AgentExecutorResponse with text."""
response = AgentExecutorResponse(
executor_id="exec",
agent_response=AgentResponse(messages=[Message(role="assistant", text="Response text")]),
full_conversation=[Message(role="assistant", text="Response text")],
agent_response=AgentResponse(messages=[Message(role="assistant", contents=["Response text"])]),
full_conversation=[Message(role="assistant", contents=["Response text"])],
)
result = _extract_message_content(response)
@@ -225,13 +225,13 @@ class TestExtractMessageContent:
executor_id="exec",
agent_response=AgentResponse(
messages=[
Message(role="user", text="First"),
Message(role="assistant", text="Last message"),
Message(role="user", contents=["First"]),
Message(role="assistant", contents=["Last message"]),
]
),
full_conversation=[
Message(role="user", text="First"),
Message(role="assistant", text="Last message"),
Message(role="user", contents=["First"]),
Message(role="assistant", contents=["Last message"]),
],
)
@@ -244,8 +244,8 @@ class TestExtractMessageContent:
"""Test extracting from AgentExecutorRequest."""
request = AgentExecutorRequest(
messages=[
Message(role="user", text="First"),
Message(role="user", text="Last request"),
Message(role="user", contents=["First"]),
Message(role="user", contents=["Last request"]),
]
)