agentex-sdk 0.2.1__py3-none-any.whl → 0.2.2__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
agentex/_version.py CHANGED
@@ -1,4 +1,4 @@
1
1
  # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
2
 
3
3
  __title__ = "agentex"
4
- __version__ = "0.2.1" # x-release-please-version
4
+ __version__ = "0.2.2" # x-release-please-version
@@ -4,6 +4,7 @@ from typing import Any
4
4
  from temporalio.common import RetryPolicy
5
5
 
6
6
  from agentex import AsyncAgentex
7
+ from agentex.lib.adk.utils._modules.client import create_async_agentex_client
7
8
  from agentex.lib.core.services.adk.acp.acp import ACPService
8
9
  from agentex.lib.core.temporal.activities.activity_helpers import ActivityHelpers
9
10
  from agentex.lib.core.temporal.activities.adk.acp.acp_activities import (
@@ -40,7 +41,7 @@ class ACPModule:
40
41
  acp_activities (Optional[ACPActivities]): Optional pre-configured ACP activities. If None, will be auto-initialized.
41
42
  """
42
43
  if acp_service is None:
43
- agentex_client = AsyncAgentex()
44
+ agentex_client = create_async_agentex_client()
44
45
  tracer = AsyncTracer(agentex_client)
45
46
  self._acp_service = ACPService(agentex_client=agentex_client, tracer=tracer)
46
47
  else:
@@ -3,6 +3,7 @@ from datetime import timedelta
3
3
  from temporalio.common import RetryPolicy
4
4
 
5
5
  from agentex import AsyncAgentex
6
+ from agentex.lib.adk.utils._modules.client import create_async_agentex_client
6
7
  from agentex.lib.core.services.adk.agent_task_tracker import AgentTaskTrackerService
7
8
  from agentex.lib.core.temporal.activities.activity_helpers import ActivityHelpers
8
9
  from agentex.lib.core.temporal.activities.adk.agent_task_tracker_activities import (
@@ -33,7 +34,7 @@ class AgentTaskTrackerModule:
33
34
  agent_task_tracker_service: AgentTaskTrackerService | None = None,
34
35
  ):
35
36
  if agent_task_tracker_service is None:
36
- agentex_client = AsyncAgentex()
37
+ agentex_client = create_async_agentex_client()
37
38
  tracer = AsyncTracer(agentex_client)
38
39
  self._agent_task_tracker_service = AgentTaskTrackerService(
39
40
  agentex_client=agentex_client, tracer=tracer
@@ -1,6 +1,7 @@
1
1
  from datetime import timedelta
2
2
  from typing import Optional
3
3
 
4
+ from agentex.lib.adk.utils._modules.client import create_async_agentex_client
4
5
  from agentex.lib.core.temporal.activities.adk.agents_activities import AgentsActivityName, GetAgentParams
5
6
  from temporalio.common import RetryPolicy
6
7
 
@@ -28,7 +29,7 @@ class AgentsModule:
28
29
  agents_service: Optional[AgentsService] = None,
29
30
  ):
30
31
  if agents_service is None:
31
- agentex_client = AsyncAgentex()
32
+ agentex_client = create_async_agentex_client()
32
33
  tracer = AsyncTracer(agentex_client)
33
34
  self._agents_service = AgentsService(agentex_client=agentex_client, tracer=tracer)
34
35
  else:
@@ -3,6 +3,7 @@ from datetime import timedelta
3
3
  from temporalio.common import RetryPolicy
4
4
 
5
5
  from agentex import AsyncAgentex
6
+ from agentex.lib.adk.utils._modules.client import create_async_agentex_client
6
7
  from agentex.lib.core.services.adk.events import EventsService
7
8
  from agentex.lib.core.temporal.activities.activity_helpers import ActivityHelpers
8
9
  from agentex.lib.core.temporal.activities.adk.events_activities import (
@@ -32,7 +33,7 @@ class EventsModule:
32
33
  events_service: EventsService | None = None,
33
34
  ):
34
35
  if events_service is None:
35
- agentex_client = AsyncAgentex()
36
+ agentex_client = create_async_agentex_client()
36
37
  tracer = AsyncTracer(agentex_client)
37
38
  self._events_service = EventsService(
38
39
  agentex_client=agentex_client, tracer=tracer
@@ -3,6 +3,7 @@ from datetime import timedelta
3
3
  from temporalio.common import RetryPolicy
4
4
 
5
5
  from agentex import AsyncAgentex
6
+ from agentex.lib.adk.utils._modules.client import create_async_agentex_client
6
7
  from agentex.lib.core.adapters.streams.adapter_redis import RedisStreamRepository
7
8
  from agentex.lib.core.services.adk.messages import MessagesService
8
9
  from agentex.lib.core.services.adk.streaming import StreamingService
@@ -37,7 +38,7 @@ class MessagesModule:
37
38
  messages_service: MessagesService | None = None,
38
39
  ):
39
40
  if messages_service is None:
40
- agentex_client = AsyncAgentex()
41
+ agentex_client = create_async_agentex_client()
41
42
  stream_repository = RedisStreamRepository()
42
43
  streaming_service = StreamingService(
43
44
  agentex_client=agentex_client,
@@ -5,6 +5,7 @@ from pydantic import BaseModel
5
5
  from temporalio.common import RetryPolicy
6
6
 
7
7
  from agentex import AsyncAgentex
8
+ from agentex.lib.adk.utils._modules.client import create_async_agentex_client
8
9
  from agentex.lib.core.services.adk.state import StateService
9
10
  from agentex.lib.core.temporal.activities.activity_helpers import ActivityHelpers
10
11
  from agentex.lib.core.temporal.activities.adk.state_activities import (
@@ -36,7 +37,7 @@ class StateModule:
36
37
  state_service: StateService | None = None,
37
38
  ):
38
39
  if state_service is None:
39
- agentex_client = AsyncAgentex()
40
+ agentex_client = create_async_agentex_client()
40
41
  tracer = AsyncTracer(agentex_client)
41
42
  self._state_service = StateService(
42
43
  agentex_client=agentex_client, tracer=tracer
@@ -1,6 +1,7 @@
1
1
  from temporalio.common import RetryPolicy
2
2
 
3
3
  from agentex import AsyncAgentex
4
+ from agentex.lib.adk.utils._modules.client import create_async_agentex_client
4
5
  from agentex.lib.core.adapters.streams.adapter_redis import RedisStreamRepository
5
6
  from agentex.lib.core.services.adk.streaming import (
6
7
  StreamingService,
@@ -34,7 +35,7 @@ class StreamingModule:
34
35
  """
35
36
  if streaming_service is None:
36
37
  stream_repository = RedisStreamRepository()
37
- agentex_client = AsyncAgentex()
38
+ agentex_client = create_async_agentex_client()
38
39
  self._streaming_service = StreamingService(
39
40
  agentex_client=agentex_client,
40
41
  stream_repository=stream_repository,
@@ -3,6 +3,7 @@ from datetime import timedelta
3
3
  from temporalio.common import RetryPolicy
4
4
 
5
5
  from agentex import AsyncAgentex
6
+ from agentex.lib.adk.utils._modules.client import create_async_agentex_client
6
7
  from agentex.lib.core.services.adk.tasks import TasksService
7
8
  from agentex.lib.core.temporal.activities.activity_helpers import ActivityHelpers
8
9
  from agentex.lib.core.temporal.activities.adk.tasks_activities import (
@@ -31,7 +32,7 @@ class TasksModule:
31
32
  tasks_service: TasksService | None = None,
32
33
  ):
33
34
  if tasks_service is None:
34
- agentex_client = AsyncAgentex()
35
+ agentex_client = create_async_agentex_client()
35
36
  tracer = AsyncTracer(agentex_client)
36
37
  self._tasks_service = TasksService(
37
38
  agentex_client=agentex_client, tracer=tracer
@@ -6,6 +6,7 @@ from typing import Any
6
6
  from temporalio.common import RetryPolicy
7
7
 
8
8
  from agentex import AsyncAgentex
9
+ from agentex.lib.adk.utils._modules.client import create_async_agentex_client
9
10
  from agentex.lib.core.services.adk.tracing import TracingService
10
11
  from agentex.lib.core.temporal.activities.activity_helpers import ActivityHelpers
11
12
  from agentex.lib.core.temporal.activities.adk.tracing_activities import (
@@ -38,7 +39,7 @@ class TracingModule:
38
39
  tracing_activities (Optional[TracingActivities]): Optional pre-configured tracing activities. If None, will be auto-initialized.
39
40
  """
40
41
  if tracing_service is None:
41
- agentex_client = AsyncAgentex()
42
+ agentex_client = create_async_agentex_client()
42
43
  tracer = AsyncTracer(agentex_client)
43
44
  self._tracing_service = TracingService(tracer=tracer)
44
45
  else:
@@ -0,0 +1,12 @@
1
+ import os
2
+
3
+ from agentex import AsyncAgentex
4
+ from agentex.lib.environment_variables import refreshed_environment_variables
5
+
6
+
7
+ def create_async_agentex_client(**kwargs):
8
+ agent_id = refreshed_environment_variables.AGENT_ID
9
+ default_headers = {
10
+ "x-agent-identity": agent_id
11
+ }
12
+ return AsyncAgentex(default_headers=default_headers, **kwargs)
@@ -30,24 +30,17 @@
30
30
  "outputs": [],
31
31
  "source": [
32
32
  "# (REQUIRED) Create a new task. For Agentic agents, you must create a task for messages to be associated with.\n",
33
- "\n",
34
- "from typing import cast\n",
35
33
  "import uuid\n",
36
34
  "\n",
37
- "from agentex.types import Task\n",
38
- "\n",
39
- "TASK_ID = str(uuid.uuid4())[:8]\n",
40
- "\n",
41
- "rpc_response = client.agents.rpc_by_name(\n",
35
+ "rpc_response = client.agents.create_task(\n",
42
36
  " agent_name=AGENT_NAME,\n",
43
- " method=\"task/create\",\n",
44
37
  " params={\n",
45
- " \"name\": f\"{TASK_ID}-task\",\n",
38
+ " \"name\": f\"{str(uuid.uuid4())[:8]}-task\",\n",
46
39
  " \"params\": {}\n",
47
40
  " }\n",
48
41
  ")\n",
49
42
  "\n",
50
- "task = cast(Task, rpc_response.result)\n",
43
+ "task = rpc_response.result\n",
51
44
  "print(task)"
52
45
  ]
53
46
  },
@@ -58,9 +51,7 @@
58
51
  "metadata": {},
59
52
  "outputs": [],
60
53
  "source": [
61
- "# Test non streaming response\n",
62
- "from typing import cast\n",
63
- "from agentex.types import Event\n",
54
+ "# Send an event to the agent\n",
64
55
  "\n",
65
56
  "# The response is expected to be a list of TaskMessage objects, which is a union of the following types:\n",
66
57
  "# - TextContent: A message with just text content \n",
@@ -70,16 +61,15 @@
70
61
  "\n",
71
62
  "# When processing the message/send response, if you are expecting more than TextContent, such as DataContent, ToolRequestContent, or ToolResponseContent, you can process them as well\n",
72
63
  "\n",
73
- "rpc_response = client.agents.rpc_by_name(\n",
64
+ "rpc_response = client.agents.send_event(\n",
74
65
  " agent_name=AGENT_NAME,\n",
75
- " method=\"event/send\",\n",
76
66
  " params={\n",
77
67
  " \"content\": {\"type\": \"text\", \"author\": \"user\", \"content\": \"Hello what can you do?\"},\n",
78
68
  " \"task_id\": task.id,\n",
79
69
  " }\n",
80
70
  ")\n",
81
71
  "\n",
82
- "event = cast(Event, rpc_response.result)\n",
72
+ "event = rpc_response.result\n",
83
73
  "print(event)"
84
74
  ]
85
75
  },
@@ -90,6 +80,7 @@
90
80
  "metadata": {},
91
81
  "outputs": [],
92
82
  "source": [
83
+ "# Subscribe to the async task messages produced by the agent\n",
93
84
  "from agentex.lib.utils.dev_tools import subscribe_to_async_task_messages\n",
94
85
  "\n",
95
86
  "task_messages = subscribe_to_async_task_messages(\n",
@@ -101,6 +92,14 @@
101
92
  " timeout=5,\n",
102
93
  ")"
103
94
  ]
95
+ },
96
+ {
97
+ "cell_type": "code",
98
+ "execution_count": null,
99
+ "id": "4864e354",
100
+ "metadata": {},
101
+ "outputs": [],
102
+ "source": []
104
103
  }
105
104
  ],
106
105
  "metadata": {
@@ -56,8 +56,7 @@
56
56
  "outputs": [],
57
57
  "source": [
58
58
  "# Test non streaming response\n",
59
- "from typing import List, cast\n",
60
- "from agentex.types import TaskMessage, TextContent\n",
59
+ "from agentex.types import TextContent\n",
61
60
  "\n",
62
61
  "# The response is expected to be a list of TaskMessage objects, which is a union of the following types:\n",
63
62
  "# - TextContent: A message with just text content \n",
@@ -67,29 +66,23 @@
67
66
  "\n",
68
67
  "# When processing the message/send response, if you are expecting more than TextContent, such as DataContent, ToolRequestContent, or ToolResponseContent, you can process them as well\n",
69
68
  "\n",
70
- "rpc_response = client.agents.rpc_by_name(\n",
69
+ "rpc_response = client.agents.send_message(\n",
71
70
  " agent_name=AGENT_NAME,\n",
72
- " method=\"message/send\",\n",
73
71
  " params={\n",
74
72
  " \"content\": {\"type\": \"text\", \"author\": \"user\", \"content\": \"Hello what can you do?\"},\n",
75
73
  " \"stream\": False\n",
76
74
  " }\n",
77
75
  ")\n",
78
76
  "\n",
79
- "# # Extract and print just the text content from the response\n",
80
- "# # The response is expected to be a dict with a \"result\" key containing a list of message dicts\n",
81
- "if rpc_response and rpc_response.result:\n",
77
+ "if not rpc_response or not rpc_response.result:\n",
78
+ " raise ValueError(\"No result in response\")\n",
82
79
  "\n",
83
- " # We know that the result of the message/send when stream is set to False will be a list of TaskMessage objects\n",
84
- " task_message_list = cast(List[TaskMessage], rpc_response.result)\n",
85
- " for task_message in rpc_response.result:\n",
86
- " if isinstance(task_message, TaskMessage):\n",
87
- " content = task_message.content\n",
88
- " if isinstance(content, TextContent):\n",
89
- " text = content.content\n",
90
- " print(text)\n",
91
- " else:\n",
92
- " print(f\"Found non-text {type(task_message)} object in response.\")\n"
80
+ "# Extract and print just the text content from the response\n",
81
+ "for task_message in rpc_response.result:\n",
82
+ " content = task_message.content\n",
83
+ " if isinstance(content, TextContent):\n",
84
+ " text = content.content\n",
85
+ " print(text)\n"
93
86
  ]
94
87
  },
95
88
  {
@@ -100,11 +93,8 @@
100
93
  "outputs": [],
101
94
  "source": [
102
95
  "# Test streaming response\n",
103
- "import json\n",
104
- "from agentex.types import AgentRpcResponse\n",
105
- "from agentex.types.agent_rpc_result import StreamTaskMessageDelta, StreamTaskMessageFull\n",
96
+ "from agentex.types.task_message_update import StreamTaskMessageDelta, StreamTaskMessageFull\n",
106
97
  "from agentex.types.text_delta import TextDelta\n",
107
- "from agentex.types.task_message_update import TaskMessageUpdate\n",
108
98
  "\n",
109
99
  "\n",
110
100
  "# The result object of message/send will be a TaskMessageUpdate which is a union of the following types:\n",
@@ -120,38 +110,34 @@
120
110
  "# Whenn processing StreamTaskMessageDelta, if you are expecting more than TextDeltas, such as DataDelta, ToolRequestDelta, or ToolResponseDelta, you can process them as well\n",
121
111
  "# Whenn processing StreamTaskMessageFull, if you are expecting more than TextContent, such as DataContent, ToolRequestContent, or ToolResponseContent, you can process them as well\n",
122
112
  "\n",
123
- "with client.agents.with_streaming_response.rpc_by_name(\n",
113
+ "for agent_rpc_response_chunk in client.agents.send_message_stream(\n",
124
114
  " agent_name=AGENT_NAME,\n",
125
- " method=\"message/send\",\n",
126
115
  " params={\n",
127
116
  " \"content\": {\"type\": \"text\", \"author\": \"user\", \"content\": \"Hello what can you do?\"},\n",
128
117
  " \"stream\": True\n",
129
118
  " }\n",
130
- ") as response:\n",
131
- " for agent_rpc_response_str in response.iter_text():\n",
132
- " chunk_rpc_response = AgentRpcResponse.model_validate(json.loads(agent_rpc_response_str))\n",
133
- " # We know that the result of the message/send when stream is set to True will be a TaskMessageUpdate\n",
134
- " task_message_update = cast(TaskMessageUpdate, chunk_rpc_response.result)\n",
135
- "\n",
136
- " # Print oly the text deltas as they arrive or any full messages\n",
137
- " if isinstance(task_message_update, StreamTaskMessageDelta):\n",
138
- " delta = task_message_update.delta\n",
139
- " if isinstance(delta, TextDelta):\n",
140
- " print(delta.text_delta, end=\"\", flush=True)\n",
141
- " else:\n",
142
- " print(f\"Found non-text {type(task_message)} object in streaming message.\")\n",
143
- " elif isinstance(task_message_update, StreamTaskMessageFull):\n",
144
- " content = task_message_update.content\n",
145
- " if isinstance(content, TextContent):\n",
146
- " print(content.content)\n",
147
- " else:\n",
148
- " print(f\"Found non-text {type(task_message)} object in full message.\")\n"
119
+ "):\n",
120
+ " # We know that the result of the message/send when stream is set to True will be a TaskMessageUpdate\n",
121
+ " task_message_update = agent_rpc_response_chunk.result\n",
122
+ " # Print oly the text deltas as they arrive or any full messages\n",
123
+ " if isinstance(task_message_update, StreamTaskMessageDelta):\n",
124
+ " delta = task_message_update.delta\n",
125
+ " if isinstance(delta, TextDelta):\n",
126
+ " print(delta.text_delta, end=\"\", flush=True)\n",
127
+ " else:\n",
128
+ " print(f\"Found non-text {type(task_message)} object in streaming message.\")\n",
129
+ " elif isinstance(task_message_update, StreamTaskMessageFull):\n",
130
+ " content = task_message_update.content\n",
131
+ " if isinstance(content, TextContent):\n",
132
+ " print(content.content)\n",
133
+ " else:\n",
134
+ " print(f\"Found non-text {type(task_message)} object in full message.\")\n"
149
135
  ]
150
136
  },
151
137
  {
152
138
  "cell_type": "code",
153
139
  "execution_count": null,
154
- "id": "4ffb663c",
140
+ "id": "c5e7e042",
155
141
  "metadata": {},
156
142
  "outputs": [],
157
143
  "source": []
@@ -30,24 +30,17 @@
30
30
  "outputs": [],
31
31
  "source": [
32
32
  "# (REQUIRED) Create a new task. For Agentic agents, you must create a task for messages to be associated with.\n",
33
- "\n",
34
- "from typing import cast\n",
35
33
  "import uuid\n",
36
34
  "\n",
37
- "from agentex.types import Task\n",
38
- "\n",
39
- "TASK_ID = str(uuid.uuid4())[:8]\n",
40
- "\n",
41
- "rpc_response = client.agents.rpc_by_name(\n",
35
+ "rpc_response = client.agents.create_task(\n",
42
36
  " agent_name=AGENT_NAME,\n",
43
- " method=\"task/create\",\n",
44
37
  " params={\n",
45
- " \"name\": f\"{TASK_ID}-task\",\n",
38
+ " \"name\": f\"{str(uuid.uuid4())[:8]}-task\",\n",
46
39
  " \"params\": {}\n",
47
40
  " }\n",
48
41
  ")\n",
49
42
  "\n",
50
- "task = cast(Task, rpc_response.result)\n",
43
+ "task = rpc_response.result\n",
51
44
  "print(task)"
52
45
  ]
53
46
  },
@@ -58,9 +51,7 @@
58
51
  "metadata": {},
59
52
  "outputs": [],
60
53
  "source": [
61
- "# Test non streaming response\n",
62
- "from typing import cast\n",
63
- "from agentex.types import Event\n",
54
+ "# Send an event to the agent\n",
64
55
  "\n",
65
56
  "# The response is expected to be a list of TaskMessage objects, which is a union of the following types:\n",
66
57
  "# - TextContent: A message with just text content \n",
@@ -70,16 +61,15 @@
70
61
  "\n",
71
62
  "# When processing the message/send response, if you are expecting more than TextContent, such as DataContent, ToolRequestContent, or ToolResponseContent, you can process them as well\n",
72
63
  "\n",
73
- "rpc_response = client.agents.rpc_by_name(\n",
64
+ "rpc_response = client.agents.send_event(\n",
74
65
  " agent_name=AGENT_NAME,\n",
75
- " method=\"event/send\",\n",
76
66
  " params={\n",
77
67
  " \"content\": {\"type\": \"text\", \"author\": \"user\", \"content\": \"Hello what can you do?\"},\n",
78
68
  " \"task_id\": task.id,\n",
79
69
  " }\n",
80
70
  ")\n",
81
71
  "\n",
82
- "event = cast(Event, rpc_response.result)\n",
72
+ "event = rpc_response.result\n",
83
73
  "print(event)"
84
74
  ]
85
75
  },
@@ -90,6 +80,7 @@
90
80
  "metadata": {},
91
81
  "outputs": [],
92
82
  "source": [
83
+ "# Subscribe to the async task messages produced by the agent\n",
93
84
  "from agentex.lib.utils.dev_tools import subscribe_to_async_task_messages\n",
94
85
  "\n",
95
86
  "task_messages = subscribe_to_async_task_messages(\n",
@@ -101,6 +92,14 @@
101
92
  " timeout=5,\n",
102
93
  ")"
103
94
  ]
95
+ },
96
+ {
97
+ "cell_type": "code",
98
+ "execution_count": null,
99
+ "id": "4864e354",
100
+ "metadata": {},
101
+ "outputs": [],
102
+ "source": []
104
103
  }
105
104
  ],
106
105
  "metadata": {
@@ -2,6 +2,7 @@ import asyncio
2
2
  import base64
3
3
  import inspect
4
4
  import json
5
+ import os
5
6
  from collections.abc import AsyncGenerator, Awaitable, Callable
6
7
  from contextlib import asynccontextmanager
7
8
  from typing import Any
@@ -13,7 +14,7 @@ from fastapi.responses import StreamingResponse
13
14
  from pydantic import TypeAdapter, ValidationError
14
15
 
15
16
  # from agentex.lib.sdk.fastacp.types import BaseACPConfig
16
- from agentex.lib.environment_variables import EnvironmentVariables
17
+ from agentex.lib.environment_variables import EnvironmentVariables, refreshed_environment_variables
17
18
  from agentex.lib.types.acp import (
18
19
  PARAMS_MODEL_BY_METHOD,
19
20
  RPC_SYNC_METHODS,
@@ -390,8 +391,16 @@ class BaseACPServer(FastAPI):
390
391
  registration_url, json=registration_data, timeout=30.0
391
392
  )
392
393
  if response.status_code == 200:
394
+ agent = response.json()
395
+ agent_id, agent_name = agent["id"], agent["name"]
396
+
397
+ os.environ["AGENT_ID"] = agent_id
398
+ os.environ["AGENT_NAME"] = agent_name
399
+ refreshed_environment_variables.AGENT_ID = agent_id
400
+ refreshed_environment_variables.AGENT_NAME = agent_name
401
+
393
402
  logger.info(
394
- f"Successfully registered agent '{env_vars.AGENT_NAME}' with Agentex server with acp_url: {full_acp_url}. Registration data: {registration_data}"
403
+ f"Successfully registered agent '{agent_name}' with Agentex server with acp_url: {full_acp_url}. Registration data: {registration_data}"
395
404
  )
396
405
  return # Success, exit the retry loop
397
406
  else:
@@ -2,7 +2,8 @@
2
2
 
3
3
  from __future__ import annotations
4
4
 
5
- from typing import Union, Optional
5
+ import json
6
+ from typing import AsyncGenerator, Generator, Union, Optional
6
7
  from typing_extensions import Literal
7
8
 
8
9
  import httpx
@@ -20,7 +21,7 @@ from .._response import (
20
21
  )
21
22
  from ..types.agent import Agent
22
23
  from .._base_client import make_request_options
23
- from ..types.agent_rpc_response import AgentRpcResponse
24
+ from ..types.agent_rpc_response import AgentRpcResponse, CancelTaskResponse, CreateTaskResponse, SendEventResponse, SendMessageResponse, SendMessageStreamResponse
24
25
  from ..types.agent_list_response import AgentListResponse
25
26
 
26
27
  __all__ = ["AgentsResource", "AsyncAgentsResource"]
@@ -310,6 +311,260 @@ class AgentsResource(SyncAPIResource):
310
311
  ),
311
312
  cast_to=AgentRpcResponse,
312
313
  )
314
+
315
+ def create_task(
316
+ self,
317
+ agent_id: str | None = None,
318
+ agent_name: str | None = None,
319
+ *,
320
+ params: agent_rpc_params.ParamsCreateTaskRequest,
321
+ id: Union[int, str, None] | NotGiven = NOT_GIVEN,
322
+ jsonrpc: Literal["2.0"] | NotGiven = NOT_GIVEN,
323
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
324
+ # The extra values given here take precedence over values defined on the client or passed to this method.
325
+ extra_headers: Headers | None = None,
326
+ extra_query: Query | None = None,
327
+ extra_body: Body | None = None,
328
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
329
+ ) -> CreateTaskResponse:
330
+ if agent_id is not None and agent_name is not None:
331
+ raise ValueError("Either agent_id or agent_name must be provided, but not both")
332
+
333
+ if agent_id is not None:
334
+ raw_agent_rpc_response = self.rpc(
335
+ agent_id=agent_id,
336
+ method="task/create",
337
+ params=params,
338
+ id=id,
339
+ jsonrpc=jsonrpc,
340
+ extra_headers=extra_headers,
341
+ extra_query=extra_query,
342
+ extra_body=extra_body,
343
+ timeout=timeout,
344
+ )
345
+ elif agent_name is not None:
346
+ raw_agent_rpc_response = self.rpc_by_name(
347
+ agent_name=agent_name,
348
+ method="task/create",
349
+ params=params,
350
+ id=id,
351
+ jsonrpc=jsonrpc,
352
+ extra_headers=extra_headers,
353
+ extra_query=extra_query,
354
+ extra_body=extra_body,
355
+ timeout=timeout,
356
+ )
357
+ else:
358
+ raise ValueError("Either agent_id or agent_name must be provided")
359
+
360
+ return CreateTaskResponse.model_validate(raw_agent_rpc_response, from_attributes=True)
361
+
362
+ def cancel_task(
363
+ self,
364
+ agent_id: str | None = None,
365
+ agent_name: str | None = None,
366
+ *,
367
+ params: agent_rpc_params.ParamsCancelTaskRequest,
368
+ id: Union[int, str, None] | NotGiven = NOT_GIVEN,
369
+ jsonrpc: Literal["2.0"] | NotGiven = NOT_GIVEN,
370
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
371
+ # The extra values given here take precedence over values defined on the client or passed to this method.
372
+ extra_headers: Headers | None = None,
373
+ extra_query: Query | None = None,
374
+ extra_body: Body | None = None,
375
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
376
+ ) -> CancelTaskResponse:
377
+ if agent_id is not None and agent_name is not None:
378
+ raise ValueError("Either agent_id or agent_name must be provided, but not both")
379
+
380
+ if agent_id is not None:
381
+ raw_agent_rpc_response = self.rpc(
382
+ agent_id=agent_id,
383
+ method="task/cancel",
384
+ params=params,
385
+ id=id,
386
+ jsonrpc=jsonrpc,
387
+ extra_headers=extra_headers,
388
+ extra_query=extra_query,
389
+ extra_body=extra_body,
390
+ timeout=timeout,
391
+ )
392
+ elif agent_name is not None:
393
+ raw_agent_rpc_response = self.rpc_by_name(
394
+ agent_name=agent_name,
395
+ method="task/cancel",
396
+ params=params,
397
+ id=id,
398
+ jsonrpc=jsonrpc,
399
+ extra_headers=extra_headers,
400
+ extra_query=extra_query,
401
+ extra_body=extra_body,
402
+ timeout=timeout,
403
+ )
404
+ else:
405
+ raise ValueError("Either agent_id or agent_name must be provided")
406
+
407
+ return CancelTaskResponse.model_validate(raw_agent_rpc_response, from_attributes=True)
408
+
409
+ def send_message(
410
+ self,
411
+ agent_id: str | None = None,
412
+ agent_name: str | None = None,
413
+ *,
414
+ params: agent_rpc_params.ParamsSendMessageRequest,
415
+ id: Union[int, str, None] | NotGiven = NOT_GIVEN,
416
+ jsonrpc: Literal["2.0"] | NotGiven = NOT_GIVEN,
417
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
418
+ # The extra values given here take precedence over values defined on the client or passed to this method.
419
+ extra_headers: Headers | None = None,
420
+ extra_query: Query | None = None,
421
+ extra_body: Body | None = None,
422
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
423
+ ) -> SendMessageResponse:
424
+ if agent_id is not None and agent_name is not None:
425
+ raise ValueError("Either agent_id or agent_name must be provided, but not both")
426
+
427
+ if "stream" in params and params["stream"] == True:
428
+ raise ValueError("If stream is set to True, use send_message_stream() instead")
429
+ else:
430
+ if agent_id is not None:
431
+ raw_agent_rpc_response = self.rpc(
432
+ agent_id=agent_id,
433
+ method="message/send",
434
+ params=params,
435
+ id=id,
436
+ jsonrpc=jsonrpc,
437
+ extra_headers=extra_headers,
438
+ extra_query=extra_query,
439
+ extra_body=extra_body,
440
+ timeout=timeout,
441
+ )
442
+ elif agent_name is not None:
443
+ raw_agent_rpc_response = self.rpc_by_name(
444
+ agent_name=agent_name,
445
+ method="message/send",
446
+ params=params,
447
+ id=id,
448
+ jsonrpc=jsonrpc,
449
+ extra_headers=extra_headers,
450
+ extra_query=extra_query,
451
+ extra_body=extra_body,
452
+ timeout=timeout,
453
+ )
454
+ else:
455
+ raise ValueError("Either agent_id or agent_name must be provided")
456
+
457
+ return SendMessageResponse.model_validate(raw_agent_rpc_response, from_attributes=True)
458
+
459
+ def send_message_stream(
460
+ self,
461
+ agent_id: str | None = None,
462
+ agent_name: str | None = None,
463
+ *,
464
+ params: agent_rpc_params.ParamsSendMessageRequest,
465
+ id: Union[int, str, None] | NotGiven = NOT_GIVEN,
466
+ jsonrpc: Literal["2.0"] | NotGiven = NOT_GIVEN,
467
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
468
+ # The extra values given here take precedence over values defined on the client or passed to this method.
469
+ extra_headers: Headers | None = None,
470
+ extra_query: Query | None = None,
471
+ extra_body: Body | None = None,
472
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
473
+ ) -> Generator[SendMessageStreamResponse, None, None]:
474
+ if agent_id is not None and agent_name is not None:
475
+ raise ValueError("Either agent_id or agent_name must be provided, but not both")
476
+
477
+ if "stream" in params and params["stream"] == False:
478
+ raise ValueError("If stream is set to False, use send_message() instead")
479
+
480
+ params["stream"] = True
481
+
482
+ if agent_id is not None:
483
+ raw_agent_rpc_response = self.with_streaming_response.rpc(
484
+ agent_id=agent_id,
485
+ method="message/send",
486
+ params=params,
487
+ id=id,
488
+ jsonrpc=jsonrpc,
489
+ extra_headers=extra_headers,
490
+ extra_query=extra_query,
491
+ extra_body=extra_body,
492
+ timeout=timeout,
493
+ )
494
+ elif agent_name is not None:
495
+ raw_agent_rpc_response = self.with_streaming_response.rpc_by_name(
496
+ agent_name=agent_name,
497
+ method="message/send",
498
+ params=params,
499
+ id=id,
500
+ jsonrpc=jsonrpc,
501
+ extra_headers=extra_headers,
502
+ extra_query=extra_query,
503
+ extra_body=extra_body,
504
+ timeout=timeout,
505
+ )
506
+ else:
507
+ raise ValueError("Either agent_id or agent_name must be provided")
508
+
509
+ with raw_agent_rpc_response as response:
510
+ for agent_rpc_response_str in response.iter_text():
511
+ if agent_rpc_response_str.strip(): # Only process non-empty lines
512
+ try:
513
+ chunk_rpc_response = SendMessageStreamResponse.model_validate(
514
+ json.loads(agent_rpc_response_str),
515
+ from_attributes=True
516
+ )
517
+ yield chunk_rpc_response
518
+ except json.JSONDecodeError:
519
+ # Skip invalid JSON lines
520
+ continue
521
+
522
+ def send_event(
523
+ self,
524
+ agent_id: str | None = None,
525
+ agent_name: str | None = None,
526
+ *,
527
+ params: agent_rpc_params.ParamsSendEventRequest,
528
+ id: Union[int, str, None] | NotGiven = NOT_GIVEN,
529
+ jsonrpc: Literal["2.0"] | NotGiven = NOT_GIVEN,
530
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
531
+ # The extra values given here take precedence over values defined on the client or passed to this method.
532
+ extra_headers: Headers | None = None,
533
+ extra_query: Query | None = None,
534
+ extra_body: Body | None = None,
535
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
536
+ ) -> SendEventResponse:
537
+ if agent_id is not None and agent_name is not None:
538
+ raise ValueError("Either agent_id or agent_name must be provided, but not both")
539
+
540
+ if agent_id is not None:
541
+ raw_agent_rpc_response = self.rpc(
542
+ agent_id=agent_id,
543
+ method="event/send",
544
+ params=params,
545
+ id=id,
546
+ jsonrpc=jsonrpc,
547
+ extra_headers=extra_headers,
548
+ extra_query=extra_query,
549
+ extra_body=extra_body,
550
+ timeout=timeout,
551
+ )
552
+ elif agent_name is not None:
553
+ raw_agent_rpc_response = self.rpc_by_name(
554
+ agent_name=agent_name,
555
+ method="event/send",
556
+ params=params,
557
+ id=id,
558
+ jsonrpc=jsonrpc,
559
+ extra_headers=extra_headers,
560
+ extra_query=extra_query,
561
+ extra_body=extra_body,
562
+ timeout=timeout,
563
+ )
564
+ else:
565
+ raise ValueError("Either agent_id or agent_name must be provided")
566
+
567
+ return SendEventResponse.model_validate(raw_agent_rpc_response, from_attributes=True)
313
568
 
314
569
 
315
570
  class AsyncAgentsResource(AsyncAPIResource):
@@ -596,7 +851,260 @@ class AsyncAgentsResource(AsyncAPIResource):
596
851
  ),
597
852
  cast_to=AgentRpcResponse,
598
853
  )
599
-
854
+
855
+ async def create_task(
856
+ self,
857
+ agent_id: str | None = None,
858
+ agent_name: str | None = None,
859
+ *,
860
+ params: agent_rpc_params.ParamsCreateTaskRequest,
861
+ id: Union[int, str, None] | NotGiven = NOT_GIVEN,
862
+ jsonrpc: Literal["2.0"] | NotGiven = NOT_GIVEN,
863
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
864
+ # The extra values given here take precedence over values defined on the client or passed to this method.
865
+ extra_headers: Headers | None = None,
866
+ extra_query: Query | None = None,
867
+ extra_body: Body | None = None,
868
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
869
+ ) -> CreateTaskResponse:
870
+ if agent_id is not None and agent_name is not None:
871
+ raise ValueError("Either agent_id or agent_name must be provided, but not both")
872
+
873
+ if agent_id is not None:
874
+ raw_agent_rpc_response = await self.rpc(
875
+ agent_id=agent_id,
876
+ method="task/create",
877
+ params=params,
878
+ id=id,
879
+ jsonrpc=jsonrpc,
880
+ extra_headers=extra_headers,
881
+ extra_query=extra_query,
882
+ extra_body=extra_body,
883
+ timeout=timeout,
884
+ )
885
+ elif agent_name is not None:
886
+ raw_agent_rpc_response = await self.rpc_by_name(
887
+ agent_name=agent_name,
888
+ method="task/create",
889
+ params=params,
890
+ id=id,
891
+ jsonrpc=jsonrpc,
892
+ extra_headers=extra_headers,
893
+ extra_query=extra_query,
894
+ extra_body=extra_body,
895
+ timeout=timeout,
896
+ )
897
+ else:
898
+ raise ValueError("Either agent_id or agent_name must be provided")
899
+
900
+ return CreateTaskResponse.model_validate(raw_agent_rpc_response, from_attributes=True)
901
+
902
+ async def cancel_task(
903
+ self,
904
+ agent_id: str | None = None,
905
+ agent_name: str | None = None,
906
+ *,
907
+ params: agent_rpc_params.ParamsCancelTaskRequest,
908
+ id: Union[int, str, None] | NotGiven = NOT_GIVEN,
909
+ jsonrpc: Literal["2.0"] | NotGiven = NOT_GIVEN,
910
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
911
+ # The extra values given here take precedence over values defined on the client or passed to this method.
912
+ extra_headers: Headers | None = None,
913
+ extra_query: Query | None = None,
914
+ extra_body: Body | None = None,
915
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
916
+ ) -> CancelTaskResponse:
917
+ if agent_id is not None and agent_name is not None:
918
+ raise ValueError("Either agent_id or agent_name must be provided, but not both")
919
+
920
+ if agent_id is not None:
921
+ raw_agent_rpc_response = await self.rpc(
922
+ agent_id=agent_id,
923
+ method="task/cancel",
924
+ params=params,
925
+ id=id,
926
+ jsonrpc=jsonrpc,
927
+ extra_headers=extra_headers,
928
+ extra_query=extra_query,
929
+ extra_body=extra_body,
930
+ timeout=timeout,
931
+ )
932
+ elif agent_name is not None:
933
+ raw_agent_rpc_response = await self.rpc_by_name(
934
+ agent_name=agent_name,
935
+ method="task/cancel",
936
+ params=params,
937
+ id=id,
938
+ jsonrpc=jsonrpc,
939
+ extra_headers=extra_headers,
940
+ extra_query=extra_query,
941
+ extra_body=extra_body,
942
+ timeout=timeout,
943
+ )
944
+ else:
945
+ raise ValueError("Either agent_id or agent_name must be provided")
946
+
947
+ return CancelTaskResponse.model_validate(raw_agent_rpc_response, from_attributes=True)
948
+
949
+ async def send_message(
950
+ self,
951
+ agent_id: str | None = None,
952
+ agent_name: str | None = None,
953
+ *,
954
+ params: agent_rpc_params.ParamsSendMessageRequest,
955
+ id: Union[int, str, None] | NotGiven = NOT_GIVEN,
956
+ jsonrpc: Literal["2.0"] | NotGiven = NOT_GIVEN,
957
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
958
+ # The extra values given here take precedence over values defined on the client or passed to this method.
959
+ extra_headers: Headers | None = None,
960
+ extra_query: Query | None = None,
961
+ extra_body: Body | None = None,
962
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
963
+ ) -> SendMessageResponse:
964
+ if agent_id is not None and agent_name is not None:
965
+ raise ValueError("Either agent_id or agent_name must be provided, but not both")
966
+
967
+ if "stream" in params and params["stream"] == True:
968
+ raise ValueError("If stream is set to True, use send_message_stream() instead")
969
+ else:
970
+ if agent_id is not None:
971
+ raw_agent_rpc_response = await self.rpc(
972
+ agent_id=agent_id,
973
+ method="message/send",
974
+ params=params,
975
+ id=id,
976
+ jsonrpc=jsonrpc,
977
+ extra_headers=extra_headers,
978
+ extra_query=extra_query,
979
+ extra_body=extra_body,
980
+ timeout=timeout,
981
+ )
982
+ elif agent_name is not None:
983
+ raw_agent_rpc_response = await self.rpc_by_name(
984
+ agent_name=agent_name,
985
+ method="message/send",
986
+ params=params,
987
+ id=id,
988
+ jsonrpc=jsonrpc,
989
+ extra_headers=extra_headers,
990
+ extra_query=extra_query,
991
+ extra_body=extra_body,
992
+ timeout=timeout,
993
+ )
994
+ else:
995
+ raise ValueError("Either agent_id or agent_name must be provided")
996
+
997
+ return SendMessageResponse.model_validate(raw_agent_rpc_response, from_attributes=True)
998
+
999
+ async def send_message_stream(
1000
+ self,
1001
+ agent_id: str | None = None,
1002
+ agent_name: str | None = None,
1003
+ *,
1004
+ params: agent_rpc_params.ParamsSendMessageRequest,
1005
+ id: Union[int, str, None] | NotGiven = NOT_GIVEN,
1006
+ jsonrpc: Literal["2.0"] | NotGiven = NOT_GIVEN,
1007
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
1008
+ # The extra values given here take precedence over values defined on the client or passed to this method.
1009
+ extra_headers: Headers | None = None,
1010
+ extra_query: Query | None = None,
1011
+ extra_body: Body | None = None,
1012
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
1013
+ ) -> AsyncGenerator[SendMessageStreamResponse, None]:
1014
+ if agent_id is not None and agent_name is not None:
1015
+ raise ValueError("Either agent_id or agent_name must be provided, but not both")
1016
+
1017
+ if "stream" in params and params["stream"] == False:
1018
+ raise ValueError("If stream is set to False, use send_message() instead")
1019
+
1020
+ params["stream"] = True
1021
+
1022
+ if agent_id is not None:
1023
+ raw_agent_rpc_response = self.with_streaming_response.rpc(
1024
+ agent_id=agent_id,
1025
+ method="message/send",
1026
+ params=params,
1027
+ id=id,
1028
+ jsonrpc=jsonrpc,
1029
+ extra_headers=extra_headers,
1030
+ extra_query=extra_query,
1031
+ extra_body=extra_body,
1032
+ timeout=timeout,
1033
+ )
1034
+ elif agent_name is not None:
1035
+ raw_agent_rpc_response = self.with_streaming_response.rpc_by_name(
1036
+ agent_name=agent_name,
1037
+ method="message/send",
1038
+ params=params,
1039
+ id=id,
1040
+ jsonrpc=jsonrpc,
1041
+ extra_headers=extra_headers,
1042
+ extra_query=extra_query,
1043
+ extra_body=extra_body,
1044
+ timeout=timeout,
1045
+ )
1046
+ else:
1047
+ raise ValueError("Either agent_id or agent_name must be provided")
1048
+
1049
+ async with raw_agent_rpc_response as response:
1050
+ async for agent_rpc_response_str in response.iter_text():
1051
+ if agent_rpc_response_str.strip(): # Only process non-empty lines
1052
+ try:
1053
+ chunk_rpc_response = SendMessageStreamResponse.model_validate(
1054
+ json.loads(agent_rpc_response_str),
1055
+ from_attributes=True
1056
+ )
1057
+ yield chunk_rpc_response
1058
+ except json.JSONDecodeError:
1059
+ # Skip invalid JSON lines
1060
+ continue
1061
+
1062
+ async def send_event(
1063
+ self,
1064
+ agent_id: str | None = None,
1065
+ agent_name: str | None = None,
1066
+ *,
1067
+ params: agent_rpc_params.ParamsSendEventRequest,
1068
+ id: Union[int, str, None] | NotGiven = NOT_GIVEN,
1069
+ jsonrpc: Literal["2.0"] | NotGiven = NOT_GIVEN,
1070
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
1071
+ # The extra values given here take precedence over values defined on the client or passed to this method.
1072
+ extra_headers: Headers | None = None,
1073
+ extra_query: Query | None = None,
1074
+ extra_body: Body | None = None,
1075
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
1076
+ ) -> SendEventResponse:
1077
+ if agent_id is not None and agent_name is not None:
1078
+ raise ValueError("Either agent_id or agent_name must be provided, but not both")
1079
+
1080
+ if agent_id is not None:
1081
+ raw_agent_rpc_response = await self.rpc(
1082
+ agent_id=agent_id,
1083
+ method="event/send",
1084
+ params=params,
1085
+ id=id,
1086
+ jsonrpc=jsonrpc,
1087
+ extra_headers=extra_headers,
1088
+ extra_query=extra_query,
1089
+ extra_body=extra_body,
1090
+ timeout=timeout,
1091
+ )
1092
+ elif agent_name is not None:
1093
+ raw_agent_rpc_response = await self.rpc_by_name(
1094
+ agent_name=agent_name,
1095
+ method="event/send",
1096
+ params=params,
1097
+ id=id,
1098
+ jsonrpc=jsonrpc,
1099
+ extra_headers=extra_headers,
1100
+ extra_query=extra_query,
1101
+ extra_body=extra_body,
1102
+ timeout=timeout,
1103
+ )
1104
+ else:
1105
+ raise ValueError("Either agent_id or agent_name must be provided")
1106
+
1107
+ return SendEventResponse.model_validate(raw_agent_rpc_response, from_attributes=True)
600
1108
 
601
1109
  class AgentsResourceWithRawResponse:
602
1110
  def __init__(self, agents: AgentsResource) -> None:
@@ -206,7 +206,7 @@ class TasksResource(SyncAPIResource):
206
206
  timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
207
207
  ) -> Stream[object]:
208
208
  """
209
- Stream events for a task by its unique ID.
209
+ Stream message updates for a task by its unique ID.
210
210
 
211
211
  Args:
212
212
  extra_headers: Send extra headers
@@ -241,7 +241,7 @@ class TasksResource(SyncAPIResource):
241
241
  timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
242
242
  ) -> Stream[object]:
243
243
  """
244
- Stream events for a task by its unique name.
244
+ Stream message updates for a task by its unique name.
245
245
 
246
246
  Args:
247
247
  extra_headers: Send extra headers
@@ -448,7 +448,7 @@ class AsyncTasksResource(AsyncAPIResource):
448
448
  timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
449
449
  ) -> AsyncStream[object]:
450
450
  """
451
- Stream events for a task by its unique ID.
451
+ Stream message updates for a task by its unique ID.
452
452
 
453
453
  Args:
454
454
  extra_headers: Send extra headers
@@ -483,7 +483,7 @@ class AsyncTasksResource(AsyncAPIResource):
483
483
  timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
484
484
  ) -> AsyncStream[object]:
485
485
  """
486
- Stream events for a task by its unique name.
486
+ Stream message updates for a task by its unique name.
487
487
 
488
488
  Args:
489
489
  extra_headers: Send extra headers
@@ -5,16 +5,44 @@ from typing_extensions import Literal
5
5
 
6
6
  from .._models import BaseModel
7
7
  from .agent_rpc_result import AgentRpcResult
8
+ from .event import Event
9
+ from .task import Task
10
+ from .task_message import TaskMessage
11
+ from .task_message_update import TaskMessageUpdate
8
12
 
9
13
  __all__ = ["AgentRpcResponse"]
10
14
 
11
15
 
12
- class AgentRpcResponse(BaseModel):
16
+ class BaseAgentRpcResponse(BaseModel):
17
+ id: Union[int, str, None] = None
18
+ error: Optional[object] = None
19
+ jsonrpc: Optional[Literal["2.0"]] = None
20
+
21
+
22
+ class AgentRpcResponse(BaseAgentRpcResponse):
13
23
  result: Optional[AgentRpcResult] = None
14
24
  """The result of the agent RPC request"""
15
25
 
16
- id: Union[int, str, None] = None
17
26
 
18
- error: Optional[object] = None
27
+ class CreateTaskResponse(BaseAgentRpcResponse):
28
+ result: Task
29
+ """The result of the task creation"""
19
30
 
20
- jsonrpc: Optional[Literal["2.0"]] = None
31
+
32
+ class CancelTaskResponse(BaseAgentRpcResponse):
33
+ result: Task
34
+ """The result of the task cancellation"""
35
+
36
+
37
+ class SendMessageResponse(BaseAgentRpcResponse):
38
+ result: list[TaskMessage]
39
+ """The result of the message sending"""
40
+
41
+ class SendMessageStreamResponse(BaseAgentRpcResponse):
42
+ result: TaskMessageUpdate
43
+ """The result of the message sending"""
44
+
45
+
46
+ class SendEventResponse(BaseAgentRpcResponse):
47
+ result: Event
48
+ """The result of the event sending"""
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: agentex-sdk
3
- Version: 0.2.1
3
+ Version: 0.2.2
4
4
  Summary: The official Python library for the agentex API
5
5
  Project-URL: Homepage, https://github.com/scaleapi/agentex-python
6
6
  Project-URL: Repository, https://github.com/scaleapi/agentex-python
@@ -11,7 +11,7 @@ agentex/_resource.py,sha256=S1t7wmR5WUvoDIhZjo_x-E7uoTJBynJ3d8tPJMQYdjw,1106
11
11
  agentex/_response.py,sha256=Tb9zazsnemO2rTxWtBjAD5WBqlhli5ZaXGbiKgdu5DE,28794
12
12
  agentex/_streaming.py,sha256=FNGJExRCF-vTRUZHFKUfoAWFhDGOB3XbioVCF37Jr7E,10104
13
13
  agentex/_types.py,sha256=KyKYySGIfHPod2hho1fPxssk5NuVn8C4MeMTtA-lg80,6198
14
- agentex/_version.py,sha256=FS15FaZ9bBn3jU7AoPIcXle_LlEcQ7SKHwog2bYuba0,159
14
+ agentex/_version.py,sha256=9l4awzDo0H4hmmCOlgavow683f4hzG__e6Tv4BF93Lw,159
15
15
  agentex/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
16
16
  agentex/_utils/__init__.py,sha256=PNZ_QJuzZEgyYXqkO1HVhGkj5IU9bglVUcw7H-Knjzw,2062
17
17
  agentex/_utils/_logs.py,sha256=LUjFPc3fweSChBUmjhQD8uYmwQAmFMNDuVFKfjYBQfM,777
@@ -29,15 +29,15 @@ agentex/lib/environment_variables.py,sha256=FbJ-tm_thJs5Fv1q4-oY4CED4DNlwCeu3v4x
29
29
  agentex/lib/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
30
30
  agentex/lib/adk/__init__.py,sha256=-PpVfEvYr_HD7TnxUWU8RCW2OnxfwpPxTW97dKTnqvI,1082
31
31
  agentex/lib/adk/_modules/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
32
- agentex/lib/adk/_modules/acp.py,sha256=0cNsHYCMvMA6GfWpPg4SSbBTFLP8PPx_SXZIoizswUU,8934
33
- agentex/lib/adk/_modules/agent_task_tracker.py,sha256=B6Rwh-_rHzCJrTVWcteVT9l1acSj9WJtQ6NhLgJ9now,6929
34
- agentex/lib/adk/_modules/agents.py,sha256=Rhv2hf2eADfsmSj3Y2CBgoGLfsavgyv14_6cMK_qUJY,2695
35
- agentex/lib/adk/_modules/events.py,sha256=FxJHmENDBzYIcXtWuuDp86tLxbffLGju3qbVih2an_s,5169
36
- agentex/lib/adk/_modules/messages.py,sha256=vYJ4i-69aOYXf-9phN_fMEtqwvp5HL9cW1Kf2vpRxEs,10543
37
- agentex/lib/adk/_modules/state.py,sha256=F4svy-QPVKs0xfb6lz9eMKpb6ibbdUK2thwv94wuL4Y,10637
38
- agentex/lib/adk/_modules/streaming.py,sha256=XpLvIz-MA_SDOw-sIuPS8hFhN-jaGcOxN-LEd1F9pDg,3002
39
- agentex/lib/adk/_modules/tasks.py,sha256=ch-EFsVdc9bkU2tQMm30JVZUlP48ai7pKIOhUkPPABw,4127
40
- agentex/lib/adk/_modules/tracing.py,sha256=sNpG7WNMdWpscjUMGFFthJ1gqxm0_gOkf2yrMulcliM,7251
32
+ agentex/lib/adk/_modules/acp.py,sha256=0D9HLwBO3SX4eEsx1BY9G90jyvTABmaxdOzANg1rmzQ,9027
33
+ agentex/lib/adk/_modules/agent_task_tracker.py,sha256=fXMDs1zgAC6n8EmWTU5_trs79EGVBCEPxd5eBOZmdE0,7022
34
+ agentex/lib/adk/_modules/agents.py,sha256=VlT_PXnyb3Knh-nx1rfflD9N6gjp5O0_6Z_QL5SCThU,2788
35
+ agentex/lib/adk/_modules/events.py,sha256=RHQZ4ircC60zdm1chRzo3cdt7LNqDoJfPLNJXEz4BH0,5262
36
+ agentex/lib/adk/_modules/messages.py,sha256=1LxexTBif7HXltN3b1u6A5upXuXuq6ZkFAdIrbSv2zo,10636
37
+ agentex/lib/adk/_modules/state.py,sha256=z2Zh1JB3qJo-4BsVABnFZIeDWWKQDbcOw6itl0hU_E4,10730
38
+ agentex/lib/adk/_modules/streaming.py,sha256=lbRQBmySsx63wKiHeR5ueNW_6DJckCNStQ0wQynC4r4,3095
39
+ agentex/lib/adk/_modules/tasks.py,sha256=q3IBdnwVXrv9Ht7z4jkm8RWOpzU9n3VKgrX3FTNXSZ8,4220
40
+ agentex/lib/adk/_modules/tracing.py,sha256=A_kH332f_DFVfMftPHGEg3oi4RFcwDXohg7xtvWUuTY,7344
41
41
  agentex/lib/adk/providers/__init__.py,sha256=KPWC8AYsl8lPgpFoRXlGwzozb-peKLAzV_DcTWXBsz4,306
42
42
  agentex/lib/adk/providers/_modules/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
43
43
  agentex/lib/adk/providers/_modules/litellm.py,sha256=YUHZ_m0kL9wEG5pX9x4BeyioiDjOa2anCWk6uo6-vqQ,9393
@@ -45,6 +45,7 @@ agentex/lib/adk/providers/_modules/openai.py,sha256=h7G3y4Gd2wF3XuYEi_aQXORxZhtH
45
45
  agentex/lib/adk/providers/_modules/sgp.py,sha256=Me5TeU7OPjPBVeEw7a-DQnYcJ3fbGi3liYbuW5CGiLE,3131
46
46
  agentex/lib/adk/utils/__init__.py,sha256=7f6ayV0_fqyw5cwzVANNcZWGJZ-vrrYtZ0qi7KKBRFs,130
47
47
  agentex/lib/adk/utils/_modules/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
48
+ agentex/lib/adk/utils/_modules/client.py,sha256=ujttuam5Kd0CRcbsI1BLrQ7dhcAP68xaXyWXx34imR0,357
48
49
  agentex/lib/adk/utils/_modules/templating.py,sha256=YPm2bY_iBv9jWf0lncRGUpBZyq_QHBCRlM-XbHjauRc,3502
49
50
  agentex/lib/cli/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
50
51
  agentex/lib/cli/commands/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -64,7 +65,7 @@ agentex/lib/cli/templates/default/.dockerignore.j2,sha256=hweGFxw5eDZYsb5EnRHpv2
64
65
  agentex/lib/cli/templates/default/Dockerfile-uv.j2,sha256=tGJo_C4vwHYikV4QhGFtSiG6K7Nt4UDdJ71Gob_uTho,1109
65
66
  agentex/lib/cli/templates/default/Dockerfile.j2,sha256=T7ouO3glVBo7U2I1TPQvgARyxXGL194cvM5hfbq0e8U,1119
66
67
  agentex/lib/cli/templates/default/README.md.j2,sha256=4Sn_cY_TMfN_c5h-I_L3TgTrNKUvhzQvKGDZjS3n2Gw,6361
67
- agentex/lib/cli/templates/default/dev.ipynb.j2,sha256=m0gu1WIGqVz5QUOl7AI6eWKXrhX_jIZOJ5HcuC8oK8s,3494
68
+ agentex/lib/cli/templates/default/dev.ipynb.j2,sha256=8xY82gVfQ0mhzlEZzI4kLqIXCF19YgimLnpEirDMX8I,3395
68
69
  agentex/lib/cli/templates/default/manifest.yaml.j2,sha256=n-XK6LqSyBVY6a7KOfIlOQx4LbMNEVzzHIh6yEiqAhs,3752
69
70
  agentex/lib/cli/templates/default/pyproject.toml.j2,sha256=9cpTISM7rOoICWejV5GYMEwPn8RUmB6-E7csM1pmSFo,528
70
71
  agentex/lib/cli/templates/default/requirements.txt.j2,sha256=iTmO-z8qFkUa1jTctFCs0WYuq7Sqi6VNQAwATakh2fQ,94
@@ -76,7 +77,7 @@ agentex/lib/cli/templates/sync/.dockerignore.j2,sha256=hweGFxw5eDZYsb5EnRHpv27o9
76
77
  agentex/lib/cli/templates/sync/Dockerfile-uv.j2,sha256=tGJo_C4vwHYikV4QhGFtSiG6K7Nt4UDdJ71Gob_uTho,1109
77
78
  agentex/lib/cli/templates/sync/Dockerfile.j2,sha256=T7ouO3glVBo7U2I1TPQvgARyxXGL194cvM5hfbq0e8U,1119
78
79
  agentex/lib/cli/templates/sync/README.md.j2,sha256=_S7Ngl4qOUQHPFldLXDBvuIWPFU2-WcuxGmr5EXLX6k,8816
79
- agentex/lib/cli/templates/sync/dev.ipynb.j2,sha256=1kYOPA1xvhyyBUiEndh-iBtTRKrxY5h-MWwRo_Z-cRc,7042
80
+ agentex/lib/cli/templates/sync/dev.ipynb.j2,sha256=Z42iRveuI_k5LcJqWX-3H1glPtNTkxg_MKVe1lwuJos,6055
80
81
  agentex/lib/cli/templates/sync/manifest.yaml.j2,sha256=V497KXzvA76sHrgIJ5zRJptpIH8sGbSXZaIsEyp5NZ4,3747
81
82
  agentex/lib/cli/templates/sync/pyproject.toml.j2,sha256=9cpTISM7rOoICWejV5GYMEwPn8RUmB6-E7csM1pmSFo,528
82
83
  agentex/lib/cli/templates/sync/requirements.txt.j2,sha256=iTmO-z8qFkUa1jTctFCs0WYuq7Sqi6VNQAwATakh2fQ,94
@@ -86,7 +87,7 @@ agentex/lib/cli/templates/temporal/.dockerignore.j2,sha256=hweGFxw5eDZYsb5EnRHpv
86
87
  agentex/lib/cli/templates/temporal/Dockerfile-uv.j2,sha256=bnvx-zba5DFjl7UC-TYt-Zi_UDJucjlNRCdkSqHgBiQ,1450
87
88
  agentex/lib/cli/templates/temporal/Dockerfile.j2,sha256=pcszlprNTqKMpYEtA4XYlc3vWjq1b0IMQDrN1GxF7yI,1461
88
89
  agentex/lib/cli/templates/temporal/README.md.j2,sha256=d6BQAZBf7lCKROXnpDu-Ml1Rq0OM8cCFEOpmStoPWfc,10132
89
- agentex/lib/cli/templates/temporal/dev.ipynb.j2,sha256=m0gu1WIGqVz5QUOl7AI6eWKXrhX_jIZOJ5HcuC8oK8s,3494
90
+ agentex/lib/cli/templates/temporal/dev.ipynb.j2,sha256=8xY82gVfQ0mhzlEZzI4kLqIXCF19YgimLnpEirDMX8I,3395
90
91
  agentex/lib/cli/templates/temporal/manifest.yaml.j2,sha256=S-hJlpVCnT62r66otqHa3iROOn1w_yYvehOOxvLQotY,4483
91
92
  agentex/lib/cli/templates/temporal/pyproject.toml.j2,sha256=hBZgFBkgdQ4x7lfmmUXuUL10ER11ojaDp_swnrg26Vo,546
92
93
  agentex/lib/cli/templates/temporal/requirements.txt.j2,sha256=iTmO-z8qFkUa1jTctFCs0WYuq7Sqi6VNQAwATakh2fQ,94
@@ -176,7 +177,7 @@ agentex/lib/sdk/config/local_development_config.py,sha256=b1AZsOVo1RoHKbk8Nm5nC8
176
177
  agentex/lib/sdk/config/project_config.py,sha256=CGH_r9KbnSFMj2CnBkZnfg41L2o0TeVNz6MwBDKPT_U,3642
177
178
  agentex/lib/sdk/fastacp/__init__.py,sha256=UvAdexdnfb4z0F4a2sfXROFyh9EjH89kf3AxHPybzCM,75
178
179
  agentex/lib/sdk/fastacp/fastacp.py,sha256=K4D7a9EiJfCgWp2hrE_TbpZBaF4Uc46MfndZK3F9mA0,3061
179
- agentex/lib/sdk/fastacp/base/base_acp_server.py,sha256=gsbBb8-zNu991vTh6_f5KjR_NC8Knoyy1YTsPAPN2KQ,17066
180
+ agentex/lib/sdk/fastacp/base/base_acp_server.py,sha256=60xo9GGe4vfb2Sj2Oi_BzjrnBVTjhBYnmhKyNHUc2zg,17524
180
181
  agentex/lib/sdk/fastacp/impl/agentic_base_acp.py,sha256=fWLX9_mxmX502EBXoymUz1Tu1vEppshS48-aOSpuvlM,2600
181
182
  agentex/lib/sdk/fastacp/impl/sync_acp.py,sha256=8FEDfBxI31NoVLX9nyckQ8QwA0UV4svC3fhGKgXBIwk,3862
182
183
  agentex/lib/sdk/fastacp/impl/temporal_acp.py,sha256=ZLqjzBBVrXJCXD2bFlrcDkFvpsXZp3thC2rTwZ6xNaY,3737
@@ -220,11 +221,11 @@ agentex/lib/utils/temporal.py,sha256=sXo8OPMMXiyrF7OSBCJBuN_ufyQOD2bLOXgDbVZoyds
220
221
  agentex/lib/utils/dev_tools/__init__.py,sha256=oaHxw6ymfhNql-kzXHv3NWVHuqD4fHumasNXJG7kHTU,261
221
222
  agentex/lib/utils/dev_tools/async_messages.py,sha256=-alUK1KFltcRb6xtRtIJIRJW9Sf1FwDRgaNPhOn-luw,18105
222
223
  agentex/resources/__init__.py,sha256=74rMqWBzQ2dSrKQqsrd7-jskPws0O_ogkFltvZO3HoU,3265
223
- agentex/resources/agents.py,sha256=fLXbcSKVB3nvPyhvOMil140Tg3Iqfk3MCQnHKswsEOo,26621
224
+ agentex/resources/agents.py,sha256=ibt5SXgcpwIsRJ9BFptfQyqapHZCKQsKGpcKnWcX0vI,46605
224
225
  agentex/resources/events.py,sha256=Zc9JhUm3bq2VFnBAolC0M7KZernzj1AjZ_vj0ibP4GY,10412
225
226
  agentex/resources/spans.py,sha256=wmcUs4XbXIF5rPeyU_f39c2RTbTLnkuh2LYogZEBD6s,20936
226
227
  agentex/resources/states.py,sha256=O31A8--n7n0rHsng2e1oCUAzLNjQIxDUk7rq0IXfgGM,19262
227
- agentex/resources/tasks.py,sha256=Nw-pb0ZFSGGMir4t9R_zSLsV8SsdCdnmTubcFDQN2hY,23292
228
+ agentex/resources/tasks.py,sha256=NSVPPS2sZGzMTHxuKAvFeV_5EqsM54t1uLOMzqpZayo,23328
228
229
  agentex/resources/tracker.py,sha256=YxSeiloMwIqrS9nY7SlHclauRA7142qrKw34xgwqYbA,14103
229
230
  agentex/resources/messages/__init__.py,sha256=_J1eusFtr_k6zrAntJSuqx6LWEUBSTrV1OZZh7MaDPE,1015
230
231
  agentex/resources/messages/batch.py,sha256=pegCmnjK_J0jek5ChX1pKpq5RmCucTYLbK69H6qGVS4,9629
@@ -236,7 +237,7 @@ agentex/types/agent_list_params.py,sha256=81IWnRZ2rLfHH7GB6VkXShYjb44DO0guG1znJc
236
237
  agentex/types/agent_list_response.py,sha256=g0b9Cw7j2yk14veyJORpF3me8iW7g7pr2USpXGokoFI,254
237
238
  agentex/types/agent_rpc_by_name_params.py,sha256=G6xkjrZKPmJvhwqgc68tAnzmb4wYh9k0zlcm9CsLQR0,2024
238
239
  agentex/types/agent_rpc_params.py,sha256=qkwICON3v6AIE8J2oN1483K_jmGueBYGkVg2W9EUJK0,2012
239
- agentex/types/agent_rpc_response.py,sha256=xqdq6apfdaPTT5f8x1Q5z19UETI5AjVMzEIIvAHEZw8,517
240
+ agentex/types/agent_rpc_response.py,sha256=dYvtwXzznZZmpJzX8e5pAW3Cm5m8qXE5-QN6Eb1cZNI,1288
240
241
  agentex/types/agent_rpc_result.py,sha256=Sx_DKdM9vCZs7uvWo6H0L9PxU6Je0IYw04T4BwOvVYU,2265
241
242
  agentex/types/agent_task_tracker.py,sha256=JK1kmQ7LIx1eWC-XaU2pJcIvdtQCmEn21dsJTxglAYA,803
242
243
  agentex/types/data_content.py,sha256=BxJrovgQUCvPP2ac3KTQdErbdDpkZSIbLZhJ4nEDyZE,786
@@ -287,8 +288,8 @@ agentex/types/messages/batch_create_params.py,sha256=trUV75ntEVnxYhd1FIWub6dHBaN
287
288
  agentex/types/messages/batch_create_response.py,sha256=yaSLTw2MWWpHF23BGO1Xy9js38_7EIqHAuiLha8VSfc,278
288
289
  agentex/types/messages/batch_update_params.py,sha256=Ug5CThbD49a8j4qucg04OdmVrp_gApgpw0hg6NLsR3g,433
289
290
  agentex/types/messages/batch_update_response.py,sha256=TbSBe6SuPzjXXWSj-nRjT1JHGBooTshHQQDa1AixQA8,278
290
- agentex_sdk-0.2.1.dist-info/METADATA,sha256=61uoi5QRrVlFQnrM66ChrdTULQz6U_q0HwEJq07CPv8,14110
291
- agentex_sdk-0.2.1.dist-info/WHEEL,sha256=C2FUgwZgiLbznR-k0b_5k3Ai_1aASOXDss3lzCUsUug,87
292
- agentex_sdk-0.2.1.dist-info/entry_points.txt,sha256=V7vJuMZdF0UlvgX6KiBN7XUvq_cxF5kplcYvc1QlFaQ,62
293
- agentex_sdk-0.2.1.dist-info/licenses/LICENSE,sha256=Q1AOx2FtRcMlyMgQJ9eVN2WKPq2mQ33lnB4tvWxabLA,11337
294
- agentex_sdk-0.2.1.dist-info/RECORD,,
291
+ agentex_sdk-0.2.2.dist-info/METADATA,sha256=WHWvOaMDaUS5QYUJ3PiQaU1uH2zvw7PP2IzpoxoyHYg,14110
292
+ agentex_sdk-0.2.2.dist-info/WHEEL,sha256=C2FUgwZgiLbznR-k0b_5k3Ai_1aASOXDss3lzCUsUug,87
293
+ agentex_sdk-0.2.2.dist-info/entry_points.txt,sha256=V7vJuMZdF0UlvgX6KiBN7XUvq_cxF5kplcYvc1QlFaQ,62
294
+ agentex_sdk-0.2.2.dist-info/licenses/LICENSE,sha256=Q1AOx2FtRcMlyMgQJ9eVN2WKPq2mQ33lnB4tvWxabLA,11337
295
+ agentex_sdk-0.2.2.dist-info/RECORD,,