diff --git a/examples/tutorials/00_sync/000_hello_acp/tests/test_agent.py b/examples/tutorials/00_sync/000_hello_acp/tests/test_agent.py index 3d7fb2f3..ad82771f 100644 --- a/examples/tutorials/00_sync/000_hello_acp/tests/test_agent.py +++ b/examples/tutorials/00_sync/000_hello_acp/tests/test_agent.py @@ -17,12 +17,13 @@ """ import os -from agentex.types import TextContentParam, TextDelta, TextContent -from agentex.types.agent_rpc_params import ParamsSendMessageRequest -from agentex.types.task_message_update import StreamTaskMessageDelta, StreamTaskMessageFull + import pytest -from agentex import Agentex +from agentex import Agentex +from agentex.types import TextDelta, TextContent, TextContentParam +from agentex.types.agent_rpc_params import ParamsSendMessageRequest +from agentex.types.task_message_update import StreamTaskMessageFull, StreamTaskMessageDelta # Configuration from environment variables AGENTEX_API_BASE_URL = os.environ.get("AGENTEX_API_BASE_URL", "http://localhost:5003") diff --git a/examples/tutorials/00_sync/010_multiturn/project/acp.py b/examples/tutorials/00_sync/010_multiturn/project/acp.py index 5325a724..c8cc01c3 100644 --- a/examples/tutorials/00_sync/010_multiturn/project/acp.py +++ b/examples/tutorials/00_sync/010_multiturn/project/acp.py @@ -2,13 +2,13 @@ from typing import Union, AsyncGenerator from agentex.lib import adk +from agentex.types import TextContent from agentex.lib.types.acp import SendMessageParams from agentex.lib.utils.model_utils import BaseModel from agentex.lib.types.llm_messages import LLMConfig, UserMessage, SystemMessage, AssistantMessage from agentex.lib.sdk.fastacp.fastacp import FastACP from agentex.types.task_message_update import TaskMessageUpdate from agentex.types.task_message_content import TaskMessageContent -from agentex.types import TextContent # Create an ACP server acp = FastACP.create( diff --git a/examples/tutorials/00_sync/010_multiturn/tests/test_agent.py b/examples/tutorials/00_sync/010_multiturn/tests/test_agent.py index 3bcc8beb..96eaf233 100644 --- a/examples/tutorials/00_sync/010_multiturn/tests/test_agent.py +++ b/examples/tutorials/00_sync/010_multiturn/tests/test_agent.py @@ -16,19 +16,15 @@ - AGENT_NAME: Name of the agent to test (default: s010-multiturn) """ -import enum import os -from agentex.lib.sdk.fastacp.base.base_acp_server import uuid -from agentex.lib.types.acp import SendMessageParams - -from test_utils.sync import collect_streaming_response, validate_text_in_string - -from agentex.types import TaskMessageContentParam, TextContent, TextContentParam, task_list_params -from agentex.types.agent_rpc_params import ParamsCreateTaskRequest, ParamsSendMessageRequest import pytest -from agentex import Agentex +from test_utils.sync import validate_text_in_string, collect_streaming_response +from agentex import Agentex +from agentex.types import TextContent, TextContentParam +from agentex.types.agent_rpc_params import ParamsCreateTaskRequest, ParamsSendMessageRequest +from agentex.lib.sdk.fastacp.base.base_acp_server import uuid # Configuration from environment variables AGENTEX_API_BASE_URL = os.environ.get("AGENTEX_API_BASE_URL", "http://localhost:5003") diff --git a/examples/tutorials/00_sync/020_streaming/tests/test_agent.py b/examples/tutorials/00_sync/020_streaming/tests/test_agent.py index 8fe5935c..7a649f2d 100644 --- a/examples/tutorials/00_sync/020_streaming/tests/test_agent.py +++ b/examples/tutorials/00_sync/020_streaming/tests/test_agent.py @@ -17,13 +17,14 @@ """ import os + import pytest +from test_utils.sync import collect_streaming_response + from agentex import Agentex -from agentex.lib.sdk.fastacp.base.base_acp_server import uuid from agentex.types import TextContent, TextContentParam from agentex.types.agent_rpc_params import ParamsCreateTaskRequest, ParamsSendMessageRequest -from test_utils.sync import collect_streaming_response, validate_text_in_string - +from agentex.lib.sdk.fastacp.base.base_acp_server import uuid # Configuration from environment variables AGENTEX_API_BASE_URL = os.environ.get("AGENTEX_API_BASE_URL", "http://localhost:5003") diff --git a/examples/tutorials/10_agentic/00_base/000_hello_acp/tests/test_agent.py b/examples/tutorials/10_agentic/00_base/000_hello_acp/tests/test_agent.py index 165adcf5..8445555f 100644 --- a/examples/tutorials/10_agentic/00_base/000_hello_acp/tests/test_agent.py +++ b/examples/tutorials/10_agentic/00_base/000_hello_acp/tests/test_agent.py @@ -16,18 +16,19 @@ """ import os -from agentex.types import TaskMessage +import uuid +import asyncio + import pytest import pytest_asyncio -from agentex import AsyncAgentex from test_utils.agentic import ( - send_event_and_poll_yielding, - stream_agent_response, poll_messages, + stream_agent_response, + send_event_and_poll_yielding, ) -import uuid -import asyncio +from agentex import AsyncAgentex +from agentex.types import TaskMessage from agentex.types.agent_rpc_params import ParamsCreateTaskRequest from agentex.types.text_content_param import TextContentParam @@ -64,7 +65,7 @@ class TestNonStreamingEvents: """Test non-streaming event sending and polling.""" @pytest.mark.asyncio - async def test_send_event_and_poll(self, client: AsyncAgentex, agent_name: str, agent_id: str): + async def test_send_event_and_poll(self, client: AsyncAgentex, _agent_name: str, agent_id: str): """Test sending an event and polling for the response.""" # Create a task for this conversation task_response = await client.agents.create_task(agent_id, params=ParamsCreateTaskRequest(name=uuid.uuid1().hex)) @@ -103,7 +104,7 @@ class TestStreamingEvents: """Test streaming event sending.""" @pytest.mark.asyncio - async def test_send_event_and_stream(self, client: AsyncAgentex, agent_name: str, agent_id: str): + async def test_send_event_and_stream(self, client: AsyncAgentex, _agent_name: str, agent_id: str): """Test sending an event and streaming the response.""" task_response = await client.agents.create_task(agent_id, params=ParamsCreateTaskRequest(name=uuid.uuid1().hex)) task = task_response.result diff --git a/examples/tutorials/10_agentic/00_base/010_multiturn/tests/test_agent.py b/examples/tutorials/10_agentic/00_base/010_multiturn/tests/test_agent.py index 21ba04f7..52165fe1 100644 --- a/examples/tutorials/10_agentic/00_base/010_multiturn/tests/test_agent.py +++ b/examples/tutorials/10_agentic/00_base/010_multiturn/tests/test_agent.py @@ -15,21 +15,21 @@ - AGENT_NAME: Name of the agent to test (default: ab010-multiturn) """ -from typing import List import os import uuid -from agentex._utils import is_iterable -from agentex.types import TaskMessage, TextContent -from agentex.types.task import Task +import asyncio +from typing import List + import pytest import pytest_asyncio -from agentex import AsyncAgentex -from agentex.types.agent_rpc_params import ParamsCreateTaskRequest from test_utils.agentic import ( - send_event_and_poll_yielding, stream_agent_response, + send_event_and_poll_yielding, ) -import asyncio + +from agentex import AsyncAgentex +from agentex.types import TextContent +from agentex.types.agent_rpc_params import ParamsCreateTaskRequest from agentex.types.text_content_param import TextContentParam # Configuration from environment variables @@ -65,7 +65,7 @@ class TestNonStreamingEvents: """Test non-streaming event sending and polling.""" @pytest.mark.asyncio - async def test_send_event_and_poll(self, client: AsyncAgentex, agent_name: str, agent_id: str): + async def test_send_event_and_poll(self, client: AsyncAgentex, _agent_name: str, agent_id: str): """Test sending an event and polling for the response.""" # TODO: Create a task for this conversation task_response = await client.agents.create_task(agent_id, params=ParamsCreateTaskRequest(name=uuid.uuid1().hex)) diff --git a/examples/tutorials/10_agentic/00_base/020_streaming/tests/test_agent.py b/examples/tutorials/10_agentic/00_base/020_streaming/tests/test_agent.py index 00310def..1a39d607 100644 --- a/examples/tutorials/10_agentic/00_base/020_streaming/tests/test_agent.py +++ b/examples/tutorials/10_agentic/00_base/020_streaming/tests/test_agent.py @@ -15,22 +15,22 @@ - AGENT_NAME: Name of the agent to test (default: ab020-streaming) """ -from typing import List import os import uuid -from agentex.types import TaskMessage, TextContent -from agentex.types.task import Task +import asyncio +from typing import List + import pytest import pytest_asyncio -from agentex import AsyncAgentex -from agentex.types.agent_rpc_params import ParamsCreateTaskRequest from test_utils.agentic import ( - send_event_and_poll_yielding, stream_agent_response, + send_event_and_poll_yielding, ) -import asyncio -from agentex.types.text_content_param import TextContentParam +from agentex import AsyncAgentex +from agentex.types import TaskMessage, TextContent +from agentex.types.agent_rpc_params import ParamsCreateTaskRequest +from agentex.types.text_content_param import TextContentParam # Configuration from environment variables AGENTEX_API_BASE_URL = os.environ.get("AGENTEX_API_BASE_URL", "http://localhost:5003") @@ -65,7 +65,7 @@ class TestNonStreamingEvents: """Test non-streaming event sending and polling.""" @pytest.mark.asyncio - async def test_send_event_and_poll(self, client: AsyncAgentex, agent_name: str, agent_id: str): + async def test_send_event_and_poll(self, client: AsyncAgentex, _agent_name: str, agent_id: str): """Test sending an event and polling for the response.""" # Create a task for this conversation task_response = await client.agents.create_task(agent_id, params=ParamsCreateTaskRequest(name=uuid.uuid1().hex)) diff --git a/examples/tutorials/10_agentic/00_base/030_tracing/tests/test_agent.py b/examples/tutorials/10_agentic/00_base/030_tracing/tests/test_agent.py index 07e6f350..e5089e56 100644 --- a/examples/tutorials/10_agentic/00_base/030_tracing/tests/test_agent.py +++ b/examples/tutorials/10_agentic/00_base/030_tracing/tests/test_agent.py @@ -16,16 +16,11 @@ """ import os -import uuid + import pytest import pytest_asyncio -from agentex import AsyncAgentex -from agentex.types.agent_rpc_params import ParamsCreateTaskRequest -from test_utils.agentic import ( - stream_agent_response, - validate_text_in_response, -) +from agentex import AsyncAgentex # Configuration from environment variables AGENTEX_API_BASE_URL = os.environ.get("AGENTEX_API_BASE_URL", "http://localhost:5003") @@ -60,7 +55,7 @@ class TestNonStreamingEvents: """Test non-streaming event sending and polling.""" @pytest.mark.asyncio - async def test_send_event_and_poll(self, client: AsyncAgentex, agent_name: str, agent_id: str): + async def test_send_event_and_poll(self, client: AsyncAgentex, _agent_name: str, agent_id: str): """Test sending an event and polling for the response.""" # TODO: Create a task for this conversation # task_response = await client.agents.create_task(agent_id, params=ParamsCreateTaskRequest(name=uuid.uuid1().hex)) @@ -88,7 +83,7 @@ class TestStreamingEvents: """Test streaming event sending.""" @pytest.mark.asyncio - async def test_send_event_and_stream(self, client: AsyncAgentex, agent_name: str, agent_id: str): + async def test_send_event_and_stream(self, client: AsyncAgentex, _agent_name: str, agent_id: str): """Test sending an event and streaming the response.""" # TODO: Create a task for this conversation # task_response = await client.agents.create_task(agent_id, params=ParamsCreateTaskRequest(name=uuid.uuid1().hex)) diff --git a/examples/tutorials/10_agentic/00_base/040_other_sdks/tests/test_agent.py b/examples/tutorials/10_agentic/00_base/040_other_sdks/tests/test_agent.py index 246266e3..982dea9d 100644 --- a/examples/tutorials/10_agentic/00_base/040_other_sdks/tests/test_agent.py +++ b/examples/tutorials/10_agentic/00_base/040_other_sdks/tests/test_agent.py @@ -25,23 +25,21 @@ - AGENT_NAME: Name of the agent to test (default: ab040-other-sdks) """ -from curses import ALL_MOUSE_EVENTS -from typing import List import os import uuid -from agentex.types import TaskMessage, TextContent -from agentex.types.task import Task +import asyncio + import pytest import pytest_asyncio -from agentex import AsyncAgentex -from agentex.types.agent_rpc_params import ParamsCreateTaskRequest from test_utils.agentic import ( - send_event_and_poll_yielding, stream_agent_response, + send_event_and_poll_yielding, ) -import asyncio + +from agentex import AsyncAgentex +from agentex.types import TaskMessage, TextContent +from agentex.types.agent_rpc_params import ParamsCreateTaskRequest from agentex.types.text_content_param import TextContentParam -from datetime import datetime # Configuration from environment variables AGENTEX_API_BASE_URL = os.environ.get("AGENTEX_API_BASE_URL", "http://localhost:5003") @@ -76,7 +74,7 @@ class TestNonStreamingEvents: """Test non-streaming event sending and polling with MCP tools.""" @pytest.mark.asyncio - async def test_send_event_and_poll_simple_query(self, client: AsyncAgentex, agent_name: str, agent_id: str): + async def test_send_event_and_poll_simple_query(self, client: AsyncAgentex, _agent_name: str, agent_id: str): """Test sending a simple event and polling for the response (no tool use).""" # Create a task for this conversation task_response = await client.agents.create_task(agent_id, params=ParamsCreateTaskRequest(name=uuid.uuid1().hex)) diff --git a/examples/tutorials/10_agentic/00_base/080_batch_events/tests/test_agent.py b/examples/tutorials/10_agentic/00_base/080_batch_events/tests/test_agent.py index 9ee903ca..4b4d638a 100644 --- a/examples/tutorials/10_agentic/00_base/080_batch_events/tests/test_agent.py +++ b/examples/tutorials/10_agentic/00_base/080_batch_events/tests/test_agent.py @@ -16,21 +16,22 @@ """ import os +import re import uuid -from agentex.types import TaskMessage +import asyncio + import pytest import pytest_asyncio -from agentex import AsyncAgentex -from agentex.types.agent_rpc_params import ParamsCreateTaskRequest from test_utils.agentic import ( - send_event_and_poll_yielding, stream_agent_response, - validate_text_in_response, + send_event_and_poll_yielding, ) -import asyncio + +from agentex import AsyncAgentex +from agentex.types import TaskMessage +from agentex.types.agent_rpc_params import ParamsCreateTaskRequest from agentex.types.text_content_param import TextContentParam from agentex.types.task_message_content import TextContent -import re # Configuration from environment variables AGENTEX_API_BASE_URL = os.environ.get("AGENTEX_API_BASE_URL", "http://localhost:5003") @@ -65,7 +66,7 @@ class TestNonStreamingEvents: """Test non-streaming event sending and polling.""" @pytest.mark.asyncio - async def test_send_event_and_poll(self, client: AsyncAgentex, agent_name: str, agent_id: str): + async def test_send_event_and_poll(self, client: AsyncAgentex, _agent_name: str, agent_id: str): """Test sending a single event and polling for the response.""" # Create a task for this conversation task_response = await client.agents.create_task(agent_id, params=ParamsCreateTaskRequest(name=uuid.uuid1().hex)) diff --git a/examples/tutorials/10_agentic/00_base/090_multi_agent_non_temporal/tests/test_agent.py b/examples/tutorials/10_agentic/00_base/090_multi_agent_non_temporal/tests/test_agent.py index cad98b29..da764a39 100644 --- a/examples/tutorials/10_agentic/00_base/090_multi_agent_non_temporal/tests/test_agent.py +++ b/examples/tutorials/10_agentic/00_base/090_multi_agent_non_temporal/tests/test_agent.py @@ -17,16 +17,17 @@ import os import uuid + import pytest import pytest_asyncio -from agentex import AsyncAgentex -from agentex.types.agent_rpc_params import ParamsCreateTaskRequest from test_utils.agentic import ( - send_event_and_poll_yielding, stream_agent_response, + send_event_and_poll_yielding, ) -from agentex.types.text_content_param import TextContentParam +from agentex import AsyncAgentex +from agentex.types.agent_rpc_params import ParamsCreateTaskRequest +from agentex.types.text_content_param import TextContentParam # Configuration from environment variables AGENTEX_API_BASE_URL = os.environ.get("AGENTEX_API_BASE_URL", "http://localhost:5003") @@ -61,7 +62,7 @@ class TestNonStreamingEvents: """Test non-streaming event sending and polling.""" @pytest.mark.asyncio - async def test_multi_agent_workflow_complete(self, client: AsyncAgentex, agent_name: str, agent_id: str): + async def test_multi_agent_workflow_complete(self, client: AsyncAgentex, _agent_name: str, agent_id: str): """Test the complete multi-agent workflow with all agents using polling that yields messages.""" # Create a task for the orchestrator task_response = await client.agents.create_task(agent_id, params=ParamsCreateTaskRequest(name=uuid.uuid1().hex)) @@ -145,7 +146,7 @@ class TestStreamingEvents: """Test streaming event sending.""" @pytest.mark.asyncio - async def test_multi_agent_workflow_streaming(self, client: AsyncAgentex, agent_name: str, agent_id: str): + async def test_multi_agent_workflow_streaming(self, client: AsyncAgentex, _agent_name: str, agent_id: str): """Test the multi-agent workflow with streaming responses and early exit.""" # Create a task for the orchestrator task_response = await client.agents.create_task(agent_id, params=ParamsCreateTaskRequest(name=uuid.uuid1().hex)) diff --git a/examples/tutorials/10_agentic/10_temporal/000_hello_acp/tests/test_agent.py b/examples/tutorials/10_agentic/10_temporal/000_hello_acp/tests/test_agent.py index 83729186..02ff6bed 100644 --- a/examples/tutorials/10_agentic/10_temporal/000_hello_acp/tests/test_agent.py +++ b/examples/tutorials/10_agentic/10_temporal/000_hello_acp/tests/test_agent.py @@ -16,18 +16,19 @@ """ import os -from agentex.types import TaskMessage +import uuid +import asyncio + import pytest import pytest_asyncio -from agentex import AsyncAgentex from test_utils.agentic import ( - send_event_and_poll_yielding, - stream_agent_response, poll_messages, + stream_agent_response, + send_event_and_poll_yielding, ) -import uuid -import asyncio +from agentex import AsyncAgentex +from agentex.types import TaskMessage from agentex.types.agent_rpc_params import ParamsCreateTaskRequest from agentex.types.text_content_param import TextContentParam @@ -64,7 +65,7 @@ class TestNonStreamingEvents: """Test non-streaming event sending and polling.""" @pytest.mark.asyncio - async def test_send_event_and_poll(self, client: AsyncAgentex, agent_name: str, agent_id: str): + async def test_send_event_and_poll(self, client: AsyncAgentex, _agent_name: str, agent_id: str): """Test sending an event and polling for the response.""" # Create a task for this conversation task_response = await client.agents.create_task(agent_id, params=ParamsCreateTaskRequest(name=uuid.uuid1().hex)) @@ -103,7 +104,7 @@ class TestStreamingEvents: """Test streaming event sending.""" @pytest.mark.asyncio - async def test_send_event_and_stream(self, client: AsyncAgentex, agent_name: str, agent_id: str): + async def test_send_event_and_stream(self, client: AsyncAgentex, _agent_name: str, agent_id: str): """Test sending an event and streaming the response.""" task_response = await client.agents.create_task(agent_id, params=ParamsCreateTaskRequest(name=uuid.uuid1().hex)) task = task_response.result diff --git a/examples/tutorials/10_agentic/10_temporal/010_agent_chat/tests/test_agent.py b/examples/tutorials/10_agentic/10_temporal/010_agent_chat/tests/test_agent.py index e57d90e7..99874076 100644 --- a/examples/tutorials/10_agentic/10_temporal/010_agent_chat/tests/test_agent.py +++ b/examples/tutorials/10_agentic/10_temporal/010_agent_chat/tests/test_agent.py @@ -24,23 +24,21 @@ - AGENT_NAME: Name of the agent to test (default: at010-agent-chat) """ -from agentex.lib.utils.dev_tools.async_messages import subscribe_to_async_task_messages -from agentex.types.agent_rpc_result import StreamTaskMessageDone -from agentex.types.agent_rpc_result import StreamTaskMessageFull -from typing import List import os import uuid -from agentex.types import TaskMessage, TextContent -from agentex.types.task import Task +import asyncio + import pytest import pytest_asyncio -from agentex import AsyncAgentex -from agentex.types.agent_rpc_params import ParamsCreateTaskRequest from test_utils.agentic import ( - send_event_and_poll_yielding, stream_agent_response, + send_event_and_poll_yielding, ) -import asyncio + +from agentex import AsyncAgentex +from agentex.types import TaskMessage, TextContent +from agentex.types.agent_rpc_params import ParamsCreateTaskRequest +from agentex.types.agent_rpc_result import StreamTaskMessageDone, StreamTaskMessageFull from agentex.types.text_content_param import TextContentParam # Configuration from environment variables @@ -76,7 +74,7 @@ class TestNonStreamingEvents: """Test non-streaming event sending and polling with OpenAI Agents SDK.""" @pytest.mark.asyncio - async def test_send_event_and_poll_simple_query(self, client: AsyncAgentex, agent_name: str, agent_id: str): + async def test_send_event_and_poll_simple_query(self, client: AsyncAgentex, _agent_name: str, agent_id: str): """Test sending a simple event and polling for the response (no tool use).""" # Create a task for this conversation task_response = await client.agents.create_task(agent_id, params=ParamsCreateTaskRequest(name=uuid.uuid1().hex)) diff --git a/examples/tutorials/10_agentic/10_temporal/020_state_machine/tests/test_agent.py b/examples/tutorials/10_agentic/10_temporal/020_state_machine/tests/test_agent.py index 0c3da525..207c40b3 100644 --- a/examples/tutorials/10_agentic/10_temporal/020_state_machine/tests/test_agent.py +++ b/examples/tutorials/10_agentic/10_temporal/020_state_machine/tests/test_agent.py @@ -24,24 +24,21 @@ - AGENT_NAME: Name of the agent to test (default: at020-state-machine) """ -from agentex.types.tool_request_content import ToolRequestContent -from pure_eval.core import is_expression_interesting import os import uuid import asyncio + import pytest import pytest_asyncio -from agentex import AsyncAgentex -from agentex.types import TaskMessage, TextContent -from agentex.types.agent_rpc_params import ParamsCreateTaskRequest -from agentex.types.text_content_param import TextContentParam from test_utils.agentic import ( - send_event_and_poll_yielding, - stream_agent_response, - poll_messages, stream_task_messages, + send_event_and_poll_yielding, ) +from agentex import AsyncAgentex +from agentex.types.agent_rpc_params import ParamsCreateTaskRequest +from agentex.types.text_content_param import TextContentParam +from agentex.types.tool_request_content import ToolRequestContent # Configuration from environment variables AGENTEX_API_BASE_URL = os.environ.get("AGENTEX_API_BASE_URL", "http://localhost:5003") @@ -75,7 +72,7 @@ async def agent_id(client, agent_name): class TestNonStreamingEvents: """Test non-streaming event sending and polling with state machine workflow.""" @pytest.mark.asyncio - async def test_send_event_and_poll_simple_query(self, client: AsyncAgentex, agent_name: str, agent_id: str): + async def test_send_event_and_poll_simple_query(self, client: AsyncAgentex, _agent_name: str, agent_id: str): """Test sending a simple event and polling for the response (no tool use).""" # Create a task for this conversation task_response = await client.agents.create_task(agent_id, params=ParamsCreateTaskRequest(name=uuid.uuid1().hex)) @@ -130,7 +127,7 @@ async def test_send_event_and_poll_simple_query(self, client: AsyncAgentex, agen class TestStreamingEvents: """Test streaming event sending with state machine workflow.""" @pytest.mark.asyncio - async def test_send_event_and_stream(self, client: AsyncAgentex, agent_name: str, agent_id: str): + async def test_send_event_and_stream(self, client: AsyncAgentex, _agent_name: str, agent_id: str): """Test sending an event and streaming the response.""" # Create a task for this conversation task_response = await client.agents.create_task(agent_id, params=ParamsCreateTaskRequest(name=uuid.uuid1().hex)) diff --git a/examples/tutorials/10_agentic/10_temporal/030_custom_activities/tests/test_agent.py b/examples/tutorials/10_agentic/10_temporal/030_custom_activities/tests/test_agent.py index aae663dd..d57d34ff 100644 --- a/examples/tutorials/10_agentic/10_temporal/030_custom_activities/tests/test_agent.py +++ b/examples/tutorials/10_agentic/10_temporal/030_custom_activities/tests/test_agent.py @@ -16,22 +16,11 @@ """ import os -import uuid -import asyncio + import pytest import pytest_asyncio -from agentex import AsyncAgentex -from agentex.types import TaskMessage -from agentex.types.agent_rpc_params import ParamsCreateTaskRequest -from agentex.types.text_content_param import TextContentParam -from test_utils.agentic import ( - poll_for_agent_response, - send_event_and_poll_yielding, - stream_agent_response, - validate_text_in_response, - poll_messages, -) +from agentex import AsyncAgentex # Configuration from environment variables AGENTEX_API_BASE_URL = os.environ.get("AGENTEX_API_BASE_URL", "http://localhost:5003") @@ -66,7 +55,7 @@ class TestNonStreamingEvents: """Test non-streaming event sending and polling.""" @pytest.mark.asyncio - async def test_send_event_and_poll(self, client: AsyncAgentex, agent_name: str, agent_id: str): + async def test_send_event_and_poll(self, client: AsyncAgentex, _agent_name: str, agent_id: str): """Test sending an event and polling for the response.""" # TODO: Create a task for this conversation # task_response = await client.agents.create_task(agent_id, params=ParamsCreateTaskRequest(name=uuid.uuid1().hex)) @@ -108,7 +97,7 @@ class TestStreamingEvents: """Test streaming event sending.""" @pytest.mark.asyncio - async def test_send_event_and_stream(self, client: AsyncAgentex, agent_name: str, agent_id: str): + async def test_send_event_and_stream(self, client: AsyncAgentex, _agent_name: str, agent_id: str): """Test sending an event and streaming the response.""" # TODO: Create a task for this conversation # task_response = await client.agents.create_task(agent_id, params=ParamsCreateTaskRequest(name=uuid.uuid1().hex)) diff --git a/examples/tutorials/10_agentic/10_temporal/050_agent_chat_guardrails/tests/test_agent.py b/examples/tutorials/10_agentic/10_temporal/050_agent_chat_guardrails/tests/test_agent.py index fe44b317..d6d4da01 100644 --- a/examples/tutorials/10_agentic/10_temporal/050_agent_chat_guardrails/tests/test_agent.py +++ b/examples/tutorials/10_agentic/10_temporal/050_agent_chat_guardrails/tests/test_agent.py @@ -16,22 +16,11 @@ """ import os -import uuid -import asyncio + import pytest import pytest_asyncio -from agentex import AsyncAgentex -from agentex.types import TaskMessage -from agentex.types.agent_rpc_params import ParamsCreateTaskRequest -from agentex.types.text_content_param import TextContentParam -from test_utils.agentic import ( - poll_for_agent_response, - send_event_and_poll_yielding, - stream_agent_response, - validate_text_in_response, - poll_messages, -) +from agentex import AsyncAgentex # Configuration from environment variables AGENTEX_API_BASE_URL = os.environ.get("AGENTEX_API_BASE_URL", "http://localhost:5003") @@ -66,7 +55,7 @@ class TestNonStreamingEvents: """Test non-streaming event sending and polling.""" @pytest.mark.asyncio - async def test_send_event_and_poll(self, client: AsyncAgentex, agent_name: str, agent_id: str): + async def test_send_event_and_poll(self, client: AsyncAgentex, _agent_name: str, agent_id: str): """Test sending an event and polling for the response.""" # TODO: Create a task for this conversation # task_response = await client.agents.create_task(agent_id, params=ParamsCreateTaskRequest(name=uuid.uuid1().hex)) @@ -108,7 +97,7 @@ class TestStreamingEvents: """Test streaming event sending.""" @pytest.mark.asyncio - async def test_send_event_and_stream(self, client: AsyncAgentex, agent_name: str, agent_id: str): + async def test_send_event_and_stream(self, client: AsyncAgentex, _agent_name: str, agent_id: str): """Test sending an event and streaming the response.""" # TODO: Create a task for this conversation # task_response = await client.agents.create_task(agent_id, params=ParamsCreateTaskRequest(name=uuid.uuid1().hex)) diff --git a/examples/tutorials/10_agentic/10_temporal/060_open_ai_agents_sdk_hello_world/tests/test_agent.py b/examples/tutorials/10_agentic/10_temporal/060_open_ai_agents_sdk_hello_world/tests/test_agent.py index ed51900d..551999a1 100644 --- a/examples/tutorials/10_agentic/10_temporal/060_open_ai_agents_sdk_hello_world/tests/test_agent.py +++ b/examples/tutorials/10_agentic/10_temporal/060_open_ai_agents_sdk_hello_world/tests/test_agent.py @@ -16,22 +16,11 @@ """ import os -import uuid -import asyncio + import pytest import pytest_asyncio -from agentex import AsyncAgentex -from agentex.types import TaskMessage -from agentex.types.agent_rpc_params import ParamsCreateTaskRequest -from agentex.types.text_content_param import TextContentParam -from test_utils.agentic import ( - poll_for_agent_response, - send_event_and_poll_yielding, - stream_agent_response, - validate_text_in_response, - poll_messages, -) +from agentex import AsyncAgentex # Configuration from environment variables AGENTEX_API_BASE_URL = os.environ.get("AGENTEX_API_BASE_URL", "http://localhost:5003") @@ -66,7 +55,7 @@ class TestNonStreamingEvents: """Test non-streaming event sending and polling.""" @pytest.mark.asyncio - async def test_send_event_and_poll(self, client: AsyncAgentex, agent_name: str, agent_id: str): + async def test_send_event_and_poll(self, client: AsyncAgentex, _agent_name: str, agent_id: str): """Test sending an event and polling for the response.""" # TODO: Create a task for this conversation # task_response = await client.agents.create_task(agent_id, params=ParamsCreateTaskRequest(name=uuid.uuid1().hex)) @@ -108,7 +97,7 @@ class TestStreamingEvents: """Test streaming event sending.""" @pytest.mark.asyncio - async def test_send_event_and_stream(self, client: AsyncAgentex, agent_name: str, agent_id: str): + async def test_send_event_and_stream(self, client: AsyncAgentex, _agent_name: str, agent_id: str): """Test sending an event and streaming the response.""" # TODO: Create a task for this conversation # task_response = await client.agents.create_task(agent_id, params=ParamsCreateTaskRequest(name=uuid.uuid1().hex)) diff --git a/examples/tutorials/10_agentic/10_temporal/070_open_ai_agents_sdk_tools/tests/test_agent.py b/examples/tutorials/10_agentic/10_temporal/070_open_ai_agents_sdk_tools/tests/test_agent.py index ed51900d..551999a1 100644 --- a/examples/tutorials/10_agentic/10_temporal/070_open_ai_agents_sdk_tools/tests/test_agent.py +++ b/examples/tutorials/10_agentic/10_temporal/070_open_ai_agents_sdk_tools/tests/test_agent.py @@ -16,22 +16,11 @@ """ import os -import uuid -import asyncio + import pytest import pytest_asyncio -from agentex import AsyncAgentex -from agentex.types import TaskMessage -from agentex.types.agent_rpc_params import ParamsCreateTaskRequest -from agentex.types.text_content_param import TextContentParam -from test_utils.agentic import ( - poll_for_agent_response, - send_event_and_poll_yielding, - stream_agent_response, - validate_text_in_response, - poll_messages, -) +from agentex import AsyncAgentex # Configuration from environment variables AGENTEX_API_BASE_URL = os.environ.get("AGENTEX_API_BASE_URL", "http://localhost:5003") @@ -66,7 +55,7 @@ class TestNonStreamingEvents: """Test non-streaming event sending and polling.""" @pytest.mark.asyncio - async def test_send_event_and_poll(self, client: AsyncAgentex, agent_name: str, agent_id: str): + async def test_send_event_and_poll(self, client: AsyncAgentex, _agent_name: str, agent_id: str): """Test sending an event and polling for the response.""" # TODO: Create a task for this conversation # task_response = await client.agents.create_task(agent_id, params=ParamsCreateTaskRequest(name=uuid.uuid1().hex)) @@ -108,7 +97,7 @@ class TestStreamingEvents: """Test streaming event sending.""" @pytest.mark.asyncio - async def test_send_event_and_stream(self, client: AsyncAgentex, agent_name: str, agent_id: str): + async def test_send_event_and_stream(self, client: AsyncAgentex, _agent_name: str, agent_id: str): """Test sending an event and streaming the response.""" # TODO: Create a task for this conversation # task_response = await client.agents.create_task(agent_id, params=ParamsCreateTaskRequest(name=uuid.uuid1().hex)) diff --git a/examples/tutorials/10_agentic/10_temporal/080_open_ai_agents_sdk_human_in_the_loop/tests/test_agent.py b/examples/tutorials/10_agentic/10_temporal/080_open_ai_agents_sdk_human_in_the_loop/tests/test_agent.py index ed51900d..551999a1 100644 --- a/examples/tutorials/10_agentic/10_temporal/080_open_ai_agents_sdk_human_in_the_loop/tests/test_agent.py +++ b/examples/tutorials/10_agentic/10_temporal/080_open_ai_agents_sdk_human_in_the_loop/tests/test_agent.py @@ -16,22 +16,11 @@ """ import os -import uuid -import asyncio + import pytest import pytest_asyncio -from agentex import AsyncAgentex -from agentex.types import TaskMessage -from agentex.types.agent_rpc_params import ParamsCreateTaskRequest -from agentex.types.text_content_param import TextContentParam -from test_utils.agentic import ( - poll_for_agent_response, - send_event_and_poll_yielding, - stream_agent_response, - validate_text_in_response, - poll_messages, -) +from agentex import AsyncAgentex # Configuration from environment variables AGENTEX_API_BASE_URL = os.environ.get("AGENTEX_API_BASE_URL", "http://localhost:5003") @@ -66,7 +55,7 @@ class TestNonStreamingEvents: """Test non-streaming event sending and polling.""" @pytest.mark.asyncio - async def test_send_event_and_poll(self, client: AsyncAgentex, agent_name: str, agent_id: str): + async def test_send_event_and_poll(self, client: AsyncAgentex, _agent_name: str, agent_id: str): """Test sending an event and polling for the response.""" # TODO: Create a task for this conversation # task_response = await client.agents.create_task(agent_id, params=ParamsCreateTaskRequest(name=uuid.uuid1().hex)) @@ -108,7 +97,7 @@ class TestStreamingEvents: """Test streaming event sending.""" @pytest.mark.asyncio - async def test_send_event_and_stream(self, client: AsyncAgentex, agent_name: str, agent_id: str): + async def test_send_event_and_stream(self, client: AsyncAgentex, _agent_name: str, agent_id: str): """Test sending an event and streaming the response.""" # TODO: Create a task for this conversation # task_response = await client.agents.create_task(agent_id, params=ParamsCreateTaskRequest(name=uuid.uuid1().hex)) diff --git a/examples/tutorials/test_utils/agentic.py b/examples/tutorials/test_utils/agentic.py index 33446160..fcee04ea 100644 --- a/examples/tutorials/test_utils/agentic.py +++ b/examples/tutorials/test_utils/agentic.py @@ -5,20 +5,16 @@ including task creation, event sending, response polling, and streaming. """ -from agentex.types.agent_rpc_result import StreamTaskMessageDone -from agentex.types.agent_rpc_result import StreamTaskMessageFull -import asyncio import json -from datetime import datetime, timezone import time -from typing import AsyncGenerator, List, Optional, Tuple, Generator - -from click.formatting import measure_table +import asyncio +from typing import Optional, AsyncGenerator +from datetime import datetime, timezone from agentex._client import AsyncAgentex -from agentex.types.agent_rpc_params import ParamsSendEventRequest -from agentex.types.message_list_response import MessageListResponse from agentex.types.task_message import TaskMessage +from agentex.types.agent_rpc_params import ParamsSendEventRequest +from agentex.types.agent_rpc_result import StreamTaskMessageDone, StreamTaskMessageFull from agentex.types.text_content_param import TextContentParam diff --git a/examples/tutorials/test_utils/sync.py b/examples/tutorials/test_utils/sync.py index 8fc9e04d..808ee0af 100644 --- a/examples/tutorials/test_utils/sync.py +++ b/examples/tutorials/test_utils/sync.py @@ -4,13 +4,14 @@ This module provides helper functions for validating agent responses in both streaming and non-streaming scenarios. """ +from __future__ import annotations -from typing import Callable, List, Optional, Generator +from typing import List, Callable, Optional, Generator -from agentex.types import TextContent, TextDelta -from agentex.types.agent_rpc_response import SendMessageResponse +from agentex.types import TextDelta, TextContent from agentex.types.agent_rpc_result import StreamTaskMessageDone -from agentex.types.task_message_update import StreamTaskMessageDelta, StreamTaskMessageFull +from agentex.types.agent_rpc_response import SendMessageResponse +from agentex.types.task_message_update import StreamTaskMessageFull, StreamTaskMessageDelta def validate_text_content(content: TextContent, validator: Optional[Callable[[str], bool]] = None) -> str: diff --git a/src/agentex/lib/cli/commands/init.py b/src/agentex/lib/cli/commands/init.py index 75363f0d..27402406 100644 --- a/src/agentex/lib/cli/commands/init.py +++ b/src/agentex/lib/cli/commands/init.py @@ -6,12 +6,11 @@ import questionary from jinja2 import Environment, FileSystemLoader +from rich.rule import Rule +from rich.text import Text from rich.panel import Panel from rich.table import Table from rich.console import Console -from rich.syntax import Syntax -from rich.text import Text -from rich.rule import Rule from agentex.lib.utils.logging import make_logger diff --git a/src/agentex/lib/cli/templates/default/test_agent.py.j2 b/src/agentex/lib/cli/templates/default/test_agent.py.j2 index 27ff0e39..201ce257 100644 --- a/src/agentex/lib/cli/templates/default/test_agent.py.j2 +++ b/src/agentex/lib/cli/templates/default/test_agent.py.j2 @@ -66,7 +66,7 @@ class TestNonStreamingEvents: """Test non-streaming event sending and polling.""" @pytest.mark.asyncio - async def test_send_event_and_poll(self, client: AsyncAgentex, agent_name: str, agent_id: str): + async def test_send_event_and_poll(self, client: AsyncAgentex, _agent_name: str, agent_id: str): """Test sending an event and polling for the response.""" # TODO: Create a task for this conversation # task_response = await client.agents.create_task(agent_id, params=ParamsCreateTaskRequest(name=uuid.uuid1().hex)) @@ -108,7 +108,7 @@ class TestStreamingEvents: """Test streaming event sending.""" @pytest.mark.asyncio - async def test_send_event_and_stream(self, client: AsyncAgentex, agent_name: str, agent_id: str): + async def test_send_event_and_stream(self, client: AsyncAgentex, _agent_name: str, agent_id: str): """Test sending an event and streaming the response.""" # TODO: Create a task for this conversation # task_response = await client.agents.create_task(agent_id, params=ParamsCreateTaskRequest(name=uuid.uuid1().hex)) diff --git a/src/agentex/lib/cli/templates/sync/test_agent.py.j2 b/src/agentex/lib/cli/templates/sync/test_agent.py.j2 index 996104a3..7de4684f 100644 --- a/src/agentex/lib/cli/templates/sync/test_agent.py.j2 +++ b/src/agentex/lib/cli/templates/sync/test_agent.py.j2 @@ -51,7 +51,7 @@ def agent_id(client, agent_name): class TestNonStreamingMessages: """Test non-streaming message sending.""" - def test_send_message(self, client: Agentex, agent_name: str): + def test_send_message(self, client: Agentex, _agent_name: str): """Test sending a message and receiving a response.""" # TODO: Fill in the test based on what data your agent is expected to handle ... @@ -60,7 +60,7 @@ class TestNonStreamingMessages: class TestStreamingMessages: """Test streaming message sending.""" - def test_send_stream_message(self, client: Agentex, agent_name: str): + def test_send_stream_message(self, client: Agentex, _agent_name: str): """Test streaming a message and aggregating deltas.""" # TODO: Fill in the test based on what data your agent is expected to handle ... diff --git a/src/agentex/lib/cli/templates/temporal/test_agent.py.j2 b/src/agentex/lib/cli/templates/temporal/test_agent.py.j2 index 27ff0e39..201ce257 100644 --- a/src/agentex/lib/cli/templates/temporal/test_agent.py.j2 +++ b/src/agentex/lib/cli/templates/temporal/test_agent.py.j2 @@ -66,7 +66,7 @@ class TestNonStreamingEvents: """Test non-streaming event sending and polling.""" @pytest.mark.asyncio - async def test_send_event_and_poll(self, client: AsyncAgentex, agent_name: str, agent_id: str): + async def test_send_event_and_poll(self, client: AsyncAgentex, _agent_name: str, agent_id: str): """Test sending an event and polling for the response.""" # TODO: Create a task for this conversation # task_response = await client.agents.create_task(agent_id, params=ParamsCreateTaskRequest(name=uuid.uuid1().hex)) @@ -108,7 +108,7 @@ class TestStreamingEvents: """Test streaming event sending.""" @pytest.mark.asyncio - async def test_send_event_and_stream(self, client: AsyncAgentex, agent_name: str, agent_id: str): + async def test_send_event_and_stream(self, client: AsyncAgentex, _agent_name: str, agent_id: str): """Test sending an event and streaming the response.""" # TODO: Create a task for this conversation # task_response = await client.agents.create_task(agent_id, params=ParamsCreateTaskRequest(name=uuid.uuid1().hex))