Skip to content

Commit f1a2aa9

Browse files
committed
merge
2 parents 6a8eac0 + 41d79d9 commit f1a2aa9

File tree

59 files changed

+3611
-405
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

59 files changed

+3611
-405
lines changed

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
.prism.log
2-
.vscode
32
_dev
43

54
__pycache__

.release-please-manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
{
2-
".": "0.1.0-alpha.5"
2+
".": "0.2.3"
33
}

.stats.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
configured_endpoints: 34
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/sgp%2Fagentex-sdk-1d08fb2290b5310c91801d7575d356628d372fd5434e15d3b9cead48eadb893f.yml
3-
openapi_spec_hash: c07c588fb8429fbf024189df62f20fa4
4-
config_hash: 2e4b423af3db79ebd8170c401ea9093a
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/sgp%2Fagentex-sdk-ed22476258be08ff765c68dcb29c08baf3e4783c98edac50d1e8003e9487db37.yml
3+
openapi_spec_hash: d4010bb4bf479073328ca00be01a7b96
4+
config_hash: 7c1f6794a184ee175dd94f2f7c2b496b

.vscode/settings.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"python.analysis.importFormat": "relative",
3+
}

CHANGELOG.md

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,62 @@
11
# Changelog
22

3+
## 0.2.3 (2025-07-29)
4+
5+
Full Changelog: [v0.2.2...v0.2.3](https://github.com/scaleapi/agentex-python/compare/v0.2.2...v0.2.3)
6+
7+
## 0.2.2 (2025-07-28)
8+
9+
Full Changelog: [v0.2.1...v0.2.2](https://github.com/scaleapi/agentex-python/compare/v0.2.1...v0.2.2)
10+
11+
### Features
12+
13+
* **api:** api update ([eb79533](https://github.com/scaleapi/agentex-python/commit/eb79533dd041b7fccccc6a75abedd0c87e9c55e5))
14+
15+
## 0.2.1 (2025-07-27)
16+
17+
Full Changelog: [v0.2.0...v0.2.1](https://github.com/scaleapi/agentex-python/compare/v0.2.0...v0.2.1)
18+
19+
## 0.2.0 (2025-07-25)
20+
21+
Full Changelog: [v0.1.1...v0.2.0](https://github.com/scaleapi/agentex-python/compare/v0.1.1...v0.2.0)
22+
23+
### Features
24+
25+
* **api:** update typescript sdk with big changes ([2c75d64](https://github.com/scaleapi/agentex-python/commit/2c75d642348df727505778c347efa568930ea4f0))
26+
27+
28+
### Chores
29+
30+
* **project:** add settings file for vscode ([0f926cc](https://github.com/scaleapi/agentex-python/commit/0f926cce7df375de33627f8212caacf64f89b1ed))
31+
32+
## 0.1.1 (2025-07-24)
33+
34+
Full Changelog: [v0.1.0...v0.1.1](https://github.com/scaleapi/agentex-python/compare/v0.1.0...v0.1.1)
35+
36+
### Features
37+
38+
* **api:** manual updates ([714e97e](https://github.com/scaleapi/agentex-python/commit/714e97ed1813a4a91b421fb77fadaf2afac2450d))
39+
* **api:** manual updates ([8dccfbd](https://github.com/scaleapi/agentex-python/commit/8dccfbdd9b8b887bfb99c79a9a28163215560ae4))
40+
* **api:** manual updates ([03af884](https://github.com/scaleapi/agentex-python/commit/03af884e31a3df4d42a863c06c5ab4dfc2374374))
41+
42+
## 0.1.0 (2025-07-23)
43+
44+
Full Changelog: [v0.1.0-alpha.6...v0.1.0](https://github.com/scaleapi/agentex-python/compare/v0.1.0-alpha.6...v0.1.0)
45+
46+
### Features
47+
48+
* **api:** manual updates ([84010e4](https://github.com/scaleapi/agentex-python/commit/84010e4adecf7c779abd9a828000a3b50d9d3ac3))
49+
50+
## 0.1.0-alpha.6 (2025-07-23)
51+
52+
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)
53+
54+
### Features
55+
56+
* **api:** api update ([af18034](https://github.com/scaleapi/agentex-python/commit/af18034e4173794ebf42eff688f26d64caca4e64))
57+
* **api:** api update ([be9b603](https://github.com/scaleapi/agentex-python/commit/be9b60326817566d5c5edcbd7b7babb6db07e539))
58+
* **api:** manual updates ([bbe3be3](https://github.com/scaleapi/agentex-python/commit/bbe3be30aa9fb8d7a677f0e9f0be4dd565563d6e))
59+
360
## 0.1.0-alpha.5 (2025-07-23)
461

562
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)

README.md

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Agentex Python API library
22

33
<!-- prettier-ignore -->
4-
[![PyPI version](https://img.shields.io/pypi/v/agentex.svg?label=pypi%20(stable))](https://pypi.org/project/agentex/)
4+
[![PyPI version](https://img.shields.io/pypi/v/agentex-sdk.svg?label=pypi%20(stable))](https://pypi.org/project/agentex-sdk/)
55

66
The Agentex Python library provides convenient access to the Agentex REST API from any Python 3.8+
77
application. The library includes type definitions for all request params and response fields,
@@ -16,13 +16,10 @@ The full API of this library can be found in [api.md](api.md).
1616
## Installation
1717

1818
```sh
19-
# install from the production repo
20-
pip install git+ssh://[email protected]/scaleapi/agentex-python.git
19+
# install from PyPI
20+
pip install agentex-sdk
2121
```
2222

23-
> [!NOTE]
24-
> Once this package is [published to PyPI](https://www.stainless.com/docs/guides/publish), this will become: `pip install --pre agentex`
25-
2623
## Usage
2724

2825
The full API of this library can be found in [api.md](api.md).
@@ -77,8 +74,8 @@ By default, the async client uses `httpx` for HTTP requests. However, for improv
7774
You can enable this by installing `aiohttp`:
7875

7976
```sh
80-
# install from the production repo
81-
pip install 'agentex[aiohttp] @ git+ssh://[email protected]/scaleapi/agentex-python.git'
77+
# install from PyPI
78+
pip install agentex-sdk[aiohttp]
8279
```
8380

8481
Then you can enable it by instantiating the client with `http_client=DefaultAioHttpClient()`:

api.md

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,3 @@
1-
# Shared Types
2-
3-
```python
4-
from agentex.types import TaskMessageUpdate
5-
```
6-
71
# Agents
82

93
Types:
@@ -12,7 +6,6 @@ Types:
126
from agentex.types import (
137
AcpType,
148
Agent,
15-
AgentRpcParams,
169
AgentRpcRequest,
1710
AgentRpcResponse,
1811
AgentRpcResult,
@@ -42,15 +35,15 @@ Methods:
4235
Types:
4336

4437
```python
45-
from agentex.types import Task, TaskListResponse
38+
from agentex.types import Task, TaskListResponse, TaskDeleteResponse, TaskDeleteByNameResponse
4639
```
4740

4841
Methods:
4942

5043
- <code title="get /tasks/{task_id}">client.tasks.<a href="./src/agentex/resources/tasks.py">retrieve</a>(task_id) -> <a href="./src/agentex/types/task.py">Task</a></code>
5144
- <code title="get /tasks">client.tasks.<a href="./src/agentex/resources/tasks.py">list</a>() -> <a href="./src/agentex/types/task_list_response.py">TaskListResponse</a></code>
52-
- <code title="delete /tasks/{task_id}">client.tasks.<a href="./src/agentex/resources/tasks.py">delete</a>(task_id) -> <a href="./src/agentex/types/task.py">Task</a></code>
53-
- <code title="delete /tasks/name/{task_name}">client.tasks.<a href="./src/agentex/resources/tasks.py">delete_by_name</a>(task_name) -> <a href="./src/agentex/types/task.py">Task</a></code>
45+
- <code title="delete /tasks/{task_id}">client.tasks.<a href="./src/agentex/resources/tasks.py">delete</a>(task_id) -> <a href="./src/agentex/types/task_delete_response.py">TaskDeleteResponse</a></code>
46+
- <code title="delete /tasks/name/{task_name}">client.tasks.<a href="./src/agentex/resources/tasks.py">delete_by_name</a>(task_name) -> <a href="./src/agentex/types/task_delete_by_name_response.py">TaskDeleteByNameResponse</a></code>
5447
- <code title="get /tasks/name/{task_name}">client.tasks.<a href="./src/agentex/resources/tasks.py">retrieve_by_name</a>(task_name) -> <a href="./src/agentex/types/task.py">Task</a></code>
5548
- <code title="get /tasks/{task_id}/stream">client.tasks.<a href="./src/agentex/resources/tasks.py">stream_events</a>(task_id) -> object</code>
5649
- <code title="get /tasks/name/{task_name}/stream">client.tasks.<a href="./src/agentex/resources/tasks.py">stream_events_by_name</a>(task_name) -> object</code>
Lines changed: 159 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,159 @@
1+
{
2+
"cells": [
3+
{
4+
"cell_type": "code",
5+
"execution_count": null,
6+
"id": "0",
7+
"metadata": {},
8+
"outputs": [],
9+
"source": [
10+
"from agentex import Agentex\n",
11+
"\n",
12+
"client = Agentex(base_url=\"http://localhost:5003\")"
13+
]
14+
},
15+
{
16+
"cell_type": "code",
17+
"execution_count": null,
18+
"id": "1",
19+
"metadata": {},
20+
"outputs": [],
21+
"source": [
22+
"AGENT_NAME = \"s000-hello-acp\""
23+
]
24+
},
25+
{
26+
"cell_type": "code",
27+
"execution_count": null,
28+
"id": "2",
29+
"metadata": {},
30+
"outputs": [],
31+
"source": [
32+
"# # (Optional) Create a new task. If you don't create a new task, each message will be sent to a new task. The server will create the task for you.\n",
33+
"\n",
34+
"# import uuid\n",
35+
"\n",
36+
"# TASK_ID = str(uuid.uuid4())[:8]\n",
37+
"\n",
38+
"# rpc_response = client.agents.rpc_by_name(\n",
39+
"# agent_name=AGENT_NAME,\n",
40+
"# method=\"task/create\",\n",
41+
"# params={\n",
42+
"# \"name\": f\"{TASK_ID}-task\",\n",
43+
"# \"params\": {}\n",
44+
"# }\n",
45+
"# )\n",
46+
"\n",
47+
"# task = rpc_response.result\n",
48+
"# print(task)"
49+
]
50+
},
51+
{
52+
"cell_type": "code",
53+
"execution_count": null,
54+
"id": "3",
55+
"metadata": {},
56+
"outputs": [],
57+
"source": [
58+
"# Test non streaming response\n",
59+
"from agentex.types import TextContent\n",
60+
"\n",
61+
"# The response is expected to be a list of TaskMessage objects, which is a union of the following types:\n",
62+
"# - TextContent: A message with just text content \n",
63+
"# - DataContent: A message with JSON-serializable data content\n",
64+
"# - ToolRequestContent: A message with a tool request, which contains a JSON-serializable request to call a tool\n",
65+
"# - ToolResponseContent: A message with a tool response, which contains response object from a tool call in its content\n",
66+
"\n",
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",
68+
"\n",
69+
"rpc_response = client.agents.send_message(\n",
70+
" agent_name=AGENT_NAME,\n",
71+
" params={\n",
72+
" \"content\": {\"type\": \"text\", \"author\": \"user\", \"content\": \"Hello what can you do?\"},\n",
73+
" \"stream\": False\n",
74+
" }\n",
75+
")\n",
76+
"\n",
77+
"if not rpc_response or not rpc_response.result:\n",
78+
" raise ValueError(\"No result in response\")\n",
79+
"\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"
86+
]
87+
},
88+
{
89+
"cell_type": "code",
90+
"execution_count": null,
91+
"id": "4",
92+
"metadata": {},
93+
"outputs": [],
94+
"source": [
95+
"# Test streaming response\n",
96+
"from agentex.types.task_message_update import StreamTaskMessageDelta, StreamTaskMessageFull\n",
97+
"from agentex.types.text_delta import TextDelta\n",
98+
"\n",
99+
"\n",
100+
"# The result object of message/send will be a TaskMessageUpdate which is a union of the following types:\n",
101+
"# - StreamTaskMessageStart: \n",
102+
"# - An indicator that a streaming message was started, doesn't contain any useful content\n",
103+
"# - StreamTaskMessageDelta: \n",
104+
"# - A delta of a streaming message, contains the text delta to aggregate\n",
105+
"# - StreamTaskMessageDone: \n",
106+
"# - An indicator that a streaming message was done, doesn't contain any useful content\n",
107+
"# - StreamTaskMessageFull: \n",
108+
"# - A non-streaming message, there is nothing to aggregate, since this contains the full message, not deltas\n",
109+
"\n",
110+
"# Whenn processing StreamTaskMessageDelta, if you are expecting more than TextDeltas, such as DataDelta, ToolRequestDelta, or ToolResponseDelta, you can process them as well\n",
111+
"# Whenn processing StreamTaskMessageFull, if you are expecting more than TextContent, such as DataContent, ToolRequestContent, or ToolResponseContent, you can process them as well\n",
112+
"\n",
113+
"for agent_rpc_response_chunk in client.agents.send_message_stream(\n",
114+
" agent_name=AGENT_NAME,\n",
115+
" params={\n",
116+
" \"content\": {\"type\": \"text\", \"author\": \"user\", \"content\": \"Hello what can you do?\"},\n",
117+
" \"stream\": True\n",
118+
" }\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"
135+
]
136+
}
137+
],
138+
"metadata": {
139+
"kernelspec": {
140+
"display_name": ".venv",
141+
"language": "python",
142+
"name": "python3"
143+
},
144+
"language_info": {
145+
"codemirror_mode": {
146+
"name": "ipython",
147+
"version": 3
148+
},
149+
"file_extension": ".py",
150+
"mimetype": "text/x-python",
151+
"name": "python",
152+
"nbconvert_exporter": "python",
153+
"pygments_lexer": "ipython3",
154+
"version": "3.12.9"
155+
}
156+
},
157+
"nbformat": 4,
158+
"nbformat_minor": 5
159+
}

0 commit comments

Comments
 (0)