Skip to content

Commit 66fcf0c

Browse files
authored
Merge pull request #13 from scaleapi/release-please--branches--main--changes--next
release: 0.1.0-alpha.5
2 parents 269f72f + fd45106 commit 66fcf0c

37 files changed

+732
-363
lines changed

.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.4"
2+
".": "0.1.0-alpha.5"
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-021b55c88964b7a5bfc9d692d32a52c6b0150445656d2407c4cb8e9dd1e5f100.yml
3-
openapi_spec_hash: ed92c0d5d6bed9cb5617f8a776ac42c9
4-
config_hash: 7661726e3cccf9f6349179841153601d
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

CHANGELOG.md

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

3+
## 0.1.0-alpha.5 (2025-07-23)
4+
5+
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)
6+
7+
### Features
8+
9+
* **api:** deprecate name subresource ([14881c0](https://github.com/scaleapi/agentex-python/commit/14881c0ff2922e0a622975a0f5b314de99d7aabb))
10+
* **api:** manual updates ([d999a43](https://github.com/scaleapi/agentex-python/commit/d999a438c409f04b7e36b5df2d9b080d1d1b0e4a))
11+
* **api:** manual updates ([a885d8d](https://github.com/scaleapi/agentex-python/commit/a885d8dbabfe2cc2a556ef02e75e5502fd799c46))
12+
13+
14+
### Bug Fixes
15+
16+
* **api:** build errors ([7bde6b7](https://github.com/scaleapi/agentex-python/commit/7bde6b727d6d16ebd6805ef843596fc3224445a6))
17+
* **parsing:** parse extra field types ([d40e6e0](https://github.com/scaleapi/agentex-python/commit/d40e6e0d6911be0bc9bfc419e02bd7c1d5ad5be4))
18+
319
## 0.1.0-alpha.4 (2025-07-22)
420

521
Full Changelog: [v0.1.0-alpha.3...v0.1.0-alpha.4](https://github.com/scaleapi/agentex-python/compare/v0.1.0-alpha.3...v0.1.0-alpha.4)

README.md

Lines changed: 15 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -28,17 +28,16 @@ pip install git+ssh://[email protected]/scaleapi/agentex-python.git
2828
The full API of this library can be found in [api.md](api.md).
2929

3030
```python
31+
import os
3132
from agentex import Agentex
3233

3334
client = Agentex(
35+
api_key=os.environ.get("AGENTEX_SDK_API_KEY"), # This is the default and can be omitted
3436
# defaults to "production".
3537
environment="development",
3638
)
3739

38-
agent = client.agents.retrieve(
39-
"agent_id",
40-
)
41-
print(agent.id)
40+
tasks = client.tasks.list()
4241
```
4342

4443
While you can provide an `api_key` keyword argument,
@@ -51,20 +50,19 @@ so that your API Key is not stored in source control.
5150
Simply import `AsyncAgentex` instead of `Agentex` and use `await` with each API call:
5251

5352
```python
53+
import os
5454
import asyncio
5555
from agentex import AsyncAgentex
5656

5757
client = AsyncAgentex(
58+
api_key=os.environ.get("AGENTEX_SDK_API_KEY"), # This is the default and can be omitted
5859
# defaults to "production".
5960
environment="development",
6061
)
6162

6263

6364
async def main() -> None:
64-
agent = await client.agents.retrieve(
65-
"agent_id",
66-
)
67-
print(agent.id)
65+
tasks = await client.tasks.list()
6866

6967

7068
asyncio.run(main())
@@ -93,12 +91,10 @@ from agentex import AsyncAgentex
9391

9492
async def main() -> None:
9593
async with AsyncAgentex(
94+
api_key="My API Key",
9695
http_client=DefaultAioHttpClient(),
9796
) as client:
98-
agent = await client.agents.retrieve(
99-
"agent_id",
100-
)
101-
print(agent.id)
97+
tasks = await client.tasks.list()
10298

10399

104100
asyncio.run(main())
@@ -129,9 +125,7 @@ from agentex import Agentex
129125
client = Agentex()
130126

131127
try:
132-
client.agents.retrieve(
133-
"agent_id",
134-
)
128+
client.tasks.list()
135129
except agentex.APIConnectionError as e:
136130
print("The server could not be reached")
137131
print(e.__cause__) # an underlying Exception, likely raised within httpx.
@@ -174,9 +168,7 @@ client = Agentex(
174168
)
175169

176170
# Or, configure per-request:
177-
client.with_options(max_retries=5).agents.retrieve(
178-
"agent_id",
179-
)
171+
client.with_options(max_retries=5).tasks.list()
180172
```
181173

182174
### Timeouts
@@ -199,9 +191,7 @@ client = Agentex(
199191
)
200192

201193
# Override per-request:
202-
client.with_options(timeout=5.0).agents.retrieve(
203-
"agent_id",
204-
)
194+
client.with_options(timeout=5.0).tasks.list()
205195
```
206196

207197
On timeout, an `APITimeoutError` is thrown.
@@ -242,13 +232,11 @@ The "raw" Response object can be accessed by prefixing `.with_raw_response.` to
242232
from agentex import Agentex
243233

244234
client = Agentex()
245-
response = client.agents.with_raw_response.retrieve(
246-
"agent_id",
247-
)
235+
response = client.tasks.with_raw_response.list()
248236
print(response.headers.get('X-My-Header'))
249237

250-
agent = response.parse() # get the object that `agents.retrieve()` would have returned
251-
print(agent.id)
238+
task = response.parse() # get the object that `tasks.list()` would have returned
239+
print(task)
252240
```
253241

254242
These methods return an [`APIResponse`](https://github.com/scaleapi/agentex-python/tree/main/src/agentex/_response.py) object.
@@ -262,9 +250,7 @@ The above interface eagerly reads the full response body when you make the reque
262250
To stream the response body, use `.with_streaming_response` instead, which requires a context manager and only reads the response body once you call `.read()`, `.text()`, `.json()`, `.iter_bytes()`, `.iter_text()`, `.iter_lines()` or `.parse()`. In the async client, these are async methods.
263251

264252
```python
265-
with client.agents.with_streaming_response.retrieve(
266-
"agent_id",
267-
) as response:
253+
with client.tasks.with_streaming_response.list() as response:
268254
print(response.headers.get("X-My-Header"))
269255

270256
for line in response.iter_lines():

api.md

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

39
Types:
410

511
```python
6-
from agentex.types import AcpType, Agent, AgentRpcRequest, AgentListResponse
12+
from agentex.types import (
13+
AcpType,
14+
Agent,
15+
AgentRpcParams,
16+
AgentRpcRequest,
17+
AgentRpcResponse,
18+
AgentRpcResult,
19+
DataDelta,
20+
TaskMessageContent,
21+
TaskMessageDelta,
22+
TaskMessageUpdate,
23+
TextDelta,
24+
ToolRequestDelta,
25+
ToolResponseDelta,
26+
AgentListResponse,
27+
)
728
```
829

930
Methods:
@@ -13,8 +34,8 @@ Methods:
1334
- <code title="delete /agents/{agent_id}">client.agents.<a href="./src/agentex/resources/agents.py">delete</a>(agent_id) -> <a href="./src/agentex/types/agent.py">Agent</a></code>
1435
- <code title="delete /agents/name/{agent_name}">client.agents.<a href="./src/agentex/resources/agents.py">delete_by_name</a>(agent_name) -> <a href="./src/agentex/types/agent.py">Agent</a></code>
1536
- <code title="get /agents/name/{agent_name}">client.agents.<a href="./src/agentex/resources/agents.py">retrieve_by_name</a>(agent_name) -> <a href="./src/agentex/types/agent.py">Agent</a></code>
16-
- <code title="post /agents/{agent_id}/rpc">client.agents.<a href="./src/agentex/resources/agents.py">rpc</a>(agent_id, \*\*<a href="src/agentex/types/agent_rpc_params.py">params</a>) -> object</code>
17-
- <code title="post /agents/name/{agent_name}/rpc">client.agents.<a href="./src/agentex/resources/agents.py">rpc_by_name</a>(agent_name, \*\*<a href="src/agentex/types/agent_rpc_by_name_params.py">params</a>) -> object</code>
37+
- <code title="post /agents/{agent_id}/rpc">client.agents.<a href="./src/agentex/resources/agents.py">rpc</a>(agent_id, \*\*<a href="src/agentex/types/agent_rpc_params.py">params</a>) -> <a href="./src/agentex/types/agent_rpc_response.py">AgentRpcResponse</a></code>
38+
- <code title="post /agents/name/{agent_name}/rpc">client.agents.<a href="./src/agentex/resources/agents.py">rpc_by_name</a>(agent_name, \*\*<a href="src/agentex/types/agent_rpc_by_name_params.py">params</a>) -> <a href="./src/agentex/types/agent_rpc_response.py">AgentRpcResponse</a></code>
1839

1940
# Tasks
2041

@@ -43,7 +64,6 @@ from agentex.types import (
4364
DataContent,
4465
MessageAuthor,
4566
MessageStyle,
46-
StreamingStatus,
4767
TaskMessage,
4868
TextContent,
4969
ToolRequestContent,

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "agentex"
3-
version = "0.1.0-alpha.4"
3+
version = "0.1.0-alpha.5"
44
description = "The official Python library for the agentex API"
55
dynamic = ["readme"]
66
license = "Apache-2.0"

src/agentex/_models.py

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -208,14 +208,18 @@ def construct( # pyright: ignore[reportIncompatibleMethodOverride]
208208
else:
209209
fields_values[name] = field_get_default(field)
210210

211+
extra_field_type = _get_extra_fields_type(__cls)
212+
211213
_extra = {}
212214
for key, value in values.items():
213215
if key not in model_fields:
216+
parsed = construct_type(value=value, type_=extra_field_type) if extra_field_type is not None else value
217+
214218
if PYDANTIC_V2:
215-
_extra[key] = value
219+
_extra[key] = parsed
216220
else:
217221
_fields_set.add(key)
218-
fields_values[key] = value
222+
fields_values[key] = parsed
219223

220224
object.__setattr__(m, "__dict__", fields_values)
221225

@@ -370,6 +374,23 @@ def _construct_field(value: object, field: FieldInfo, key: str) -> object:
370374
return construct_type(value=value, type_=type_, metadata=getattr(field, "metadata", None))
371375

372376

377+
def _get_extra_fields_type(cls: type[pydantic.BaseModel]) -> type | None:
378+
if not PYDANTIC_V2:
379+
# TODO
380+
return None
381+
382+
schema = cls.__pydantic_core_schema__
383+
if schema["type"] == "model":
384+
fields = schema["schema"]
385+
if fields["type"] == "model-fields":
386+
extras = fields.get("extras_schema")
387+
if extras and "cls" in extras:
388+
# mypy can't narrow the type
389+
return extras["cls"] # type: ignore[no-any-return]
390+
391+
return None
392+
393+
373394
def is_basemodel(type_: type) -> bool:
374395
"""Returns whether or not the given type is either a `BaseModel` or a union of `BaseModel`"""
375396
if is_union(type_):

src/agentex/_version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
22

33
__title__ = "agentex"
4-
__version__ = "0.1.0-alpha.4" # x-release-please-version
4+
__version__ = "0.1.0-alpha.5" # x-release-please-version

0 commit comments

Comments
 (0)