Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion python/packages/ag-ui/tests/__init__.py

This file was deleted.

2 changes: 1 addition & 1 deletion python/packages/ag-ui/tests/test_ag_ui_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@
from agent_framework import (
ChatMessage,
ChatOptions,
ChatResponse,
ChatResponseUpdate,
FunctionCallContent,
Role,
TextContent,
ai_function,
)
from agent_framework._types import ChatResponse
from pytest import MonkeyPatch

from agent_framework_ag_ui._client import AGUIChatClient, ServerFunctionCallContent
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,11 @@
from typing import Any

import pytest
from agent_framework import ChatAgent, ChatMessage, ChatOptions, TextContent
from agent_framework._types import ChatResponseUpdate
from agent_framework import ChatAgent, ChatMessage, ChatOptions, ChatResponseUpdate, TextContent
from pydantic import BaseModel

sys.path.insert(0, str(Path(__file__).parent))
from test_helpers_ag_ui import StreamingChatClientStub
from utils_test_ag_ui import StreamingChatClientStub


async def test_agent_initialization_basic():
Expand Down
3 changes: 1 addition & 2 deletions python/packages/ag-ui/tests/test_document_writer_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@
"""Tests for document writer predictive state flow with confirm_changes."""

from ag_ui.core import EventType, StateDeltaEvent, ToolCallArgsEvent, ToolCallEndEvent, ToolCallStartEvent
from agent_framework import FunctionCallContent, FunctionResultContent, TextContent
from agent_framework._types import AgentRunResponseUpdate
from agent_framework import AgentRunResponseUpdate, FunctionCallContent, FunctionResultContent, TextContent

from agent_framework_ag_ui._events import AgentFrameworkEventBridge

Expand Down
5 changes: 2 additions & 3 deletions python/packages/ag-ui/tests/test_endpoint.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,15 @@
import sys
from pathlib import Path

from agent_framework import ChatAgent, TextContent
from agent_framework._types import ChatResponseUpdate
from agent_framework import ChatAgent, ChatResponseUpdate, TextContent
from fastapi import FastAPI
from fastapi.testclient import TestClient

from agent_framework_ag_ui._agent import AgentFrameworkAgent
from agent_framework_ag_ui._endpoint import add_agent_framework_fastapi_endpoint

sys.path.insert(0, str(Path(__file__).parent))
from test_helpers_ag_ui import StreamingChatClientStub, stream_from_updates
from utils_test_ag_ui import StreamingChatClientStub, stream_from_updates


def build_chat_client(response_text: str = "Test response") -> StreamingChatClientStub:
Expand Down
3 changes: 1 addition & 2 deletions python/packages/ag-ui/tests/test_human_in_the_loop.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@

"""Tests for human in the loop (function approval requests)."""

from agent_framework import FunctionApprovalRequestContent, FunctionCallContent
from agent_framework._types import AgentRunResponseUpdate
from agent_framework import AgentRunResponseUpdate, FunctionApprovalRequestContent, FunctionCallContent

from agent_framework_ag_ui._events import AgentFrameworkEventBridge

Expand Down
3 changes: 1 addition & 2 deletions python/packages/ag-ui/tests/test_orchestrators.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@
from types import SimpleNamespace
from typing import Any

from agent_framework import AgentRunResponseUpdate, TextContent, ai_function
from agent_framework._tools import FunctionInvocationConfiguration
from agent_framework import AgentRunResponseUpdate, FunctionInvocationConfiguration, TextContent, ai_function

from agent_framework_ag_ui._agent import AgentConfig
from agent_framework_ag_ui._orchestrators import DefaultOrchestrator, ExecutionContext
Expand Down
2 changes: 1 addition & 1 deletion python/packages/ag-ui/tests/test_orchestrators_coverage.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
from agent_framework_ag_ui._orchestrators import DefaultOrchestrator, HumanInTheLoopOrchestrator

sys.path.insert(0, str(Path(__file__).parent))
from test_helpers_ag_ui import StubAgent, TestExecutionContext
from utils_test_ag_ui import StubAgent, TestExecutionContext


@ai_function(approval_mode="always_require")
Expand Down
5 changes: 2 additions & 3 deletions python/packages/ag-ui/tests/test_shared_state.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,13 @@

import pytest
from ag_ui.core import StateSnapshotEvent
from agent_framework import ChatAgent, TextContent
from agent_framework._types import ChatResponseUpdate
from agent_framework import ChatAgent, ChatResponseUpdate, TextContent

from agent_framework_ag_ui._agent import AgentFrameworkAgent
from agent_framework_ag_ui._events import AgentFrameworkEventBridge

sys.path.insert(0, str(Path(__file__).parent))
from test_helpers_ag_ui import StreamingChatClientStub, stream_from_updates
from utils_test_ag_ui import StreamingChatClientStub, stream_from_updates


@pytest.fixture
Expand Down
5 changes: 2 additions & 3 deletions python/packages/ag-ui/tests/test_structured_output.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,11 @@
from pathlib import Path
from typing import Any

from agent_framework import ChatAgent, ChatMessage, ChatOptions, TextContent
from agent_framework._types import ChatResponseUpdate
from agent_framework import ChatAgent, ChatMessage, ChatOptions, ChatResponseUpdate, TextContent
from pydantic import BaseModel

sys.path.insert(0, str(Path(__file__).parent))
from test_helpers_ag_ui import StreamingChatClientStub, stream_from_updates
from utils_test_ag_ui import StreamingChatClientStub, stream_from_updates


class RecipeOutput(BaseModel):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,13 @@
AgentRunResponse,
AgentRunResponseUpdate,
AgentThread,
BaseChatClient,
ChatMessage,
ChatOptions,
ChatResponse,
ChatResponseUpdate,
TextContent,
)
from agent_framework._clients import BaseChatClient
from agent_framework._types import ChatResponse, ChatResponseUpdate

from agent_framework_ag_ui._message_adapters import _deduplicate_messages, _sanitize_tool_history
from agent_framework_ag_ui._orchestrators import ExecutionContext
Expand Down Expand Up @@ -79,31 +80,15 @@ def __init__(
chat_options: Any | None = None,
chat_client: Any | None = None,
) -> None:
self._id = agent_id
self._name = agent_name
self._description = "stub agent"
self.id = agent_id
self.name = agent_name
self.description = "stub agent"
self.updates = updates or [AgentRunResponseUpdate(contents=[TextContent(text="response")], role="assistant")]
self.chat_options = chat_options or SimpleNamespace(tools=None, response_format=None)
self.chat_client = chat_client or SimpleNamespace(function_invocation_configuration=None)
self.messages_received: list[Any] = []
self.tools_received: list[Any] | None = None

@property
def id(self) -> str:
return self._id

@property
def name(self) -> str | None:
return self._name

@property
def display_name(self) -> str:
return self._name or self._id

@property
def description(self) -> str | None:
return self._description

async def run(
self,
messages: str | ChatMessage | list[str] | list[ChatMessage] | None = None,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -182,32 +182,11 @@ def __init__(self, context: AgentOrchestrationContextType, agent_name: str):
"""
self.context = context
self.agent_name = agent_name
self._id = str(uuid.uuid4())
self._name = agent_name
self._display_name = agent_name
self._description = f"Durable agent proxy for {agent_name}"
self.id = str(uuid.uuid4())
self.name = agent_name
self.description = f"Durable agent proxy for {agent_name}"
logger.debug("[DurableAIAgent] Initialized for agent: %s", agent_name)

@property
def id(self) -> str:
"""Get the unique identifier for this agent."""
return self._id

@property
def name(self) -> str | None:
"""Get the name of the agent."""
return self._name

@property
def display_name(self) -> str:
"""Get the display name of the agent."""
return self._display_name

@property
def description(self) -> str | None:
"""Get the description of the agent."""
return self._description

# We return an AgentTask here which is a TaskBase subclass.
# This is an intentional deviation from AgentProtocol which defines run() as async.
# The AgentTask can be yielded in Durable Functions orchestrations and will provide
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,18 @@
"""

import subprocess
import sys
from collections.abc import Iterator, Mapping
from pathlib import Path
from typing import Any

import pytest
import requests

from .testutils import (
# Add the integration_tests directory to the path so testutils can be imported
sys.path.insert(0, str(Path(__file__).parent))

from testutils import (
FunctionAppStartupError,
build_base_url,
cleanup_function_app,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,10 @@
"""

import pytest
from testutils import SampleTestHelper, skip_if_azure_functions_integration_tests_disabled

from agent_framework_azurefunctions._constants import THREAD_ID_HEADER

from .testutils import SampleTestHelper, skip_if_azure_functions_integration_tests_disabled

# Module-level markers - applied to all tests in this file
pytestmark = [
pytest.mark.sample("01_single_agent"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@
"""

import pytest

from .testutils import SampleTestHelper, skip_if_azure_functions_integration_tests_disabled
from testutils import SampleTestHelper, skip_if_azure_functions_integration_tests_disabled

# Module-level markers - applied to all tests in this file
pytestmark = [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@

import pytest
import requests

from .testutils import (
from testutils import (
SampleTestHelper,
skip_if_azure_functions_integration_tests_disabled,
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@
"""

import pytest

from .testutils import SampleTestHelper, skip_if_azure_functions_integration_tests_disabled
from testutils import SampleTestHelper, skip_if_azure_functions_integration_tests_disabled

# Module-level markers - applied to all tests in this file
pytestmark = [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@
"""

import pytest

from .testutils import SampleTestHelper, skip_if_azure_functions_integration_tests_disabled
from testutils import SampleTestHelper, skip_if_azure_functions_integration_tests_disabled

# Module-level markers - applied to all tests in this file
pytestmark = [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@
"""

import pytest

from .testutils import SampleTestHelper, skip_if_azure_functions_integration_tests_disabled
from testutils import SampleTestHelper, skip_if_azure_functions_integration_tests_disabled

# Module-level markers - applied to all tests in this file
pytestmark = [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,7 @@
import time

import pytest

from .testutils import SampleTestHelper, skip_if_azure_functions_integration_tests_disabled
from testutils import SampleTestHelper, skip_if_azure_functions_integration_tests_disabled

# Module-level markers - applied to all tests in this file
pytestmark = [
Expand Down
2 changes: 0 additions & 2 deletions python/packages/azurefunctions/tests/test_orchestration.py
Original file line number Diff line number Diff line change
Expand Up @@ -218,12 +218,10 @@ def test_has_agent_protocol_properties(self) -> None:
assert hasattr(agent, "id")
assert hasattr(agent, "name")
assert hasattr(agent, "description")
assert hasattr(agent, "display_name")

# Verify values
assert agent.name == "TestAgent"
assert agent.description == "Durable agent proxy for TestAgent"
assert agent.display_name == "TestAgent"
assert agent.id is not None # Auto-generated UUID

def test_get_new_thread(self) -> None:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,10 @@
from typing import Any, ClassVar

from agent_framework import (
AgentMiddlewares,
AgentMiddlewareTypes,
AgentRunResponse,
AgentRunResponseUpdate,
AgentThread,
AggregateContextProvider,
BaseAgent,
ChatMessage,
ContextProvider,
Expand Down Expand Up @@ -79,8 +78,8 @@ def __init__(
id: str | None = None,
name: str | None = None,
description: str | None = None,
context_providers: ContextProvider | list[ContextProvider] | AggregateContextProvider | None = None,
middleware: AgentMiddlewares | list[AgentMiddlewares] | None = None,
context_provider: ContextProvider | None = None,
middleware: list[AgentMiddlewareTypes] | None = None,
environment_id: str | None = None,
agent_identifier: str | None = None,
client_id: str | None = None,
Expand All @@ -107,8 +106,8 @@ def __init__(
id: id of the CopilotAgent
name: Name of the CopilotAgent
description: Description of the CopilotAgent
context_providers: Context Providers, to be used by the copilot agent.
middleware: Agent middlewares used by the agent.
context_provider: Context Provider, to be used by the copilot agent.
middleware: Agent middleware used by the agent, should be a list of AgentMiddlewareTypes.
environment_id: Environment ID of the Power Platform environment containing
the Copilot Studio app. Can also be set via COPILOTSTUDIOAGENT__ENVIRONMENTID
environment variable.
Expand Down Expand Up @@ -138,7 +137,7 @@ def __init__(
id=id,
name=name,
description=description,
context_providers=context_providers,
context_provider=context_provider,
middleware=middleware,
)
if not client:
Expand Down
Loading
Loading