From be9b60326817566d5c5edcbd7b7babb6db07e539 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 23 Jul 2025 00:24:02 +0000 Subject: [PATCH 1/4] feat(api): api update --- .stats.yml | 4 +- api.md | 28 +----- src/agentex/resources/agents.py | 36 +++----- src/agentex/resources/messages/batch.py | 9 +- src/agentex/resources/messages/messages.py | 21 +++-- src/agentex/types/__init__.py | 11 +-- src/agentex/types/agent_rpc_by_name_params.py | 76 ++++++++++++++-- src/agentex/types/agent_rpc_params.py | 54 ++++++++--- src/agentex/types/agent_rpc_params1.py | 21 ----- src/agentex/types/agent_rpc_response.py | 20 ----- src/agentex/types/agent_rpc_result.py | 90 ------------------- src/agentex/types/data_delta.py | 14 --- src/agentex/types/event.py | 17 +++- src/agentex/types/message_create_params.py | 19 ++-- src/agentex/types/message_update_params.py | 19 ++-- .../types/messages/batch_create_params.py | 16 ++-- .../types/messages/batch_update_params.py | 16 ++-- src/agentex/types/shared/__init__.py | 3 - .../types/shared/task_message_update.py | 83 ----------------- src/agentex/types/streaming_status.py | 7 ++ src/agentex/types/task_message.py | 37 ++++---- src/agentex/types/task_message_content.py | 16 ---- .../types/task_message_content_param.py | 17 ---- src/agentex/types/task_message_delta.py | 16 ---- src/agentex/types/text_delta.py | 14 --- src/agentex/types/tool_request_delta.py | 18 ---- src/agentex/types/tool_response_delta.py | 18 ---- tests/api_resources/test_agents.py | 38 ++++---- 28 files changed, 253 insertions(+), 485 deletions(-) delete mode 100644 src/agentex/types/agent_rpc_params1.py delete mode 100644 src/agentex/types/agent_rpc_response.py delete mode 100644 src/agentex/types/agent_rpc_result.py delete mode 100644 src/agentex/types/data_delta.py delete mode 100644 src/agentex/types/shared/__init__.py delete mode 100644 src/agentex/types/shared/task_message_update.py create mode 100644 src/agentex/types/streaming_status.py delete mode 100644 src/agentex/types/task_message_content.py delete mode 100644 src/agentex/types/task_message_content_param.py delete mode 100644 src/agentex/types/task_message_delta.py delete mode 100644 src/agentex/types/text_delta.py delete mode 100644 src/agentex/types/tool_request_delta.py delete mode 100644 src/agentex/types/tool_response_delta.py diff --git a/.stats.yml b/.stats.yml index 3a087b17..9ea4b275 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 34 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/sgp%2Fagentex-sdk-1d08fb2290b5310c91801d7575d356628d372fd5434e15d3b9cead48eadb893f.yml -openapi_spec_hash: c07c588fb8429fbf024189df62f20fa4 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/sgp%2Fagentex-sdk-021b55c88964b7a5bfc9d692d32a52c6b0150445656d2407c4cb8e9dd1e5f100.yml +openapi_spec_hash: ed92c0d5d6bed9cb5617f8a776ac42c9 config_hash: 2e4b423af3db79ebd8170c401ea9093a diff --git a/api.md b/api.md index f0754dd0..8c2841ca 100644 --- a/api.md +++ b/api.md @@ -1,30 +1,9 @@ -# Shared Types - -```python -from agentex.types import TaskMessageUpdate -``` - # Agents Types: ```python -from agentex.types import ( - AcpType, - Agent, - AgentRpcParams, - AgentRpcRequest, - AgentRpcResponse, - AgentRpcResult, - DataDelta, - TaskMessageContent, - TaskMessageDelta, - TaskMessageUpdate, - TextDelta, - ToolRequestDelta, - ToolResponseDelta, - AgentListResponse, -) +from agentex.types import AcpType, Agent, AgentRpcRequest, AgentListResponse ``` Methods: @@ -34,8 +13,8 @@ Methods: - client.agents.delete(agent_id) -> Agent - client.agents.delete_by_name(agent_name) -> Agent - client.agents.retrieve_by_name(agent_name) -> Agent -- client.agents.rpc(agent_id, \*\*params) -> AgentRpcResponse -- client.agents.rpc_by_name(agent_name, \*\*params) -> AgentRpcResponse +- client.agents.rpc(agent_id, \*\*params) -> object +- client.agents.rpc_by_name(agent_name, \*\*params) -> object # Tasks @@ -64,6 +43,7 @@ from agentex.types import ( DataContent, MessageAuthor, MessageStyle, + StreamingStatus, TaskMessage, TextContent, ToolRequestContent, diff --git a/src/agentex/resources/agents.py b/src/agentex/resources/agents.py index 8b329be8..9c2e4bd5 100644 --- a/src/agentex/resources/agents.py +++ b/src/agentex/resources/agents.py @@ -7,7 +7,7 @@ import httpx -from ..types import AgentRpcParams, agent_rpc_params, agent_list_params, agent_rpc_by_name_params +from ..types import agent_rpc_params, agent_list_params, agent_rpc_by_name_params from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven from .._utils import maybe_transform, async_maybe_transform from .._compat import cached_property @@ -20,8 +20,6 @@ ) from ..types.agent import Agent from .._base_client import make_request_options -from ..types.agent_rpc_params import AgentRpcParams -from ..types.agent_rpc_response import AgentRpcResponse from ..types.agent_list_response import AgentListResponse __all__ = ["AgentsResource", "AsyncAgentsResource"] @@ -221,7 +219,7 @@ def rpc( agent_id: str, *, method: Literal["event/send", "task/create", "message/send", "task/cancel"], - params: AgentRpcParams, + params: agent_rpc_params.Params, id: Union[int, str, None] | NotGiven = NOT_GIVEN, jsonrpc: Literal["2.0"] | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. @@ -230,13 +228,11 @@ def rpc( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> AgentRpcResponse: + ) -> object: """ Handle JSON-RPC requests for an agent by its unique ID. Args: - params: The parameters for the agent RPC request - extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -261,7 +257,7 @@ def rpc( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=AgentRpcResponse, + cast_to=object, ) def rpc_by_name( @@ -269,7 +265,7 @@ def rpc_by_name( agent_name: str, *, method: Literal["event/send", "task/create", "message/send", "task/cancel"], - params: AgentRpcParams, + params: agent_rpc_by_name_params.Params, id: Union[int, str, None] | NotGiven = NOT_GIVEN, jsonrpc: Literal["2.0"] | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. @@ -278,13 +274,11 @@ def rpc_by_name( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> AgentRpcResponse: + ) -> object: """ Handle JSON-RPC requests for an agent by its unique name. Args: - params: The parameters for the agent RPC request - extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -309,7 +303,7 @@ def rpc_by_name( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=AgentRpcResponse, + cast_to=object, ) @@ -507,7 +501,7 @@ async def rpc( agent_id: str, *, method: Literal["event/send", "task/create", "message/send", "task/cancel"], - params: AgentRpcParams, + params: agent_rpc_params.Params, id: Union[int, str, None] | NotGiven = NOT_GIVEN, jsonrpc: Literal["2.0"] | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. @@ -516,13 +510,11 @@ async def rpc( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> AgentRpcResponse: + ) -> object: """ Handle JSON-RPC requests for an agent by its unique ID. Args: - params: The parameters for the agent RPC request - extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -547,7 +539,7 @@ async def rpc( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=AgentRpcResponse, + cast_to=object, ) async def rpc_by_name( @@ -555,7 +547,7 @@ async def rpc_by_name( agent_name: str, *, method: Literal["event/send", "task/create", "message/send", "task/cancel"], - params: AgentRpcParams, + params: agent_rpc_by_name_params.Params, id: Union[int, str, None] | NotGiven = NOT_GIVEN, jsonrpc: Literal["2.0"] | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. @@ -564,13 +556,11 @@ async def rpc_by_name( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> AgentRpcResponse: + ) -> object: """ Handle JSON-RPC requests for an agent by its unique name. Args: - params: The parameters for the agent RPC request - extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -595,7 +585,7 @@ async def rpc_by_name( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=AgentRpcResponse, + cast_to=object, ) diff --git a/src/agentex/resources/messages/batch.py b/src/agentex/resources/messages/batch.py index 58412663..478c2df5 100644 --- a/src/agentex/resources/messages/batch.py +++ b/src/agentex/resources/messages/batch.py @@ -18,7 +18,6 @@ ) from ..._base_client import make_request_options from ...types.messages import batch_create_params, batch_update_params -from ...types.task_message_content_param import TaskMessageContentParam from ...types.messages.batch_create_response import BatchCreateResponse from ...types.messages.batch_update_response import BatchUpdateResponse @@ -48,7 +47,7 @@ def with_streaming_response(self) -> BatchResourceWithStreamingResponse: def create( self, *, - contents: Iterable[TaskMessageContentParam], + contents: Iterable[batch_create_params.Content], task_id: str, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. @@ -88,7 +87,7 @@ def update( self, *, task_id: str, - updates: Dict[str, TaskMessageContentParam], + updates: Dict[str, batch_update_params.Updates], # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -147,7 +146,7 @@ def with_streaming_response(self) -> AsyncBatchResourceWithStreamingResponse: async def create( self, *, - contents: Iterable[TaskMessageContentParam], + contents: Iterable[batch_create_params.Content], task_id: str, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. @@ -187,7 +186,7 @@ async def update( self, *, task_id: str, - updates: Dict[str, TaskMessageContentParam], + updates: Dict[str, batch_update_params.Updates], # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, diff --git a/src/agentex/resources/messages/messages.py b/src/agentex/resources/messages/messages.py index b7f78c94..7745cf76 100644 --- a/src/agentex/resources/messages/messages.py +++ b/src/agentex/resources/messages/messages.py @@ -3,7 +3,6 @@ from __future__ import annotations from typing import Optional -from typing_extensions import Literal import httpx @@ -15,7 +14,7 @@ BatchResourceWithStreamingResponse, AsyncBatchResourceWithStreamingResponse, ) -from ...types import message_list_params, message_create_params, message_update_params +from ...types import StreamingStatus, message_list_params, message_create_params, message_update_params from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven from ..._utils import maybe_transform, async_maybe_transform from ..._compat import cached_property @@ -28,8 +27,8 @@ ) from ..._base_client import make_request_options from ...types.task_message import TaskMessage +from ...types.streaming_status import StreamingStatus from ...types.message_list_response import MessageListResponse -from ...types.task_message_content_param import TaskMessageContentParam __all__ = ["MessagesResource", "AsyncMessagesResource"] @@ -61,9 +60,9 @@ def with_streaming_response(self) -> MessagesResourceWithStreamingResponse: def create( self, *, - content: TaskMessageContentParam, + content: message_create_params.Content, task_id: str, - streaming_status: Optional[Literal["IN_PROGRESS", "DONE"]] | NotGiven = NOT_GIVEN, + streaming_status: Optional[StreamingStatus] | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -136,9 +135,9 @@ def update( self, message_id: str, *, - content: TaskMessageContentParam, + content: message_update_params.Content, task_id: str, - streaming_status: Optional[Literal["IN_PROGRESS", "DONE"]] | NotGiven = NOT_GIVEN, + streaming_status: Optional[StreamingStatus] | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -246,9 +245,9 @@ def with_streaming_response(self) -> AsyncMessagesResourceWithStreamingResponse: async def create( self, *, - content: TaskMessageContentParam, + content: message_create_params.Content, task_id: str, - streaming_status: Optional[Literal["IN_PROGRESS", "DONE"]] | NotGiven = NOT_GIVEN, + streaming_status: Optional[StreamingStatus] | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -321,9 +320,9 @@ async def update( self, message_id: str, *, - content: TaskMessageContentParam, + content: message_update_params.Content, task_id: str, - streaming_status: Optional[Literal["IN_PROGRESS", "DONE"]] | NotGiven = NOT_GIVEN, + streaming_status: Optional[StreamingStatus] | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, diff --git a/src/agentex/types/__init__.py b/src/agentex/types/__init__.py index f021a20d..a5e72143 100644 --- a/src/agentex/types/__init__.py +++ b/src/agentex/types/__init__.py @@ -7,40 +7,32 @@ from .agent import Agent as Agent from .event import Event as Event from .state import State as State -from .shared import TaskMessageUpdate as TaskMessageUpdate from .acp_type import AcpType as AcpType -from .data_delta import DataDelta as DataDelta -from .text_delta import TextDelta as TextDelta from .data_content import DataContent as DataContent from .task_message import TaskMessage as TaskMessage from .text_content import TextContent as TextContent from .message_style import MessageStyle as MessageStyle from .message_author import MessageAuthor as MessageAuthor from .agent_rpc_params import AgentRpcParams as AgentRpcParams -from .agent_rpc_result import AgentRpcResult as AgentRpcResult from .span_list_params import SpanListParams as SpanListParams +from .streaming_status import StreamingStatus as StreamingStatus from .agent_list_params import AgentListParams as AgentListParams from .event_list_params import EventListParams as EventListParams from .state_list_params import StateListParams as StateListParams -from .agent_rpc_response import AgentRpcResponse as AgentRpcResponse from .agent_task_tracker import AgentTaskTracker as AgentTaskTracker from .data_content_param import DataContentParam as DataContentParam from .span_create_params import SpanCreateParams as SpanCreateParams from .span_list_response import SpanListResponse as SpanListResponse from .span_update_params import SpanUpdateParams as SpanUpdateParams from .task_list_response import TaskListResponse as TaskListResponse -from .task_message_delta import TaskMessageDelta as TaskMessageDelta from .text_content_param import TextContentParam as TextContentParam -from .tool_request_delta import ToolRequestDelta as ToolRequestDelta from .agent_list_response import AgentListResponse as AgentListResponse from .event_list_response import EventListResponse as EventListResponse from .message_list_params import MessageListParams as MessageListParams from .state_create_params import StateCreateParams as StateCreateParams from .state_list_response import StateListResponse as StateListResponse from .state_update_params import StateUpdateParams as StateUpdateParams -from .tool_response_delta import ToolResponseDelta as ToolResponseDelta from .tracker_list_params import TrackerListParams as TrackerListParams -from .task_message_content import TaskMessageContent as TaskMessageContent from .tool_request_content import ToolRequestContent as ToolRequestContent from .message_create_params import MessageCreateParams as MessageCreateParams from .message_list_response import MessageListResponse as MessageListResponse @@ -49,6 +41,5 @@ from .tracker_list_response import TrackerListResponse as TrackerListResponse from .tracker_update_params import TrackerUpdateParams as TrackerUpdateParams from .agent_rpc_by_name_params import AgentRpcByNameParams as AgentRpcByNameParams -from .task_message_content_param import TaskMessageContentParam as TaskMessageContentParam from .tool_request_content_param import ToolRequestContentParam as ToolRequestContentParam from .tool_response_content_param import ToolResponseContentParam as ToolResponseContentParam diff --git a/src/agentex/types/agent_rpc_by_name_params.py b/src/agentex/types/agent_rpc_by_name_params.py index 5be189d7..5014a076 100644 --- a/src/agentex/types/agent_rpc_by_name_params.py +++ b/src/agentex/types/agent_rpc_by_name_params.py @@ -2,20 +2,84 @@ from __future__ import annotations -from typing import Union -from typing_extensions import Literal, Required, TypedDict +from typing import Dict, Union, Optional +from typing_extensions import Literal, Required, TypeAlias, TypedDict -from .agent_rpc_params import AgentRpcParams +from .data_content_param import DataContentParam +from .text_content_param import TextContentParam +from .tool_request_content_param import ToolRequestContentParam +from .tool_response_content_param import ToolResponseContentParam -__all__ = ["AgentRpcByNameParams"] +__all__ = [ + "AgentRpcByNameParams", + "Params", + "ParamsCreateTaskRequest", + "ParamsCancelTaskRequest", + "ParamsSendMessageRequest", + "ParamsSendMessageRequestContent", + "ParamsSendEventRequest", + "ParamsSendEventRequestContent", +] class AgentRpcByNameParams(TypedDict, total=False): method: Required[Literal["event/send", "task/create", "message/send", "task/cancel"]] - params: Required[AgentRpcParams] - """The parameters for the agent RPC request""" + params: Required[Params] id: Union[int, str, None] jsonrpc: Literal["2.0"] + + +class ParamsCreateTaskRequest(TypedDict, total=False): + name: Optional[str] + """The name of the task to create""" + + params: Optional[Dict[str, object]] + """The parameters for the task""" + + +class ParamsCancelTaskRequest(TypedDict, total=False): + task_id: Optional[str] + """The ID of the task to cancel. Either this or task_name must be provided.""" + + task_name: Optional[str] + """The name of the task to cancel. Either this or task_id must be provided.""" + + +ParamsSendMessageRequestContent: TypeAlias = Union[ + TextContentParam, DataContentParam, ToolRequestContentParam, ToolResponseContentParam +] + + +class ParamsSendMessageRequest(TypedDict, total=False): + content: Required[ParamsSendMessageRequestContent] + """The message that was sent to the agent""" + + stream: bool + """Whether to stream the response message back to the client""" + + task_id: Optional[str] + """The ID of the task that the message was sent to""" + + +ParamsSendEventRequestContent: TypeAlias = Union[ + TextContentParam, DataContentParam, ToolRequestContentParam, ToolResponseContentParam +] + + +class ParamsSendEventRequest(TypedDict, total=False): + content: Optional[ParamsSendEventRequestContent] + """The content to send to the event""" + + task_id: Optional[str] + """The ID of the task that the event was sent to""" + + task_name: Optional[str] + """The name of the task that the event was sent to""" + + +Params: TypeAlias = Union[ + ParamsCreateTaskRequest, ParamsCancelTaskRequest, ParamsSendMessageRequest, ParamsSendEventRequest +] diff --git a/src/agentex/types/agent_rpc_params.py b/src/agentex/types/agent_rpc_params.py index 5082b18c..2c79a7a9 100644 --- a/src/agentex/types/agent_rpc_params.py +++ b/src/agentex/types/agent_rpc_params.py @@ -3,14 +3,36 @@ from __future__ import annotations from typing import Dict, Union, Optional -from typing_extensions import Required, TypeAlias, TypedDict +from typing_extensions import Literal, Required, TypeAlias, TypedDict -from .task_message_content_param import TaskMessageContentParam +from .data_content_param import DataContentParam +from .text_content_param import TextContentParam +from .tool_request_content_param import ToolRequestContentParam +from .tool_response_content_param import ToolResponseContentParam -__all__ = ["AgentRpcParams", "CreateTaskRequest", "CancelTaskRequest", "SendMessageRequest", "SendEventRequest"] +__all__ = [ + "AgentRpcParams", + "Params", + "ParamsCreateTaskRequest", + "ParamsCancelTaskRequest", + "ParamsSendMessageRequest", + "ParamsSendMessageRequestContent", + "ParamsSendEventRequest", + "ParamsSendEventRequestContent", +] -class CreateTaskRequest(TypedDict, total=False): +class AgentRpcParams(TypedDict, total=False): + method: Required[Literal["event/send", "task/create", "message/send", "task/cancel"]] + + params: Required[Params] + + id: Union[int, str, None] + + jsonrpc: Literal["2.0"] + + +class ParamsCreateTaskRequest(TypedDict, total=False): name: Optional[str] """The name of the task to create""" @@ -18,7 +40,7 @@ class CreateTaskRequest(TypedDict, total=False): """The parameters for the task""" -class CancelTaskRequest(TypedDict, total=False): +class ParamsCancelTaskRequest(TypedDict, total=False): task_id: Optional[str] """The ID of the task to cancel. Either this or task_name must be provided.""" @@ -26,8 +48,13 @@ class CancelTaskRequest(TypedDict, total=False): """The name of the task to cancel. Either this or task_id must be provided.""" -class SendMessageRequest(TypedDict, total=False): - content: Required[TaskMessageContentParam] +ParamsSendMessageRequestContent: TypeAlias = Union[ + TextContentParam, DataContentParam, ToolRequestContentParam, ToolResponseContentParam +] + + +class ParamsSendMessageRequest(TypedDict, total=False): + content: Required[ParamsSendMessageRequestContent] """The message that was sent to the agent""" stream: bool @@ -37,8 +64,13 @@ class SendMessageRequest(TypedDict, total=False): """The ID of the task that the message was sent to""" -class SendEventRequest(TypedDict, total=False): - content: Optional[TaskMessageContentParam] +ParamsSendEventRequestContent: TypeAlias = Union[ + TextContentParam, DataContentParam, ToolRequestContentParam, ToolResponseContentParam +] + + +class ParamsSendEventRequest(TypedDict, total=False): + content: Optional[ParamsSendEventRequestContent] """The content to send to the event""" task_id: Optional[str] @@ -48,4 +80,6 @@ class SendEventRequest(TypedDict, total=False): """The name of the task that the event was sent to""" -AgentRpcParams: TypeAlias = Union[CreateTaskRequest, CancelTaskRequest, SendMessageRequest, SendEventRequest] +Params: TypeAlias = Union[ + ParamsCreateTaskRequest, ParamsCancelTaskRequest, ParamsSendMessageRequest, ParamsSendEventRequest +] diff --git a/src/agentex/types/agent_rpc_params1.py b/src/agentex/types/agent_rpc_params1.py deleted file mode 100644 index 3eae8b68..00000000 --- a/src/agentex/types/agent_rpc_params1.py +++ /dev/null @@ -1,21 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing import Union -from typing_extensions import Literal, Required, TypedDict - -from . import agent_rpc_params - -__all__ = ["AgentRpcParams"] - - -class AgentRpcParams(TypedDict, total=False): - method: Required[Literal["event/send", "task/create", "message/send", "task/cancel"]] - - params: Required[agent_rpc_params.AgentRpcParams] - """The parameters for the agent RPC request""" - - id: Union[int, str, None] - - jsonrpc: Literal["2.0"] diff --git a/src/agentex/types/agent_rpc_response.py b/src/agentex/types/agent_rpc_response.py deleted file mode 100644 index e9995e80..00000000 --- a/src/agentex/types/agent_rpc_response.py +++ /dev/null @@ -1,20 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Union, Optional -from typing_extensions import Literal - -from .._models import BaseModel -from .agent_rpc_result import AgentRpcResult - -__all__ = ["AgentRpcResponse"] - - -class AgentRpcResponse(BaseModel): - result: Optional[AgentRpcResult] = None - """The result of the agent RPC request""" - - id: Union[int, str, None] = None - - error: Optional[object] = None - - jsonrpc: Optional[Literal["2.0"]] = None diff --git a/src/agentex/types/agent_rpc_result.py b/src/agentex/types/agent_rpc_result.py deleted file mode 100644 index 63e30a5d..00000000 --- a/src/agentex/types/agent_rpc_result.py +++ /dev/null @@ -1,90 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List, Union, Optional -from typing_extensions import Literal, TypeAlias - -from .task import Task -from .event import Event -from .._models import BaseModel -from .task_message import TaskMessage -from .task_message_delta import TaskMessageDelta -from .task_message_content import TaskMessageContent - -__all__ = [ - "AgentRpcResult", - "StreamTaskMessageStart", - "StreamTaskMessageDelta", - "StreamTaskMessageFull", - "StreamTaskMessageDone", -] - - -class StreamTaskMessageStart(BaseModel): - content: TaskMessageContent - - index: Optional[int] = None - - parent_task_message: Optional[TaskMessage] = None - """Represents a message in the agent system. - - This entity is used to store messages in MongoDB, with each message associated - with a specific task. - """ - - type: Optional[Literal["start"]] = None - - -class StreamTaskMessageDelta(BaseModel): - delta: Optional[TaskMessageDelta] = None - """Delta for text updates""" - - index: Optional[int] = None - - parent_task_message: Optional[TaskMessage] = None - """Represents a message in the agent system. - - This entity is used to store messages in MongoDB, with each message associated - with a specific task. - """ - - type: Optional[Literal["delta"]] = None - - -class StreamTaskMessageFull(BaseModel): - content: TaskMessageContent - - index: Optional[int] = None - - parent_task_message: Optional[TaskMessage] = None - """Represents a message in the agent system. - - This entity is used to store messages in MongoDB, with each message associated - with a specific task. - """ - - type: Optional[Literal["full"]] = None - - -class StreamTaskMessageDone(BaseModel): - index: Optional[int] = None - - parent_task_message: Optional[TaskMessage] = None - """Represents a message in the agent system. - - This entity is used to store messages in MongoDB, with each message associated - with a specific task. - """ - - type: Optional[Literal["done"]] = None - - -AgentRpcResult: TypeAlias = Union[ - List[TaskMessage], - StreamTaskMessageStart, - StreamTaskMessageDelta, - StreamTaskMessageFull, - StreamTaskMessageDone, - Task, - Event, - None, -] diff --git a/src/agentex/types/data_delta.py b/src/agentex/types/data_delta.py deleted file mode 100644 index e30c12e7..00000000 --- a/src/agentex/types/data_delta.py +++ /dev/null @@ -1,14 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Optional -from typing_extensions import Literal - -from .._models import BaseModel - -__all__ = ["DataDelta"] - - -class DataDelta(BaseModel): - data_delta: Optional[str] = None - - type: Optional[Literal["data"]] = None diff --git a/src/agentex/types/event.py b/src/agentex/types/event.py index 9a544cb6..3f1e5997 100644 --- a/src/agentex/types/event.py +++ b/src/agentex/types/event.py @@ -1,12 +1,21 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import Optional +from typing import Union, Optional from datetime import datetime +from typing_extensions import Annotated, TypeAlias +from .._utils import PropertyInfo from .._models import BaseModel -from .task_message_content import TaskMessageContent +from .data_content import DataContent +from .text_content import TextContent +from .tool_request_content import ToolRequestContent +from .tool_response_content import ToolResponseContent -__all__ = ["Event"] +__all__ = ["Event", "Content"] + +Content: TypeAlias = Annotated[ + Union[TextContent, DataContent, ToolRequestContent, ToolResponseContent, None], PropertyInfo(discriminator="type") +] class Event(BaseModel): @@ -22,7 +31,7 @@ class Event(BaseModel): task_id: str """The UUID of the task that the event belongs to""" - content: Optional[TaskMessageContent] = None + content: Optional[Content] = None """The content of the event""" created_at: Optional[datetime] = None diff --git a/src/agentex/types/message_create_params.py b/src/agentex/types/message_create_params.py index 787715ec..06ec3727 100644 --- a/src/agentex/types/message_create_params.py +++ b/src/agentex/types/message_create_params.py @@ -2,17 +2,24 @@ from __future__ import annotations -from typing import Optional -from typing_extensions import Literal, Required, TypedDict +from typing import Union, Optional +from typing_extensions import Required, TypeAlias, TypedDict -from .task_message_content_param import TaskMessageContentParam +from .streaming_status import StreamingStatus +from .data_content_param import DataContentParam +from .text_content_param import TextContentParam +from .tool_request_content_param import ToolRequestContentParam +from .tool_response_content_param import ToolResponseContentParam -__all__ = ["MessageCreateParams"] +__all__ = ["MessageCreateParams", "Content"] class MessageCreateParams(TypedDict, total=False): - content: Required[TaskMessageContentParam] + content: Required[Content] task_id: Required[str] - streaming_status: Optional[Literal["IN_PROGRESS", "DONE"]] + streaming_status: Optional[StreamingStatus] + + +Content: TypeAlias = Union[TextContentParam, DataContentParam, ToolRequestContentParam, ToolResponseContentParam] diff --git a/src/agentex/types/message_update_params.py b/src/agentex/types/message_update_params.py index ea3dbaf8..bc5305b8 100644 --- a/src/agentex/types/message_update_params.py +++ b/src/agentex/types/message_update_params.py @@ -2,17 +2,24 @@ from __future__ import annotations -from typing import Optional -from typing_extensions import Literal, Required, TypedDict +from typing import Union, Optional +from typing_extensions import Required, TypeAlias, TypedDict -from .task_message_content_param import TaskMessageContentParam +from .streaming_status import StreamingStatus +from .data_content_param import DataContentParam +from .text_content_param import TextContentParam +from .tool_request_content_param import ToolRequestContentParam +from .tool_response_content_param import ToolResponseContentParam -__all__ = ["MessageUpdateParams"] +__all__ = ["MessageUpdateParams", "Content"] class MessageUpdateParams(TypedDict, total=False): - content: Required[TaskMessageContentParam] + content: Required[Content] task_id: Required[str] - streaming_status: Optional[Literal["IN_PROGRESS", "DONE"]] + streaming_status: Optional[StreamingStatus] + + +Content: TypeAlias = Union[TextContentParam, DataContentParam, ToolRequestContentParam, ToolResponseContentParam] diff --git a/src/agentex/types/messages/batch_create_params.py b/src/agentex/types/messages/batch_create_params.py index 0a0153ae..c09c69a9 100644 --- a/src/agentex/types/messages/batch_create_params.py +++ b/src/agentex/types/messages/batch_create_params.py @@ -2,15 +2,21 @@ from __future__ import annotations -from typing import Iterable -from typing_extensions import Required, TypedDict +from typing import Union, Iterable +from typing_extensions import Required, TypeAlias, TypedDict -from ..task_message_content_param import TaskMessageContentParam +from ..data_content_param import DataContentParam +from ..text_content_param import TextContentParam +from ..tool_request_content_param import ToolRequestContentParam +from ..tool_response_content_param import ToolResponseContentParam -__all__ = ["BatchCreateParams"] +__all__ = ["BatchCreateParams", "Content"] class BatchCreateParams(TypedDict, total=False): - contents: Required[Iterable[TaskMessageContentParam]] + contents: Required[Iterable[Content]] task_id: Required[str] + + +Content: TypeAlias = Union[TextContentParam, DataContentParam, ToolRequestContentParam, ToolResponseContentParam] diff --git a/src/agentex/types/messages/batch_update_params.py b/src/agentex/types/messages/batch_update_params.py index c25e46f6..68f24f8d 100644 --- a/src/agentex/types/messages/batch_update_params.py +++ b/src/agentex/types/messages/batch_update_params.py @@ -2,15 +2,21 @@ from __future__ import annotations -from typing import Dict -from typing_extensions import Required, TypedDict +from typing import Dict, Union +from typing_extensions import Required, TypeAlias, TypedDict -from ..task_message_content_param import TaskMessageContentParam +from ..data_content_param import DataContentParam +from ..text_content_param import TextContentParam +from ..tool_request_content_param import ToolRequestContentParam +from ..tool_response_content_param import ToolResponseContentParam -__all__ = ["BatchUpdateParams"] +__all__ = ["BatchUpdateParams", "Updates"] class BatchUpdateParams(TypedDict, total=False): task_id: Required[str] - updates: Required[Dict[str, TaskMessageContentParam]] + updates: Required[Dict[str, Updates]] + + +Updates: TypeAlias = Union[TextContentParam, DataContentParam, ToolRequestContentParam, ToolResponseContentParam] diff --git a/src/agentex/types/shared/__init__.py b/src/agentex/types/shared/__init__.py deleted file mode 100644 index 7b5a4954..00000000 --- a/src/agentex/types/shared/__init__.py +++ /dev/null @@ -1,3 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from .task_message_update import TaskMessageUpdate as TaskMessageUpdate diff --git a/src/agentex/types/shared/task_message_update.py b/src/agentex/types/shared/task_message_update.py deleted file mode 100644 index cc01b598..00000000 --- a/src/agentex/types/shared/task_message_update.py +++ /dev/null @@ -1,83 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Union, Optional -from typing_extensions import Literal, Annotated, TypeAlias - -from ..._utils import PropertyInfo -from ..._models import BaseModel -from ..task_message import TaskMessage -from ..task_message_delta import TaskMessageDelta -from ..task_message_content import TaskMessageContent - -__all__ = [ - "TaskMessageUpdate", - "StreamTaskMessageStart", - "StreamTaskMessageDelta", - "StreamTaskMessageFull", - "StreamTaskMessageDone", -] - - -class StreamTaskMessageStart(BaseModel): - content: TaskMessageContent - - index: Optional[int] = None - - parent_task_message: Optional[TaskMessage] = None - """Represents a message in the agent system. - - This entity is used to store messages in MongoDB, with each message associated - with a specific task. - """ - - type: Optional[Literal["start"]] = None - - -class StreamTaskMessageDelta(BaseModel): - delta: Optional[TaskMessageDelta] = None - """Delta for text updates""" - - index: Optional[int] = None - - parent_task_message: Optional[TaskMessage] = None - """Represents a message in the agent system. - - This entity is used to store messages in MongoDB, with each message associated - with a specific task. - """ - - type: Optional[Literal["delta"]] = None - - -class StreamTaskMessageFull(BaseModel): - content: TaskMessageContent - - index: Optional[int] = None - - parent_task_message: Optional[TaskMessage] = None - """Represents a message in the agent system. - - This entity is used to store messages in MongoDB, with each message associated - with a specific task. - """ - - type: Optional[Literal["full"]] = None - - -class StreamTaskMessageDone(BaseModel): - index: Optional[int] = None - - parent_task_message: Optional[TaskMessage] = None - """Represents a message in the agent system. - - This entity is used to store messages in MongoDB, with each message associated - with a specific task. - """ - - type: Optional[Literal["done"]] = None - - -TaskMessageUpdate: TypeAlias = Annotated[ - Union[StreamTaskMessageStart, StreamTaskMessageDelta, StreamTaskMessageFull, StreamTaskMessageDone], - PropertyInfo(discriminator="type"), -] diff --git a/src/agentex/types/streaming_status.py b/src/agentex/types/streaming_status.py new file mode 100644 index 00000000..196d7881 --- /dev/null +++ b/src/agentex/types/streaming_status.py @@ -0,0 +1,7 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing_extensions import Literal, TypeAlias + +__all__ = ["StreamingStatus"] + +StreamingStatus: TypeAlias = Literal["IN_PROGRESS", "DONE"] diff --git a/src/agentex/types/task_message.py b/src/agentex/types/task_message.py index b5938cc8..686ade7d 100644 --- a/src/agentex/types/task_message.py +++ b/src/agentex/types/task_message.py @@ -1,33 +1,36 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import Optional +from typing import Union, Optional from datetime import datetime -from typing_extensions import Literal +from typing_extensions import Annotated, TypeAlias +from .._utils import PropertyInfo from .._models import BaseModel -from .task_message_content import TaskMessageContent +from .data_content import DataContent +from .text_content import TextContent +from .streaming_status import StreamingStatus +from .tool_request_content import ToolRequestContent +from .tool_response_content import ToolResponseContent -__all__ = ["TaskMessage"] +__all__ = ["TaskMessage", "Content"] +Content: TypeAlias = Annotated[ + Union[TextContent, DataContent, ToolRequestContent, ToolResponseContent], PropertyInfo(discriminator="type") +] -class TaskMessage(BaseModel): - content: TaskMessageContent - """The content of the message. - - This content is not OpenAI compatible. These are messages that are meant to be - displayed to the user. - """ - - task_id: str - """ID of the task this message belongs to""" - id: Optional[str] = None +class TaskMessage(BaseModel): + id: str """The task message's unique id""" - created_at: Optional[datetime] = None + content: Content + + created_at: datetime """The timestamp when the message was created""" - streaming_status: Optional[Literal["IN_PROGRESS", "DONE"]] = None + task_id: str + + streaming_status: Optional[StreamingStatus] = None updated_at: Optional[datetime] = None """The timestamp when the message was last updated""" diff --git a/src/agentex/types/task_message_content.py b/src/agentex/types/task_message_content.py deleted file mode 100644 index 126992b4..00000000 --- a/src/agentex/types/task_message_content.py +++ /dev/null @@ -1,16 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Union -from typing_extensions import Annotated, TypeAlias - -from .._utils import PropertyInfo -from .data_content import DataContent -from .text_content import TextContent -from .tool_request_content import ToolRequestContent -from .tool_response_content import ToolResponseContent - -__all__ = ["TaskMessageContent"] - -TaskMessageContent: TypeAlias = Annotated[ - Union[TextContent, DataContent, ToolRequestContent, ToolResponseContent], PropertyInfo(discriminator="type") -] diff --git a/src/agentex/types/task_message_content_param.py b/src/agentex/types/task_message_content_param.py deleted file mode 100644 index 6991c64e..00000000 --- a/src/agentex/types/task_message_content_param.py +++ /dev/null @@ -1,17 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing import Union -from typing_extensions import TypeAlias - -from .data_content_param import DataContentParam -from .text_content_param import TextContentParam -from .tool_request_content_param import ToolRequestContentParam -from .tool_response_content_param import ToolResponseContentParam - -__all__ = ["TaskMessageContentParam"] - -TaskMessageContentParam: TypeAlias = Union[ - TextContentParam, DataContentParam, ToolRequestContentParam, ToolResponseContentParam -] diff --git a/src/agentex/types/task_message_delta.py b/src/agentex/types/task_message_delta.py deleted file mode 100644 index 5a477e5a..00000000 --- a/src/agentex/types/task_message_delta.py +++ /dev/null @@ -1,16 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Union -from typing_extensions import Annotated, TypeAlias - -from .._utils import PropertyInfo -from .data_delta import DataDelta -from .text_delta import TextDelta -from .tool_request_delta import ToolRequestDelta -from .tool_response_delta import ToolResponseDelta - -__all__ = ["TaskMessageDelta"] - -TaskMessageDelta: TypeAlias = Annotated[ - Union[TextDelta, DataDelta, ToolRequestDelta, ToolResponseDelta], PropertyInfo(discriminator="type") -] diff --git a/src/agentex/types/text_delta.py b/src/agentex/types/text_delta.py deleted file mode 100644 index 29a60cfd..00000000 --- a/src/agentex/types/text_delta.py +++ /dev/null @@ -1,14 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Optional -from typing_extensions import Literal - -from .._models import BaseModel - -__all__ = ["TextDelta"] - - -class TextDelta(BaseModel): - text_delta: Optional[str] = None - - type: Optional[Literal["text"]] = None diff --git a/src/agentex/types/tool_request_delta.py b/src/agentex/types/tool_request_delta.py deleted file mode 100644 index 7877dfdd..00000000 --- a/src/agentex/types/tool_request_delta.py +++ /dev/null @@ -1,18 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Optional -from typing_extensions import Literal - -from .._models import BaseModel - -__all__ = ["ToolRequestDelta"] - - -class ToolRequestDelta(BaseModel): - name: str - - tool_call_id: str - - arguments_delta: Optional[str] = None - - type: Optional[Literal["tool_request"]] = None diff --git a/src/agentex/types/tool_response_delta.py b/src/agentex/types/tool_response_delta.py deleted file mode 100644 index 383770db..00000000 --- a/src/agentex/types/tool_response_delta.py +++ /dev/null @@ -1,18 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Optional -from typing_extensions import Literal - -from .._models import BaseModel - -__all__ = ["ToolResponseDelta"] - - -class ToolResponseDelta(BaseModel): - name: str - - tool_call_id: str - - content_delta: Optional[str] = None - - type: Optional[Literal["tool_response"]] = None diff --git a/tests/api_resources/test_agents.py b/tests/api_resources/test_agents.py index 7cb79375..b2819f31 100644 --- a/tests/api_resources/test_agents.py +++ b/tests/api_resources/test_agents.py @@ -9,11 +9,7 @@ from agentex import Agentex, AsyncAgentex from tests.utils import assert_matches_type -from agentex.types import ( - Agent, - AgentRpcResponse, - AgentListResponse, -) +from agentex.types import Agent, AgentListResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -233,7 +229,7 @@ def test_method_rpc(self, client: Agentex) -> None: method="event/send", params={}, ) - assert_matches_type(AgentRpcResponse, agent, path=["response"]) + assert_matches_type(object, agent, path=["response"]) @pytest.mark.skip() @parametrize @@ -248,7 +244,7 @@ def test_method_rpc_with_all_params(self, client: Agentex) -> None: id=0, jsonrpc="2.0", ) - assert_matches_type(AgentRpcResponse, agent, path=["response"]) + assert_matches_type(object, agent, path=["response"]) @pytest.mark.skip() @parametrize @@ -262,7 +258,7 @@ def test_raw_response_rpc(self, client: Agentex) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" agent = response.parse() - assert_matches_type(AgentRpcResponse, agent, path=["response"]) + assert_matches_type(object, agent, path=["response"]) @pytest.mark.skip() @parametrize @@ -276,7 +272,7 @@ def test_streaming_response_rpc(self, client: Agentex) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" agent = response.parse() - assert_matches_type(AgentRpcResponse, agent, path=["response"]) + assert_matches_type(object, agent, path=["response"]) assert cast(Any, response.is_closed) is True @@ -298,7 +294,7 @@ def test_method_rpc_by_name(self, client: Agentex) -> None: method="event/send", params={}, ) - assert_matches_type(AgentRpcResponse, agent, path=["response"]) + assert_matches_type(object, agent, path=["response"]) @pytest.mark.skip() @parametrize @@ -313,7 +309,7 @@ def test_method_rpc_by_name_with_all_params(self, client: Agentex) -> None: id=0, jsonrpc="2.0", ) - assert_matches_type(AgentRpcResponse, agent, path=["response"]) + assert_matches_type(object, agent, path=["response"]) @pytest.mark.skip() @parametrize @@ -327,7 +323,7 @@ def test_raw_response_rpc_by_name(self, client: Agentex) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" agent = response.parse() - assert_matches_type(AgentRpcResponse, agent, path=["response"]) + assert_matches_type(object, agent, path=["response"]) @pytest.mark.skip() @parametrize @@ -341,7 +337,7 @@ def test_streaming_response_rpc_by_name(self, client: Agentex) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" agent = response.parse() - assert_matches_type(AgentRpcResponse, agent, path=["response"]) + assert_matches_type(object, agent, path=["response"]) assert cast(Any, response.is_closed) is True @@ -573,7 +569,7 @@ async def test_method_rpc(self, async_client: AsyncAgentex) -> None: method="event/send", params={}, ) - assert_matches_type(AgentRpcResponse, agent, path=["response"]) + assert_matches_type(object, agent, path=["response"]) @pytest.mark.skip() @parametrize @@ -588,7 +584,7 @@ async def test_method_rpc_with_all_params(self, async_client: AsyncAgentex) -> N id=0, jsonrpc="2.0", ) - assert_matches_type(AgentRpcResponse, agent, path=["response"]) + assert_matches_type(object, agent, path=["response"]) @pytest.mark.skip() @parametrize @@ -602,7 +598,7 @@ async def test_raw_response_rpc(self, async_client: AsyncAgentex) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" agent = await response.parse() - assert_matches_type(AgentRpcResponse, agent, path=["response"]) + assert_matches_type(object, agent, path=["response"]) @pytest.mark.skip() @parametrize @@ -616,7 +612,7 @@ async def test_streaming_response_rpc(self, async_client: AsyncAgentex) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" agent = await response.parse() - assert_matches_type(AgentRpcResponse, agent, path=["response"]) + assert_matches_type(object, agent, path=["response"]) assert cast(Any, response.is_closed) is True @@ -638,7 +634,7 @@ async def test_method_rpc_by_name(self, async_client: AsyncAgentex) -> None: method="event/send", params={}, ) - assert_matches_type(AgentRpcResponse, agent, path=["response"]) + assert_matches_type(object, agent, path=["response"]) @pytest.mark.skip() @parametrize @@ -653,7 +649,7 @@ async def test_method_rpc_by_name_with_all_params(self, async_client: AsyncAgent id=0, jsonrpc="2.0", ) - assert_matches_type(AgentRpcResponse, agent, path=["response"]) + assert_matches_type(object, agent, path=["response"]) @pytest.mark.skip() @parametrize @@ -667,7 +663,7 @@ async def test_raw_response_rpc_by_name(self, async_client: AsyncAgentex) -> Non assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" agent = await response.parse() - assert_matches_type(AgentRpcResponse, agent, path=["response"]) + assert_matches_type(object, agent, path=["response"]) @pytest.mark.skip() @parametrize @@ -681,7 +677,7 @@ async def test_streaming_response_rpc_by_name(self, async_client: AsyncAgentex) assert response.http_request.headers.get("X-Stainless-Lang") == "python" agent = await response.parse() - assert_matches_type(AgentRpcResponse, agent, path=["response"]) + assert_matches_type(object, agent, path=["response"]) assert cast(Any, response.is_closed) is True From af18034e4173794ebf42eff688f26d64caca4e64 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 23 Jul 2025 18:24:12 +0000 Subject: [PATCH 2/4] feat(api): api update --- .stats.yml | 4 +- api.md | 34 +++++-- src/agentex/resources/agents.py | 36 +++++--- src/agentex/resources/messages/batch.py | 9 +- src/agentex/resources/messages/messages.py | 21 ++--- src/agentex/resources/tasks.py | 18 ++-- src/agentex/types/__init__.py | 13 ++- src/agentex/types/agent_rpc_by_name_params.py | 76 ++-------------- src/agentex/types/agent_rpc_params.py | 54 +++-------- src/agentex/types/agent_rpc_params1.py | 21 +++++ src/agentex/types/agent_rpc_response.py | 20 +++++ src/agentex/types/agent_rpc_result.py | 90 +++++++++++++++++++ src/agentex/types/data_delta.py | 14 +++ src/agentex/types/event.py | 17 +--- src/agentex/types/message_create_params.py | 19 ++-- src/agentex/types/message_update_params.py | 19 ++-- .../types/messages/batch_create_params.py | 16 ++-- .../types/messages/batch_update_params.py | 16 ++-- src/agentex/types/shared/__init__.py | 3 + .../types/shared/task_message_update.py | 83 +++++++++++++++++ src/agentex/types/streaming_status.py | 7 -- .../types/task_delete_by_name_response.py | 8 ++ src/agentex/types/task_delete_response.py | 8 ++ src/agentex/types/task_message.py | 37 ++++---- src/agentex/types/task_message_content.py | 16 ++++ .../types/task_message_content_param.py | 17 ++++ src/agentex/types/task_message_delta.py | 16 ++++ src/agentex/types/text_delta.py | 14 +++ src/agentex/types/tool_request_delta.py | 18 ++++ src/agentex/types/tool_response_delta.py | 18 ++++ tests/api_resources/test_agents.py | 38 ++++---- tests/api_resources/test_tasks.py | 26 +++--- 32 files changed, 529 insertions(+), 277 deletions(-) create mode 100644 src/agentex/types/agent_rpc_params1.py create mode 100644 src/agentex/types/agent_rpc_response.py create mode 100644 src/agentex/types/agent_rpc_result.py create mode 100644 src/agentex/types/data_delta.py create mode 100644 src/agentex/types/shared/__init__.py create mode 100644 src/agentex/types/shared/task_message_update.py delete mode 100644 src/agentex/types/streaming_status.py create mode 100644 src/agentex/types/task_delete_by_name_response.py create mode 100644 src/agentex/types/task_delete_response.py create mode 100644 src/agentex/types/task_message_content.py create mode 100644 src/agentex/types/task_message_content_param.py create mode 100644 src/agentex/types/task_message_delta.py create mode 100644 src/agentex/types/text_delta.py create mode 100644 src/agentex/types/tool_request_delta.py create mode 100644 src/agentex/types/tool_response_delta.py diff --git a/.stats.yml b/.stats.yml index 9ea4b275..a8d58116 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 34 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/sgp%2Fagentex-sdk-021b55c88964b7a5bfc9d692d32a52c6b0150445656d2407c4cb8e9dd1e5f100.yml -openapi_spec_hash: ed92c0d5d6bed9cb5617f8a776ac42c9 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/sgp%2Fagentex-sdk-62a09183a027c64707ad1b9d7a5ccc66c8abf3965e6075282cb5ab72f742a2b3.yml +openapi_spec_hash: 47f43703822077a82e2edf82d4b7e0e5 config_hash: 2e4b423af3db79ebd8170c401ea9093a diff --git a/api.md b/api.md index 8c2841ca..223b095e 100644 --- a/api.md +++ b/api.md @@ -1,9 +1,30 @@ +# Shared Types + +```python +from agentex.types import TaskMessageUpdate +``` + # Agents Types: ```python -from agentex.types import AcpType, Agent, AgentRpcRequest, AgentListResponse +from agentex.types import ( + AcpType, + Agent, + AgentRpcParams, + AgentRpcRequest, + AgentRpcResponse, + AgentRpcResult, + DataDelta, + TaskMessageContent, + TaskMessageDelta, + TaskMessageUpdate, + TextDelta, + ToolRequestDelta, + ToolResponseDelta, + AgentListResponse, +) ``` Methods: @@ -13,23 +34,23 @@ Methods: - client.agents.delete(agent_id) -> Agent - client.agents.delete_by_name(agent_name) -> Agent - client.agents.retrieve_by_name(agent_name) -> Agent -- client.agents.rpc(agent_id, \*\*params) -> object -- client.agents.rpc_by_name(agent_name, \*\*params) -> object +- client.agents.rpc(agent_id, \*\*params) -> AgentRpcResponse +- client.agents.rpc_by_name(agent_name, \*\*params) -> AgentRpcResponse # Tasks Types: ```python -from agentex.types import Task, TaskListResponse +from agentex.types import Task, TaskListResponse, TaskDeleteResponse, TaskDeleteByNameResponse ``` Methods: - client.tasks.retrieve(task_id) -> Task - client.tasks.list() -> TaskListResponse -- client.tasks.delete(task_id) -> Task -- client.tasks.delete_by_name(task_name) -> Task +- client.tasks.delete(task_id) -> TaskDeleteResponse +- client.tasks.delete_by_name(task_name) -> TaskDeleteByNameResponse - client.tasks.retrieve_by_name(task_name) -> Task - client.tasks.stream_events(task_id) -> object - client.tasks.stream_events_by_name(task_name) -> object @@ -43,7 +64,6 @@ from agentex.types import ( DataContent, MessageAuthor, MessageStyle, - StreamingStatus, TaskMessage, TextContent, ToolRequestContent, diff --git a/src/agentex/resources/agents.py b/src/agentex/resources/agents.py index 9c2e4bd5..8b329be8 100644 --- a/src/agentex/resources/agents.py +++ b/src/agentex/resources/agents.py @@ -7,7 +7,7 @@ import httpx -from ..types import agent_rpc_params, agent_list_params, agent_rpc_by_name_params +from ..types import AgentRpcParams, agent_rpc_params, agent_list_params, agent_rpc_by_name_params from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven from .._utils import maybe_transform, async_maybe_transform from .._compat import cached_property @@ -20,6 +20,8 @@ ) from ..types.agent import Agent from .._base_client import make_request_options +from ..types.agent_rpc_params import AgentRpcParams +from ..types.agent_rpc_response import AgentRpcResponse from ..types.agent_list_response import AgentListResponse __all__ = ["AgentsResource", "AsyncAgentsResource"] @@ -219,7 +221,7 @@ def rpc( agent_id: str, *, method: Literal["event/send", "task/create", "message/send", "task/cancel"], - params: agent_rpc_params.Params, + params: AgentRpcParams, id: Union[int, str, None] | NotGiven = NOT_GIVEN, jsonrpc: Literal["2.0"] | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. @@ -228,11 +230,13 @@ def rpc( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> object: + ) -> AgentRpcResponse: """ Handle JSON-RPC requests for an agent by its unique ID. Args: + params: The parameters for the agent RPC request + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -257,7 +261,7 @@ def rpc( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=object, + cast_to=AgentRpcResponse, ) def rpc_by_name( @@ -265,7 +269,7 @@ def rpc_by_name( agent_name: str, *, method: Literal["event/send", "task/create", "message/send", "task/cancel"], - params: agent_rpc_by_name_params.Params, + params: AgentRpcParams, id: Union[int, str, None] | NotGiven = NOT_GIVEN, jsonrpc: Literal["2.0"] | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. @@ -274,11 +278,13 @@ def rpc_by_name( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> object: + ) -> AgentRpcResponse: """ Handle JSON-RPC requests for an agent by its unique name. Args: + params: The parameters for the agent RPC request + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -303,7 +309,7 @@ def rpc_by_name( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=object, + cast_to=AgentRpcResponse, ) @@ -501,7 +507,7 @@ async def rpc( agent_id: str, *, method: Literal["event/send", "task/create", "message/send", "task/cancel"], - params: agent_rpc_params.Params, + params: AgentRpcParams, id: Union[int, str, None] | NotGiven = NOT_GIVEN, jsonrpc: Literal["2.0"] | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. @@ -510,11 +516,13 @@ async def rpc( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> object: + ) -> AgentRpcResponse: """ Handle JSON-RPC requests for an agent by its unique ID. Args: + params: The parameters for the agent RPC request + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -539,7 +547,7 @@ async def rpc( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=object, + cast_to=AgentRpcResponse, ) async def rpc_by_name( @@ -547,7 +555,7 @@ async def rpc_by_name( agent_name: str, *, method: Literal["event/send", "task/create", "message/send", "task/cancel"], - params: agent_rpc_by_name_params.Params, + params: AgentRpcParams, id: Union[int, str, None] | NotGiven = NOT_GIVEN, jsonrpc: Literal["2.0"] | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. @@ -556,11 +564,13 @@ async def rpc_by_name( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> object: + ) -> AgentRpcResponse: """ Handle JSON-RPC requests for an agent by its unique name. Args: + params: The parameters for the agent RPC request + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -585,7 +595,7 @@ async def rpc_by_name( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=object, + cast_to=AgentRpcResponse, ) diff --git a/src/agentex/resources/messages/batch.py b/src/agentex/resources/messages/batch.py index 478c2df5..58412663 100644 --- a/src/agentex/resources/messages/batch.py +++ b/src/agentex/resources/messages/batch.py @@ -18,6 +18,7 @@ ) from ..._base_client import make_request_options from ...types.messages import batch_create_params, batch_update_params +from ...types.task_message_content_param import TaskMessageContentParam from ...types.messages.batch_create_response import BatchCreateResponse from ...types.messages.batch_update_response import BatchUpdateResponse @@ -47,7 +48,7 @@ def with_streaming_response(self) -> BatchResourceWithStreamingResponse: def create( self, *, - contents: Iterable[batch_create_params.Content], + contents: Iterable[TaskMessageContentParam], task_id: str, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. @@ -87,7 +88,7 @@ def update( self, *, task_id: str, - updates: Dict[str, batch_update_params.Updates], + updates: Dict[str, TaskMessageContentParam], # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -146,7 +147,7 @@ def with_streaming_response(self) -> AsyncBatchResourceWithStreamingResponse: async def create( self, *, - contents: Iterable[batch_create_params.Content], + contents: Iterable[TaskMessageContentParam], task_id: str, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. @@ -186,7 +187,7 @@ async def update( self, *, task_id: str, - updates: Dict[str, batch_update_params.Updates], + updates: Dict[str, TaskMessageContentParam], # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, diff --git a/src/agentex/resources/messages/messages.py b/src/agentex/resources/messages/messages.py index 7745cf76..b7f78c94 100644 --- a/src/agentex/resources/messages/messages.py +++ b/src/agentex/resources/messages/messages.py @@ -3,6 +3,7 @@ from __future__ import annotations from typing import Optional +from typing_extensions import Literal import httpx @@ -14,7 +15,7 @@ BatchResourceWithStreamingResponse, AsyncBatchResourceWithStreamingResponse, ) -from ...types import StreamingStatus, message_list_params, message_create_params, message_update_params +from ...types import message_list_params, message_create_params, message_update_params from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven from ..._utils import maybe_transform, async_maybe_transform from ..._compat import cached_property @@ -27,8 +28,8 @@ ) from ..._base_client import make_request_options from ...types.task_message import TaskMessage -from ...types.streaming_status import StreamingStatus from ...types.message_list_response import MessageListResponse +from ...types.task_message_content_param import TaskMessageContentParam __all__ = ["MessagesResource", "AsyncMessagesResource"] @@ -60,9 +61,9 @@ def with_streaming_response(self) -> MessagesResourceWithStreamingResponse: def create( self, *, - content: message_create_params.Content, + content: TaskMessageContentParam, task_id: str, - streaming_status: Optional[StreamingStatus] | NotGiven = NOT_GIVEN, + streaming_status: Optional[Literal["IN_PROGRESS", "DONE"]] | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -135,9 +136,9 @@ def update( self, message_id: str, *, - content: message_update_params.Content, + content: TaskMessageContentParam, task_id: str, - streaming_status: Optional[StreamingStatus] | NotGiven = NOT_GIVEN, + streaming_status: Optional[Literal["IN_PROGRESS", "DONE"]] | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -245,9 +246,9 @@ def with_streaming_response(self) -> AsyncMessagesResourceWithStreamingResponse: async def create( self, *, - content: message_create_params.Content, + content: TaskMessageContentParam, task_id: str, - streaming_status: Optional[StreamingStatus] | NotGiven = NOT_GIVEN, + streaming_status: Optional[Literal["IN_PROGRESS", "DONE"]] | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -320,9 +321,9 @@ async def update( self, message_id: str, *, - content: message_update_params.Content, + content: TaskMessageContentParam, task_id: str, - streaming_status: Optional[StreamingStatus] | NotGiven = NOT_GIVEN, + streaming_status: Optional[Literal["IN_PROGRESS", "DONE"]] | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, diff --git a/src/agentex/resources/tasks.py b/src/agentex/resources/tasks.py index 936ee66c..6c6ce9d0 100644 --- a/src/agentex/resources/tasks.py +++ b/src/agentex/resources/tasks.py @@ -17,6 +17,8 @@ from ..types.task import Task from .._base_client import make_request_options from ..types.task_list_response import TaskListResponse +from ..types.task_delete_response import TaskDeleteResponse +from ..types.task_delete_by_name_response import TaskDeleteByNameResponse __all__ = ["TasksResource", "AsyncTasksResource"] @@ -103,7 +105,7 @@ def delete( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Task: + ) -> TaskDeleteResponse: """ Delete a task by its unique ID. @@ -123,7 +125,7 @@ def delete( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=Task, + cast_to=TaskDeleteResponse, ) def delete_by_name( @@ -136,7 +138,7 @@ def delete_by_name( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Task: + ) -> TaskDeleteByNameResponse: """ Delete a task by its unique name. @@ -156,7 +158,7 @@ def delete_by_name( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=Task, + cast_to=TaskDeleteByNameResponse, ) def retrieve_by_name( @@ -345,7 +347,7 @@ async def delete( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Task: + ) -> TaskDeleteResponse: """ Delete a task by its unique ID. @@ -365,7 +367,7 @@ async def delete( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=Task, + cast_to=TaskDeleteResponse, ) async def delete_by_name( @@ -378,7 +380,7 @@ async def delete_by_name( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Task: + ) -> TaskDeleteByNameResponse: """ Delete a task by its unique name. @@ -398,7 +400,7 @@ async def delete_by_name( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=Task, + cast_to=TaskDeleteByNameResponse, ) async def retrieve_by_name( diff --git a/src/agentex/types/__init__.py b/src/agentex/types/__init__.py index a5e72143..5623fb8a 100644 --- a/src/agentex/types/__init__.py +++ b/src/agentex/types/__init__.py @@ -7,32 +7,41 @@ from .agent import Agent as Agent from .event import Event as Event from .state import State as State +from .shared import TaskMessageUpdate as TaskMessageUpdate from .acp_type import AcpType as AcpType +from .data_delta import DataDelta as DataDelta +from .text_delta import TextDelta as TextDelta from .data_content import DataContent as DataContent from .task_message import TaskMessage as TaskMessage from .text_content import TextContent as TextContent from .message_style import MessageStyle as MessageStyle from .message_author import MessageAuthor as MessageAuthor from .agent_rpc_params import AgentRpcParams as AgentRpcParams +from .agent_rpc_result import AgentRpcResult as AgentRpcResult from .span_list_params import SpanListParams as SpanListParams -from .streaming_status import StreamingStatus as StreamingStatus from .agent_list_params import AgentListParams as AgentListParams from .event_list_params import EventListParams as EventListParams from .state_list_params import StateListParams as StateListParams +from .agent_rpc_response import AgentRpcResponse as AgentRpcResponse from .agent_task_tracker import AgentTaskTracker as AgentTaskTracker from .data_content_param import DataContentParam as DataContentParam from .span_create_params import SpanCreateParams as SpanCreateParams from .span_list_response import SpanListResponse as SpanListResponse from .span_update_params import SpanUpdateParams as SpanUpdateParams from .task_list_response import TaskListResponse as TaskListResponse +from .task_message_delta import TaskMessageDelta as TaskMessageDelta from .text_content_param import TextContentParam as TextContentParam +from .tool_request_delta import ToolRequestDelta as ToolRequestDelta from .agent_list_response import AgentListResponse as AgentListResponse from .event_list_response import EventListResponse as EventListResponse from .message_list_params import MessageListParams as MessageListParams from .state_create_params import StateCreateParams as StateCreateParams from .state_list_response import StateListResponse as StateListResponse from .state_update_params import StateUpdateParams as StateUpdateParams +from .tool_response_delta import ToolResponseDelta as ToolResponseDelta from .tracker_list_params import TrackerListParams as TrackerListParams +from .task_delete_response import TaskDeleteResponse as TaskDeleteResponse +from .task_message_content import TaskMessageContent as TaskMessageContent from .tool_request_content import ToolRequestContent as ToolRequestContent from .message_create_params import MessageCreateParams as MessageCreateParams from .message_list_response import MessageListResponse as MessageListResponse @@ -41,5 +50,7 @@ from .tracker_list_response import TrackerListResponse as TrackerListResponse from .tracker_update_params import TrackerUpdateParams as TrackerUpdateParams from .agent_rpc_by_name_params import AgentRpcByNameParams as AgentRpcByNameParams +from .task_message_content_param import TaskMessageContentParam as TaskMessageContentParam from .tool_request_content_param import ToolRequestContentParam as ToolRequestContentParam from .tool_response_content_param import ToolResponseContentParam as ToolResponseContentParam +from .task_delete_by_name_response import TaskDeleteByNameResponse as TaskDeleteByNameResponse diff --git a/src/agentex/types/agent_rpc_by_name_params.py b/src/agentex/types/agent_rpc_by_name_params.py index 5014a076..5be189d7 100644 --- a/src/agentex/types/agent_rpc_by_name_params.py +++ b/src/agentex/types/agent_rpc_by_name_params.py @@ -2,84 +2,20 @@ from __future__ import annotations -from typing import Dict, Union, Optional -from typing_extensions import Literal, Required, TypeAlias, TypedDict +from typing import Union +from typing_extensions import Literal, Required, TypedDict -from .data_content_param import DataContentParam -from .text_content_param import TextContentParam -from .tool_request_content_param import ToolRequestContentParam -from .tool_response_content_param import ToolResponseContentParam +from .agent_rpc_params import AgentRpcParams -__all__ = [ - "AgentRpcByNameParams", - "Params", - "ParamsCreateTaskRequest", - "ParamsCancelTaskRequest", - "ParamsSendMessageRequest", - "ParamsSendMessageRequestContent", - "ParamsSendEventRequest", - "ParamsSendEventRequestContent", -] +__all__ = ["AgentRpcByNameParams"] class AgentRpcByNameParams(TypedDict, total=False): method: Required[Literal["event/send", "task/create", "message/send", "task/cancel"]] - params: Required[Params] + params: Required[AgentRpcParams] + """The parameters for the agent RPC request""" id: Union[int, str, None] jsonrpc: Literal["2.0"] - - -class ParamsCreateTaskRequest(TypedDict, total=False): - name: Optional[str] - """The name of the task to create""" - - params: Optional[Dict[str, object]] - """The parameters for the task""" - - -class ParamsCancelTaskRequest(TypedDict, total=False): - task_id: Optional[str] - """The ID of the task to cancel. Either this or task_name must be provided.""" - - task_name: Optional[str] - """The name of the task to cancel. Either this or task_id must be provided.""" - - -ParamsSendMessageRequestContent: TypeAlias = Union[ - TextContentParam, DataContentParam, ToolRequestContentParam, ToolResponseContentParam -] - - -class ParamsSendMessageRequest(TypedDict, total=False): - content: Required[ParamsSendMessageRequestContent] - """The message that was sent to the agent""" - - stream: bool - """Whether to stream the response message back to the client""" - - task_id: Optional[str] - """The ID of the task that the message was sent to""" - - -ParamsSendEventRequestContent: TypeAlias = Union[ - TextContentParam, DataContentParam, ToolRequestContentParam, ToolResponseContentParam -] - - -class ParamsSendEventRequest(TypedDict, total=False): - content: Optional[ParamsSendEventRequestContent] - """The content to send to the event""" - - task_id: Optional[str] - """The ID of the task that the event was sent to""" - - task_name: Optional[str] - """The name of the task that the event was sent to""" - - -Params: TypeAlias = Union[ - ParamsCreateTaskRequest, ParamsCancelTaskRequest, ParamsSendMessageRequest, ParamsSendEventRequest -] diff --git a/src/agentex/types/agent_rpc_params.py b/src/agentex/types/agent_rpc_params.py index 2c79a7a9..5082b18c 100644 --- a/src/agentex/types/agent_rpc_params.py +++ b/src/agentex/types/agent_rpc_params.py @@ -3,36 +3,14 @@ from __future__ import annotations from typing import Dict, Union, Optional -from typing_extensions import Literal, Required, TypeAlias, TypedDict +from typing_extensions import Required, TypeAlias, TypedDict -from .data_content_param import DataContentParam -from .text_content_param import TextContentParam -from .tool_request_content_param import ToolRequestContentParam -from .tool_response_content_param import ToolResponseContentParam +from .task_message_content_param import TaskMessageContentParam -__all__ = [ - "AgentRpcParams", - "Params", - "ParamsCreateTaskRequest", - "ParamsCancelTaskRequest", - "ParamsSendMessageRequest", - "ParamsSendMessageRequestContent", - "ParamsSendEventRequest", - "ParamsSendEventRequestContent", -] +__all__ = ["AgentRpcParams", "CreateTaskRequest", "CancelTaskRequest", "SendMessageRequest", "SendEventRequest"] -class AgentRpcParams(TypedDict, total=False): - method: Required[Literal["event/send", "task/create", "message/send", "task/cancel"]] - - params: Required[Params] - - id: Union[int, str, None] - - jsonrpc: Literal["2.0"] - - -class ParamsCreateTaskRequest(TypedDict, total=False): +class CreateTaskRequest(TypedDict, total=False): name: Optional[str] """The name of the task to create""" @@ -40,7 +18,7 @@ class ParamsCreateTaskRequest(TypedDict, total=False): """The parameters for the task""" -class ParamsCancelTaskRequest(TypedDict, total=False): +class CancelTaskRequest(TypedDict, total=False): task_id: Optional[str] """The ID of the task to cancel. Either this or task_name must be provided.""" @@ -48,13 +26,8 @@ class ParamsCancelTaskRequest(TypedDict, total=False): """The name of the task to cancel. Either this or task_id must be provided.""" -ParamsSendMessageRequestContent: TypeAlias = Union[ - TextContentParam, DataContentParam, ToolRequestContentParam, ToolResponseContentParam -] - - -class ParamsSendMessageRequest(TypedDict, total=False): - content: Required[ParamsSendMessageRequestContent] +class SendMessageRequest(TypedDict, total=False): + content: Required[TaskMessageContentParam] """The message that was sent to the agent""" stream: bool @@ -64,13 +37,8 @@ class ParamsSendMessageRequest(TypedDict, total=False): """The ID of the task that the message was sent to""" -ParamsSendEventRequestContent: TypeAlias = Union[ - TextContentParam, DataContentParam, ToolRequestContentParam, ToolResponseContentParam -] - - -class ParamsSendEventRequest(TypedDict, total=False): - content: Optional[ParamsSendEventRequestContent] +class SendEventRequest(TypedDict, total=False): + content: Optional[TaskMessageContentParam] """The content to send to the event""" task_id: Optional[str] @@ -80,6 +48,4 @@ class ParamsSendEventRequest(TypedDict, total=False): """The name of the task that the event was sent to""" -Params: TypeAlias = Union[ - ParamsCreateTaskRequest, ParamsCancelTaskRequest, ParamsSendMessageRequest, ParamsSendEventRequest -] +AgentRpcParams: TypeAlias = Union[CreateTaskRequest, CancelTaskRequest, SendMessageRequest, SendEventRequest] diff --git a/src/agentex/types/agent_rpc_params1.py b/src/agentex/types/agent_rpc_params1.py new file mode 100644 index 00000000..3eae8b68 --- /dev/null +++ b/src/agentex/types/agent_rpc_params1.py @@ -0,0 +1,21 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Union +from typing_extensions import Literal, Required, TypedDict + +from . import agent_rpc_params + +__all__ = ["AgentRpcParams"] + + +class AgentRpcParams(TypedDict, total=False): + method: Required[Literal["event/send", "task/create", "message/send", "task/cancel"]] + + params: Required[agent_rpc_params.AgentRpcParams] + """The parameters for the agent RPC request""" + + id: Union[int, str, None] + + jsonrpc: Literal["2.0"] diff --git a/src/agentex/types/agent_rpc_response.py b/src/agentex/types/agent_rpc_response.py new file mode 100644 index 00000000..e9995e80 --- /dev/null +++ b/src/agentex/types/agent_rpc_response.py @@ -0,0 +1,20 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Union, Optional +from typing_extensions import Literal + +from .._models import BaseModel +from .agent_rpc_result import AgentRpcResult + +__all__ = ["AgentRpcResponse"] + + +class AgentRpcResponse(BaseModel): + result: Optional[AgentRpcResult] = None + """The result of the agent RPC request""" + + id: Union[int, str, None] = None + + error: Optional[object] = None + + jsonrpc: Optional[Literal["2.0"]] = None diff --git a/src/agentex/types/agent_rpc_result.py b/src/agentex/types/agent_rpc_result.py new file mode 100644 index 00000000..63e30a5d --- /dev/null +++ b/src/agentex/types/agent_rpc_result.py @@ -0,0 +1,90 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Union, Optional +from typing_extensions import Literal, TypeAlias + +from .task import Task +from .event import Event +from .._models import BaseModel +from .task_message import TaskMessage +from .task_message_delta import TaskMessageDelta +from .task_message_content import TaskMessageContent + +__all__ = [ + "AgentRpcResult", + "StreamTaskMessageStart", + "StreamTaskMessageDelta", + "StreamTaskMessageFull", + "StreamTaskMessageDone", +] + + +class StreamTaskMessageStart(BaseModel): + content: TaskMessageContent + + index: Optional[int] = None + + parent_task_message: Optional[TaskMessage] = None + """Represents a message in the agent system. + + This entity is used to store messages in MongoDB, with each message associated + with a specific task. + """ + + type: Optional[Literal["start"]] = None + + +class StreamTaskMessageDelta(BaseModel): + delta: Optional[TaskMessageDelta] = None + """Delta for text updates""" + + index: Optional[int] = None + + parent_task_message: Optional[TaskMessage] = None + """Represents a message in the agent system. + + This entity is used to store messages in MongoDB, with each message associated + with a specific task. + """ + + type: Optional[Literal["delta"]] = None + + +class StreamTaskMessageFull(BaseModel): + content: TaskMessageContent + + index: Optional[int] = None + + parent_task_message: Optional[TaskMessage] = None + """Represents a message in the agent system. + + This entity is used to store messages in MongoDB, with each message associated + with a specific task. + """ + + type: Optional[Literal["full"]] = None + + +class StreamTaskMessageDone(BaseModel): + index: Optional[int] = None + + parent_task_message: Optional[TaskMessage] = None + """Represents a message in the agent system. + + This entity is used to store messages in MongoDB, with each message associated + with a specific task. + """ + + type: Optional[Literal["done"]] = None + + +AgentRpcResult: TypeAlias = Union[ + List[TaskMessage], + StreamTaskMessageStart, + StreamTaskMessageDelta, + StreamTaskMessageFull, + StreamTaskMessageDone, + Task, + Event, + None, +] diff --git a/src/agentex/types/data_delta.py b/src/agentex/types/data_delta.py new file mode 100644 index 00000000..e30c12e7 --- /dev/null +++ b/src/agentex/types/data_delta.py @@ -0,0 +1,14 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional +from typing_extensions import Literal + +from .._models import BaseModel + +__all__ = ["DataDelta"] + + +class DataDelta(BaseModel): + data_delta: Optional[str] = None + + type: Optional[Literal["data"]] = None diff --git a/src/agentex/types/event.py b/src/agentex/types/event.py index 3f1e5997..9a544cb6 100644 --- a/src/agentex/types/event.py +++ b/src/agentex/types/event.py @@ -1,21 +1,12 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import Union, Optional +from typing import Optional from datetime import datetime -from typing_extensions import Annotated, TypeAlias -from .._utils import PropertyInfo from .._models import BaseModel -from .data_content import DataContent -from .text_content import TextContent -from .tool_request_content import ToolRequestContent -from .tool_response_content import ToolResponseContent +from .task_message_content import TaskMessageContent -__all__ = ["Event", "Content"] - -Content: TypeAlias = Annotated[ - Union[TextContent, DataContent, ToolRequestContent, ToolResponseContent, None], PropertyInfo(discriminator="type") -] +__all__ = ["Event"] class Event(BaseModel): @@ -31,7 +22,7 @@ class Event(BaseModel): task_id: str """The UUID of the task that the event belongs to""" - content: Optional[Content] = None + content: Optional[TaskMessageContent] = None """The content of the event""" created_at: Optional[datetime] = None diff --git a/src/agentex/types/message_create_params.py b/src/agentex/types/message_create_params.py index 06ec3727..787715ec 100644 --- a/src/agentex/types/message_create_params.py +++ b/src/agentex/types/message_create_params.py @@ -2,24 +2,17 @@ from __future__ import annotations -from typing import Union, Optional -from typing_extensions import Required, TypeAlias, TypedDict +from typing import Optional +from typing_extensions import Literal, Required, TypedDict -from .streaming_status import StreamingStatus -from .data_content_param import DataContentParam -from .text_content_param import TextContentParam -from .tool_request_content_param import ToolRequestContentParam -from .tool_response_content_param import ToolResponseContentParam +from .task_message_content_param import TaskMessageContentParam -__all__ = ["MessageCreateParams", "Content"] +__all__ = ["MessageCreateParams"] class MessageCreateParams(TypedDict, total=False): - content: Required[Content] + content: Required[TaskMessageContentParam] task_id: Required[str] - streaming_status: Optional[StreamingStatus] - - -Content: TypeAlias = Union[TextContentParam, DataContentParam, ToolRequestContentParam, ToolResponseContentParam] + streaming_status: Optional[Literal["IN_PROGRESS", "DONE"]] diff --git a/src/agentex/types/message_update_params.py b/src/agentex/types/message_update_params.py index bc5305b8..ea3dbaf8 100644 --- a/src/agentex/types/message_update_params.py +++ b/src/agentex/types/message_update_params.py @@ -2,24 +2,17 @@ from __future__ import annotations -from typing import Union, Optional -from typing_extensions import Required, TypeAlias, TypedDict +from typing import Optional +from typing_extensions import Literal, Required, TypedDict -from .streaming_status import StreamingStatus -from .data_content_param import DataContentParam -from .text_content_param import TextContentParam -from .tool_request_content_param import ToolRequestContentParam -from .tool_response_content_param import ToolResponseContentParam +from .task_message_content_param import TaskMessageContentParam -__all__ = ["MessageUpdateParams", "Content"] +__all__ = ["MessageUpdateParams"] class MessageUpdateParams(TypedDict, total=False): - content: Required[Content] + content: Required[TaskMessageContentParam] task_id: Required[str] - streaming_status: Optional[StreamingStatus] - - -Content: TypeAlias = Union[TextContentParam, DataContentParam, ToolRequestContentParam, ToolResponseContentParam] + streaming_status: Optional[Literal["IN_PROGRESS", "DONE"]] diff --git a/src/agentex/types/messages/batch_create_params.py b/src/agentex/types/messages/batch_create_params.py index c09c69a9..0a0153ae 100644 --- a/src/agentex/types/messages/batch_create_params.py +++ b/src/agentex/types/messages/batch_create_params.py @@ -2,21 +2,15 @@ from __future__ import annotations -from typing import Union, Iterable -from typing_extensions import Required, TypeAlias, TypedDict +from typing import Iterable +from typing_extensions import Required, TypedDict -from ..data_content_param import DataContentParam -from ..text_content_param import TextContentParam -from ..tool_request_content_param import ToolRequestContentParam -from ..tool_response_content_param import ToolResponseContentParam +from ..task_message_content_param import TaskMessageContentParam -__all__ = ["BatchCreateParams", "Content"] +__all__ = ["BatchCreateParams"] class BatchCreateParams(TypedDict, total=False): - contents: Required[Iterable[Content]] + contents: Required[Iterable[TaskMessageContentParam]] task_id: Required[str] - - -Content: TypeAlias = Union[TextContentParam, DataContentParam, ToolRequestContentParam, ToolResponseContentParam] diff --git a/src/agentex/types/messages/batch_update_params.py b/src/agentex/types/messages/batch_update_params.py index 68f24f8d..c25e46f6 100644 --- a/src/agentex/types/messages/batch_update_params.py +++ b/src/agentex/types/messages/batch_update_params.py @@ -2,21 +2,15 @@ from __future__ import annotations -from typing import Dict, Union -from typing_extensions import Required, TypeAlias, TypedDict +from typing import Dict +from typing_extensions import Required, TypedDict -from ..data_content_param import DataContentParam -from ..text_content_param import TextContentParam -from ..tool_request_content_param import ToolRequestContentParam -from ..tool_response_content_param import ToolResponseContentParam +from ..task_message_content_param import TaskMessageContentParam -__all__ = ["BatchUpdateParams", "Updates"] +__all__ = ["BatchUpdateParams"] class BatchUpdateParams(TypedDict, total=False): task_id: Required[str] - updates: Required[Dict[str, Updates]] - - -Updates: TypeAlias = Union[TextContentParam, DataContentParam, ToolRequestContentParam, ToolResponseContentParam] + updates: Required[Dict[str, TaskMessageContentParam]] diff --git a/src/agentex/types/shared/__init__.py b/src/agentex/types/shared/__init__.py new file mode 100644 index 00000000..7b5a4954 --- /dev/null +++ b/src/agentex/types/shared/__init__.py @@ -0,0 +1,3 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from .task_message_update import TaskMessageUpdate as TaskMessageUpdate diff --git a/src/agentex/types/shared/task_message_update.py b/src/agentex/types/shared/task_message_update.py new file mode 100644 index 00000000..cc01b598 --- /dev/null +++ b/src/agentex/types/shared/task_message_update.py @@ -0,0 +1,83 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Union, Optional +from typing_extensions import Literal, Annotated, TypeAlias + +from ..._utils import PropertyInfo +from ..._models import BaseModel +from ..task_message import TaskMessage +from ..task_message_delta import TaskMessageDelta +from ..task_message_content import TaskMessageContent + +__all__ = [ + "TaskMessageUpdate", + "StreamTaskMessageStart", + "StreamTaskMessageDelta", + "StreamTaskMessageFull", + "StreamTaskMessageDone", +] + + +class StreamTaskMessageStart(BaseModel): + content: TaskMessageContent + + index: Optional[int] = None + + parent_task_message: Optional[TaskMessage] = None + """Represents a message in the agent system. + + This entity is used to store messages in MongoDB, with each message associated + with a specific task. + """ + + type: Optional[Literal["start"]] = None + + +class StreamTaskMessageDelta(BaseModel): + delta: Optional[TaskMessageDelta] = None + """Delta for text updates""" + + index: Optional[int] = None + + parent_task_message: Optional[TaskMessage] = None + """Represents a message in the agent system. + + This entity is used to store messages in MongoDB, with each message associated + with a specific task. + """ + + type: Optional[Literal["delta"]] = None + + +class StreamTaskMessageFull(BaseModel): + content: TaskMessageContent + + index: Optional[int] = None + + parent_task_message: Optional[TaskMessage] = None + """Represents a message in the agent system. + + This entity is used to store messages in MongoDB, with each message associated + with a specific task. + """ + + type: Optional[Literal["full"]] = None + + +class StreamTaskMessageDone(BaseModel): + index: Optional[int] = None + + parent_task_message: Optional[TaskMessage] = None + """Represents a message in the agent system. + + This entity is used to store messages in MongoDB, with each message associated + with a specific task. + """ + + type: Optional[Literal["done"]] = None + + +TaskMessageUpdate: TypeAlias = Annotated[ + Union[StreamTaskMessageStart, StreamTaskMessageDelta, StreamTaskMessageFull, StreamTaskMessageDone], + PropertyInfo(discriminator="type"), +] diff --git a/src/agentex/types/streaming_status.py b/src/agentex/types/streaming_status.py deleted file mode 100644 index 196d7881..00000000 --- a/src/agentex/types/streaming_status.py +++ /dev/null @@ -1,7 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing_extensions import Literal, TypeAlias - -__all__ = ["StreamingStatus"] - -StreamingStatus: TypeAlias = Literal["IN_PROGRESS", "DONE"] diff --git a/src/agentex/types/task_delete_by_name_response.py b/src/agentex/types/task_delete_by_name_response.py new file mode 100644 index 00000000..bea61633 --- /dev/null +++ b/src/agentex/types/task_delete_by_name_response.py @@ -0,0 +1,8 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Dict +from typing_extensions import TypeAlias + +__all__ = ["TaskDeleteByNameResponse"] + +TaskDeleteByNameResponse: TypeAlias = Dict[str, str] diff --git a/src/agentex/types/task_delete_response.py b/src/agentex/types/task_delete_response.py new file mode 100644 index 00000000..62104057 --- /dev/null +++ b/src/agentex/types/task_delete_response.py @@ -0,0 +1,8 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Dict +from typing_extensions import TypeAlias + +__all__ = ["TaskDeleteResponse"] + +TaskDeleteResponse: TypeAlias = Dict[str, str] diff --git a/src/agentex/types/task_message.py b/src/agentex/types/task_message.py index 686ade7d..b5938cc8 100644 --- a/src/agentex/types/task_message.py +++ b/src/agentex/types/task_message.py @@ -1,36 +1,33 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import Union, Optional +from typing import Optional from datetime import datetime -from typing_extensions import Annotated, TypeAlias +from typing_extensions import Literal -from .._utils import PropertyInfo from .._models import BaseModel -from .data_content import DataContent -from .text_content import TextContent -from .streaming_status import StreamingStatus -from .tool_request_content import ToolRequestContent -from .tool_response_content import ToolResponseContent +from .task_message_content import TaskMessageContent -__all__ = ["TaskMessage", "Content"] - -Content: TypeAlias = Annotated[ - Union[TextContent, DataContent, ToolRequestContent, ToolResponseContent], PropertyInfo(discriminator="type") -] +__all__ = ["TaskMessage"] class TaskMessage(BaseModel): - id: str - """The task message's unique id""" + content: TaskMessageContent + """The content of the message. - content: Content - - created_at: datetime - """The timestamp when the message was created""" + This content is not OpenAI compatible. These are messages that are meant to be + displayed to the user. + """ task_id: str + """ID of the task this message belongs to""" + + id: Optional[str] = None + """The task message's unique id""" + + created_at: Optional[datetime] = None + """The timestamp when the message was created""" - streaming_status: Optional[StreamingStatus] = None + streaming_status: Optional[Literal["IN_PROGRESS", "DONE"]] = None updated_at: Optional[datetime] = None """The timestamp when the message was last updated""" diff --git a/src/agentex/types/task_message_content.py b/src/agentex/types/task_message_content.py new file mode 100644 index 00000000..126992b4 --- /dev/null +++ b/src/agentex/types/task_message_content.py @@ -0,0 +1,16 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Union +from typing_extensions import Annotated, TypeAlias + +from .._utils import PropertyInfo +from .data_content import DataContent +from .text_content import TextContent +from .tool_request_content import ToolRequestContent +from .tool_response_content import ToolResponseContent + +__all__ = ["TaskMessageContent"] + +TaskMessageContent: TypeAlias = Annotated[ + Union[TextContent, DataContent, ToolRequestContent, ToolResponseContent], PropertyInfo(discriminator="type") +] diff --git a/src/agentex/types/task_message_content_param.py b/src/agentex/types/task_message_content_param.py new file mode 100644 index 00000000..6991c64e --- /dev/null +++ b/src/agentex/types/task_message_content_param.py @@ -0,0 +1,17 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Union +from typing_extensions import TypeAlias + +from .data_content_param import DataContentParam +from .text_content_param import TextContentParam +from .tool_request_content_param import ToolRequestContentParam +from .tool_response_content_param import ToolResponseContentParam + +__all__ = ["TaskMessageContentParam"] + +TaskMessageContentParam: TypeAlias = Union[ + TextContentParam, DataContentParam, ToolRequestContentParam, ToolResponseContentParam +] diff --git a/src/agentex/types/task_message_delta.py b/src/agentex/types/task_message_delta.py new file mode 100644 index 00000000..5a477e5a --- /dev/null +++ b/src/agentex/types/task_message_delta.py @@ -0,0 +1,16 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Union +from typing_extensions import Annotated, TypeAlias + +from .._utils import PropertyInfo +from .data_delta import DataDelta +from .text_delta import TextDelta +from .tool_request_delta import ToolRequestDelta +from .tool_response_delta import ToolResponseDelta + +__all__ = ["TaskMessageDelta"] + +TaskMessageDelta: TypeAlias = Annotated[ + Union[TextDelta, DataDelta, ToolRequestDelta, ToolResponseDelta], PropertyInfo(discriminator="type") +] diff --git a/src/agentex/types/text_delta.py b/src/agentex/types/text_delta.py new file mode 100644 index 00000000..29a60cfd --- /dev/null +++ b/src/agentex/types/text_delta.py @@ -0,0 +1,14 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional +from typing_extensions import Literal + +from .._models import BaseModel + +__all__ = ["TextDelta"] + + +class TextDelta(BaseModel): + text_delta: Optional[str] = None + + type: Optional[Literal["text"]] = None diff --git a/src/agentex/types/tool_request_delta.py b/src/agentex/types/tool_request_delta.py new file mode 100644 index 00000000..7877dfdd --- /dev/null +++ b/src/agentex/types/tool_request_delta.py @@ -0,0 +1,18 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional +from typing_extensions import Literal + +from .._models import BaseModel + +__all__ = ["ToolRequestDelta"] + + +class ToolRequestDelta(BaseModel): + name: str + + tool_call_id: str + + arguments_delta: Optional[str] = None + + type: Optional[Literal["tool_request"]] = None diff --git a/src/agentex/types/tool_response_delta.py b/src/agentex/types/tool_response_delta.py new file mode 100644 index 00000000..383770db --- /dev/null +++ b/src/agentex/types/tool_response_delta.py @@ -0,0 +1,18 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional +from typing_extensions import Literal + +from .._models import BaseModel + +__all__ = ["ToolResponseDelta"] + + +class ToolResponseDelta(BaseModel): + name: str + + tool_call_id: str + + content_delta: Optional[str] = None + + type: Optional[Literal["tool_response"]] = None diff --git a/tests/api_resources/test_agents.py b/tests/api_resources/test_agents.py index b2819f31..7cb79375 100644 --- a/tests/api_resources/test_agents.py +++ b/tests/api_resources/test_agents.py @@ -9,7 +9,11 @@ from agentex import Agentex, AsyncAgentex from tests.utils import assert_matches_type -from agentex.types import Agent, AgentListResponse +from agentex.types import ( + Agent, + AgentRpcResponse, + AgentListResponse, +) base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -229,7 +233,7 @@ def test_method_rpc(self, client: Agentex) -> None: method="event/send", params={}, ) - assert_matches_type(object, agent, path=["response"]) + assert_matches_type(AgentRpcResponse, agent, path=["response"]) @pytest.mark.skip() @parametrize @@ -244,7 +248,7 @@ def test_method_rpc_with_all_params(self, client: Agentex) -> None: id=0, jsonrpc="2.0", ) - assert_matches_type(object, agent, path=["response"]) + assert_matches_type(AgentRpcResponse, agent, path=["response"]) @pytest.mark.skip() @parametrize @@ -258,7 +262,7 @@ def test_raw_response_rpc(self, client: Agentex) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" agent = response.parse() - assert_matches_type(object, agent, path=["response"]) + assert_matches_type(AgentRpcResponse, agent, path=["response"]) @pytest.mark.skip() @parametrize @@ -272,7 +276,7 @@ def test_streaming_response_rpc(self, client: Agentex) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" agent = response.parse() - assert_matches_type(object, agent, path=["response"]) + assert_matches_type(AgentRpcResponse, agent, path=["response"]) assert cast(Any, response.is_closed) is True @@ -294,7 +298,7 @@ def test_method_rpc_by_name(self, client: Agentex) -> None: method="event/send", params={}, ) - assert_matches_type(object, agent, path=["response"]) + assert_matches_type(AgentRpcResponse, agent, path=["response"]) @pytest.mark.skip() @parametrize @@ -309,7 +313,7 @@ def test_method_rpc_by_name_with_all_params(self, client: Agentex) -> None: id=0, jsonrpc="2.0", ) - assert_matches_type(object, agent, path=["response"]) + assert_matches_type(AgentRpcResponse, agent, path=["response"]) @pytest.mark.skip() @parametrize @@ -323,7 +327,7 @@ def test_raw_response_rpc_by_name(self, client: Agentex) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" agent = response.parse() - assert_matches_type(object, agent, path=["response"]) + assert_matches_type(AgentRpcResponse, agent, path=["response"]) @pytest.mark.skip() @parametrize @@ -337,7 +341,7 @@ def test_streaming_response_rpc_by_name(self, client: Agentex) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" agent = response.parse() - assert_matches_type(object, agent, path=["response"]) + assert_matches_type(AgentRpcResponse, agent, path=["response"]) assert cast(Any, response.is_closed) is True @@ -569,7 +573,7 @@ async def test_method_rpc(self, async_client: AsyncAgentex) -> None: method="event/send", params={}, ) - assert_matches_type(object, agent, path=["response"]) + assert_matches_type(AgentRpcResponse, agent, path=["response"]) @pytest.mark.skip() @parametrize @@ -584,7 +588,7 @@ async def test_method_rpc_with_all_params(self, async_client: AsyncAgentex) -> N id=0, jsonrpc="2.0", ) - assert_matches_type(object, agent, path=["response"]) + assert_matches_type(AgentRpcResponse, agent, path=["response"]) @pytest.mark.skip() @parametrize @@ -598,7 +602,7 @@ async def test_raw_response_rpc(self, async_client: AsyncAgentex) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" agent = await response.parse() - assert_matches_type(object, agent, path=["response"]) + assert_matches_type(AgentRpcResponse, agent, path=["response"]) @pytest.mark.skip() @parametrize @@ -612,7 +616,7 @@ async def test_streaming_response_rpc(self, async_client: AsyncAgentex) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" agent = await response.parse() - assert_matches_type(object, agent, path=["response"]) + assert_matches_type(AgentRpcResponse, agent, path=["response"]) assert cast(Any, response.is_closed) is True @@ -634,7 +638,7 @@ async def test_method_rpc_by_name(self, async_client: AsyncAgentex) -> None: method="event/send", params={}, ) - assert_matches_type(object, agent, path=["response"]) + assert_matches_type(AgentRpcResponse, agent, path=["response"]) @pytest.mark.skip() @parametrize @@ -649,7 +653,7 @@ async def test_method_rpc_by_name_with_all_params(self, async_client: AsyncAgent id=0, jsonrpc="2.0", ) - assert_matches_type(object, agent, path=["response"]) + assert_matches_type(AgentRpcResponse, agent, path=["response"]) @pytest.mark.skip() @parametrize @@ -663,7 +667,7 @@ async def test_raw_response_rpc_by_name(self, async_client: AsyncAgentex) -> Non assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" agent = await response.parse() - assert_matches_type(object, agent, path=["response"]) + assert_matches_type(AgentRpcResponse, agent, path=["response"]) @pytest.mark.skip() @parametrize @@ -677,7 +681,7 @@ async def test_streaming_response_rpc_by_name(self, async_client: AsyncAgentex) assert response.http_request.headers.get("X-Stainless-Lang") == "python" agent = await response.parse() - assert_matches_type(object, agent, path=["response"]) + assert_matches_type(AgentRpcResponse, agent, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/test_tasks.py b/tests/api_resources/test_tasks.py index 0c9af1b4..97f20453 100644 --- a/tests/api_resources/test_tasks.py +++ b/tests/api_resources/test_tasks.py @@ -9,7 +9,7 @@ from agentex import Agentex, AsyncAgentex from tests.utils import assert_matches_type -from agentex.types import Task, TaskListResponse +from agentex.types import Task, TaskListResponse, TaskDeleteResponse, TaskDeleteByNameResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -93,7 +93,7 @@ def test_method_delete(self, client: Agentex) -> None: task = client.tasks.delete( "task_id", ) - assert_matches_type(Task, task, path=["response"]) + assert_matches_type(TaskDeleteResponse, task, path=["response"]) @pytest.mark.skip() @parametrize @@ -105,7 +105,7 @@ def test_raw_response_delete(self, client: Agentex) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" task = response.parse() - assert_matches_type(Task, task, path=["response"]) + assert_matches_type(TaskDeleteResponse, task, path=["response"]) @pytest.mark.skip() @parametrize @@ -117,7 +117,7 @@ def test_streaming_response_delete(self, client: Agentex) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" task = response.parse() - assert_matches_type(Task, task, path=["response"]) + assert_matches_type(TaskDeleteResponse, task, path=["response"]) assert cast(Any, response.is_closed) is True @@ -135,7 +135,7 @@ def test_method_delete_by_name(self, client: Agentex) -> None: task = client.tasks.delete_by_name( "task_name", ) - assert_matches_type(Task, task, path=["response"]) + assert_matches_type(TaskDeleteByNameResponse, task, path=["response"]) @pytest.mark.skip() @parametrize @@ -147,7 +147,7 @@ def test_raw_response_delete_by_name(self, client: Agentex) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" task = response.parse() - assert_matches_type(Task, task, path=["response"]) + assert_matches_type(TaskDeleteByNameResponse, task, path=["response"]) @pytest.mark.skip() @parametrize @@ -159,7 +159,7 @@ def test_streaming_response_delete_by_name(self, client: Agentex) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" task = response.parse() - assert_matches_type(Task, task, path=["response"]) + assert_matches_type(TaskDeleteByNameResponse, task, path=["response"]) assert cast(Any, response.is_closed) is True @@ -377,7 +377,7 @@ async def test_method_delete(self, async_client: AsyncAgentex) -> None: task = await async_client.tasks.delete( "task_id", ) - assert_matches_type(Task, task, path=["response"]) + assert_matches_type(TaskDeleteResponse, task, path=["response"]) @pytest.mark.skip() @parametrize @@ -389,7 +389,7 @@ async def test_raw_response_delete(self, async_client: AsyncAgentex) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" task = await response.parse() - assert_matches_type(Task, task, path=["response"]) + assert_matches_type(TaskDeleteResponse, task, path=["response"]) @pytest.mark.skip() @parametrize @@ -401,7 +401,7 @@ async def test_streaming_response_delete(self, async_client: AsyncAgentex) -> No assert response.http_request.headers.get("X-Stainless-Lang") == "python" task = await response.parse() - assert_matches_type(Task, task, path=["response"]) + assert_matches_type(TaskDeleteResponse, task, path=["response"]) assert cast(Any, response.is_closed) is True @@ -419,7 +419,7 @@ async def test_method_delete_by_name(self, async_client: AsyncAgentex) -> None: task = await async_client.tasks.delete_by_name( "task_name", ) - assert_matches_type(Task, task, path=["response"]) + assert_matches_type(TaskDeleteByNameResponse, task, path=["response"]) @pytest.mark.skip() @parametrize @@ -431,7 +431,7 @@ async def test_raw_response_delete_by_name(self, async_client: AsyncAgentex) -> assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" task = await response.parse() - assert_matches_type(Task, task, path=["response"]) + assert_matches_type(TaskDeleteByNameResponse, task, path=["response"]) @pytest.mark.skip() @parametrize @@ -443,7 +443,7 @@ async def test_streaming_response_delete_by_name(self, async_client: AsyncAgente assert response.http_request.headers.get("X-Stainless-Lang") == "python" task = await response.parse() - assert_matches_type(Task, task, path=["response"]) + assert_matches_type(TaskDeleteByNameResponse, task, path=["response"]) assert cast(Any, response.is_closed) is True From bbe3be30aa9fb8d7a677f0e9f0be4dd565563d6e Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 23 Jul 2025 20:02:17 +0000 Subject: [PATCH 3/4] feat(api): manual updates --- .stats.yml | 2 +- README.md | 6 +++--- pyproject.toml | 2 +- requirements-dev.lock | 16 ++++++++-------- requirements.lock | 16 ++++++++-------- 5 files changed, 21 insertions(+), 21 deletions(-) diff --git a/.stats.yml b/.stats.yml index a8d58116..26d5f8ee 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 34 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/sgp%2Fagentex-sdk-62a09183a027c64707ad1b9d7a5ccc66c8abf3965e6075282cb5ab72f742a2b3.yml openapi_spec_hash: 47f43703822077a82e2edf82d4b7e0e5 -config_hash: 2e4b423af3db79ebd8170c401ea9093a +config_hash: e9fb383df76f572ee9aefe7b876adc2f diff --git a/README.md b/README.md index 588fc8cc..f0cdff86 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # Agentex Python API library -[![PyPI version](https://img.shields.io/pypi/v/agentex.svg?label=pypi%20(stable))](https://pypi.org/project/agentex/) +[![PyPI version](https://img.shields.io/pypi/v/agentex-sdk.svg?label=pypi%20(stable))](https://pypi.org/project/agentex-sdk/) The Agentex Python library provides convenient access to the Agentex REST API from any Python 3.8+ application. The library includes type definitions for all request params and response fields, @@ -21,7 +21,7 @@ pip install git+ssh://git@github.com/scaleapi/agentex-python.git ``` > [!NOTE] -> Once this package is [published to PyPI](https://www.stainless.com/docs/guides/publish), this will become: `pip install --pre agentex` +> Once this package is [published to PyPI](https://www.stainless.com/docs/guides/publish), this will become: `pip install --pre agentex-sdk` ## Usage @@ -78,7 +78,7 @@ You can enable this by installing `aiohttp`: ```sh # install from the production repo -pip install 'agentex[aiohttp] @ git+ssh://git@github.com/scaleapi/agentex-python.git' +pip install 'agentex-sdk[aiohttp] @ git+ssh://git@github.com/scaleapi/agentex-python.git' ``` Then you can enable it by instantiating the client with `http_client=DefaultAioHttpClient()`: diff --git a/pyproject.toml b/pyproject.toml index 168acc46..2abd7533 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,5 +1,5 @@ [project] -name = "agentex" +name = "agentex-sdk" version = "0.1.0-alpha.5" description = "The official Python library for the agentex API" dynamic = ["readme"] diff --git a/requirements-dev.lock b/requirements-dev.lock index f82de72c..56a38441 100644 --- a/requirements-dev.lock +++ b/requirements-dev.lock @@ -13,14 +13,14 @@ aiohappyeyeballs==2.6.1 # via aiohttp aiohttp==3.12.8 - # via agentex + # via agentex-sdk # via httpx-aiohttp aiosignal==1.3.2 # via aiohttp annotated-types==0.6.0 # via pydantic anyio==4.4.0 - # via agentex + # via agentex-sdk # via httpx argcomplete==3.1.2 # via nox @@ -37,7 +37,7 @@ dirty-equals==0.6.0 distlib==0.3.7 # via virtualenv distro==1.8.0 - # via agentex + # via agentex-sdk exceptiongroup==1.2.2 # via anyio # via pytest @@ -53,11 +53,11 @@ h11==0.16.0 httpcore==1.0.9 # via httpx httpx==0.28.1 - # via agentex + # via agentex-sdk # via httpx-aiohttp # via respx httpx-aiohttp==0.1.8 - # via agentex + # via agentex-sdk idna==3.4 # via anyio # via httpx @@ -90,7 +90,7 @@ propcache==0.3.1 # via aiohttp # via yarl pydantic==2.10.3 - # via agentex + # via agentex-sdk pydantic-core==2.27.1 # via pydantic pygments==2.18.0 @@ -113,14 +113,14 @@ setuptools==68.2.2 six==1.16.0 # via python-dateutil sniffio==1.3.0 - # via agentex + # via agentex-sdk # via anyio time-machine==2.9.0 tomli==2.0.2 # via mypy # via pytest typing-extensions==4.12.2 - # via agentex + # via agentex-sdk # via anyio # via multidict # via mypy diff --git a/requirements.lock b/requirements.lock index a6d3556d..a4e7e943 100644 --- a/requirements.lock +++ b/requirements.lock @@ -13,14 +13,14 @@ aiohappyeyeballs==2.6.1 # via aiohttp aiohttp==3.12.8 - # via agentex + # via agentex-sdk # via httpx-aiohttp aiosignal==1.3.2 # via aiohttp annotated-types==0.6.0 # via pydantic anyio==4.4.0 - # via agentex + # via agentex-sdk # via httpx async-timeout==5.0.1 # via aiohttp @@ -30,7 +30,7 @@ certifi==2023.7.22 # via httpcore # via httpx distro==1.8.0 - # via agentex + # via agentex-sdk exceptiongroup==1.2.2 # via anyio frozenlist==1.6.2 @@ -41,10 +41,10 @@ h11==0.16.0 httpcore==1.0.9 # via httpx httpx==0.28.1 - # via agentex + # via agentex-sdk # via httpx-aiohttp httpx-aiohttp==0.1.8 - # via agentex + # via agentex-sdk idna==3.4 # via anyio # via httpx @@ -56,14 +56,14 @@ propcache==0.3.1 # via aiohttp # via yarl pydantic==2.10.3 - # via agentex + # via agentex-sdk pydantic-core==2.27.1 # via pydantic sniffio==1.3.0 - # via agentex + # via agentex-sdk # via anyio typing-extensions==4.12.2 - # via agentex + # via agentex-sdk # via anyio # via multidict # via pydantic From d741a8b75491462c8900eb0eb237b01f5c0be9fe Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 23 Jul 2025 20:02:38 +0000 Subject: [PATCH 4/4] release: 0.1.0-alpha.6 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 10 ++++++++++ pyproject.toml | 2 +- src/agentex/_version.py | 2 +- 4 files changed, 13 insertions(+), 3 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index e8285b71..4f9005ea 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "0.1.0-alpha.5" + ".": "0.1.0-alpha.6" } \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 14160687..a0496b29 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,15 @@ # Changelog +## 0.1.0-alpha.6 (2025-07-23) + +Full Changelog: [v0.1.0-alpha.5...v0.1.0-alpha.6](https://github.com/scaleapi/agentex-python/compare/v0.1.0-alpha.5...v0.1.0-alpha.6) + +### Features + +* **api:** api update ([af18034](https://github.com/scaleapi/agentex-python/commit/af18034e4173794ebf42eff688f26d64caca4e64)) +* **api:** api update ([be9b603](https://github.com/scaleapi/agentex-python/commit/be9b60326817566d5c5edcbd7b7babb6db07e539)) +* **api:** manual updates ([bbe3be3](https://github.com/scaleapi/agentex-python/commit/bbe3be30aa9fb8d7a677f0e9f0be4dd565563d6e)) + ## 0.1.0-alpha.5 (2025-07-23) Full Changelog: [v0.1.0-alpha.4...v0.1.0-alpha.5](https://github.com/scaleapi/agentex-python/compare/v0.1.0-alpha.4...v0.1.0-alpha.5) diff --git a/pyproject.toml b/pyproject.toml index 2abd7533..31d2a656 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "agentex-sdk" -version = "0.1.0-alpha.5" +version = "0.1.0-alpha.6" description = "The official Python library for the agentex API" dynamic = ["readme"] license = "Apache-2.0" diff --git a/src/agentex/_version.py b/src/agentex/_version.py index 6c4f3e31..a4a7b2ff 100644 --- a/src/agentex/_version.py +++ b/src/agentex/_version.py @@ -1,4 +1,4 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. __title__ = "agentex" -__version__ = "0.1.0-alpha.5" # x-release-please-version +__version__ = "0.1.0-alpha.6" # x-release-please-version