Skip to content

Commit 712de9d

Browse files
committed
chore: sync from ark-apis 67e17b6642
Auto-generated SDK sync from ark-apis at 67e17b664291d0f6b37975a15d36943a44214794. Generated files are overwritten by the sync pipeline and should not be edited by hand. Sync-Source-Commit: 3cd6c6d3097e76e36bf6216ea6c017cdf72d7032 Ark-APIs-Commit: 67e17b664291d0f6b37975a15d36943a44214794 Release-Version: 0.19.0
1 parent 7c90a03 commit 712de9d

105 files changed

Lines changed: 3489 additions & 73 deletions

File tree

Some content is hidden

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

‎.github/workflows/ci.yml‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@ concurrency:
2323
jobs:
2424
minimum-python-import:
2525
name: Import on Python ${{ matrix.python-version }}
26-
runs-on: ubuntu-latest
26+
# Python 3.8/3.9 setup-python builds are unavailable on Ubuntu 26.04.
27+
runs-on: ubuntu-24.04
2728
timeout-minutes: 15
2829
strategy:
2930
fail-fast: false

‎README.md‎

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -319,6 +319,21 @@ See the [examples/](./examples) directory for runnable scripts:
319319

320320
MCP examples are provided for both clouds and explicitly send `ark-beta-mcp: true`. Other built-in-tool examples are CN-only and show their required beta headers.
321321

322+
## Managed Agents multiagent updates
323+
324+
`MultiagentType` is a string enum. Its wire value remains `coordinator` or
325+
`multiagent_20261001`, while `str(config.type)` includes the enum class name.
326+
Use `.value` when an application needs the wire string.
327+
328+
`MultiagentConfig` represents Create and Response values, while
329+
`MultiagentPatch` represents Update fields: `coordinator` uses `agents` and
330+
`multiagent_20261001` uses `subagents`. The patch model separately represents
331+
omitted and explicit-null values.
332+
333+
When updating an Agent, omit `multiagent` to leave the topology unchanged, pass
334+
`multiagent=None` to remove it, or pass `agents=[]` to clear a coordinator's
335+
agent roster.
336+
322337
## Self-hosted MCP tools
323338

324339
The self-hosted worker core exposes a protocol-independent `MCPClient`
@@ -336,6 +351,15 @@ declaration and `mcp_tools()` for the worker registry. Keep both alive for the
336351
entire worker lifetime. See the runnable
337352
[`self_hosted_mcp_worker`](./examples/self_hosted_mcp_worker) example.
338353

354+
`EnvironmentWorkerOptions` exposes `prefer_stream` and
355+
`stream_timeout_seconds`; the defaults remain stream mode. The timeout is applied
356+
to httpx connect/read phases, so a stream that receives no bytes for 30 seconds
357+
reconnects rather than expiring after 30 seconds in total. Worker logs record
358+
stream connection attempts, the first business event, session status
359+
transitions, reconnects, and a warning when a running session has made no
360+
business progress for 60 seconds. Periodic `span.*` events do not count as
361+
business progress. These logs do not add an automatic progress timeout.
362+
339363
The adapter wraps an already connected MCP `ClientSession`, so applications may
340364
use stdio or another transport supported by their MCP client. One client
341365
session is reused across all Managed Agents Sessions handled by the worker;

‎VERSION‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
0.17.0
1+
0.19.0

‎pyproject.toml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
44

55
[project]
66
name = "arkruntime"
7-
version = "0.17.0"
7+
version = "0.19.0"
88
description = "Ark runtime SDK for Python"
99
readme = "README.md"
1010
requires-python = ">=3.8"

‎src/arkruntime/resources/agents/agents.py‎

Lines changed: 73 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,38 @@
11
from __future__ import annotations
22

33
from typing import List, Optional
4+
from urllib.parse import quote
45

56
import httpx
67

78
from ..._base_client import make_request_options
89
from ..._managed_agents_serialize import dump_body
910
from ..._resource import AsyncAPIResource, SyncAPIResource
1011
from ..._types import NOT_GIVEN, Body, Headers, NotGiven, Query
12+
13+
# AUTOGEN-START create-imports
1114
from ...types.agent.agent import Agent
1215
from ...types.agent.agent_skill_ref import AgentSkillRef
16+
from ...types.agent.context_management_policies_param import ContextManagementPoliciesParam
1317
from ...types.agent.delete_agent_response import DeleteAgentResponse
1418
from ...types.agent.list_agents_response import ListAgentsResponse
1519
from ...types.agent.mcp_server import MCPServer
1620
from ...types.agent.model_config import ModelConfig
1721
from ...types.agent.multiagent_config import MultiagentConfig
22+
from ...types.agent.multiagent_patch import MultiagentPatch
1823
from ...types.agent.tag import Tag
1924
from ...types.agent.tool_item import ToolItem
2025

26+
# AUTOGEN-END create-imports
27+
2128
__all__ = ["Agents", "AsyncAgents"]
2229

2330
_PREFIX = "/agents"
2431

2532

2633
def _list_query(
2734
*,
35+
include_archived: bool | NotGiven = NOT_GIVEN,
2836
limit=NOT_GIVEN,
2937
page=NOT_GIVEN,
3038
created_at_gte=NOT_GIVEN,
@@ -39,9 +47,19 @@ def _list_query(
3947
}.items():
4048
if v is not NOT_GIVEN and v is not None:
4149
q[k] = v
50+
if include_archived is not NOT_GIVEN and include_archived is not None:
51+
q["include_archived"] = include_archived
4252
return q
4353

4454

55+
def _validate_create_multiagent(
56+
multiagent: MultiagentConfig | NotGiven | None,
57+
) -> MultiagentConfig | NotGiven | None:
58+
if multiagent is NOT_GIVEN or multiagent is None:
59+
return multiagent
60+
return MultiagentConfig.model_validate(multiagent)
61+
62+
4563
class Agents(SyncAPIResource):
4664
def create(
4765
self,
@@ -56,11 +74,15 @@ def create(
5674
multiagent: Optional[MultiagentConfig] | NotGiven = NOT_GIVEN,
5775
metadata: Optional[dict] | NotGiven = NOT_GIVEN,
5876
tags: Optional[List[Tag]] | NotGiven = NOT_GIVEN,
77+
# AUTOGEN-START create-kwargs
78+
context_management: Optional[ContextManagementPoliciesParam] | NotGiven = NOT_GIVEN,
79+
# AUTOGEN-END create-kwargs
5980
extra_headers: Headers | None = None,
6081
extra_query: Query | None = None,
6182
extra_body: Body | None = None,
6283
timeout: float | httpx.Timeout | None = None,
6384
) -> Agent:
85+
multiagent = _validate_create_multiagent(multiagent)
6486
return self._post(
6587
_PREFIX,
6688
body=dump_body(
@@ -75,6 +97,9 @@ def create(
7597
"multiagent": multiagent,
7698
"metadata": metadata,
7799
"tags": tags,
100+
# AUTOGEN-START create-body
101+
"context_management": context_management,
102+
# AUTOGEN-END create-body
78103
}
79104
),
80105
options=make_request_options(
@@ -113,6 +138,7 @@ def retrieve(
113138
def list(
114139
self,
115140
*,
141+
include_archived: bool | NotGiven = NOT_GIVEN,
116142
limit=NOT_GIVEN,
117143
page=NOT_GIVEN,
118144
created_at_gte=NOT_GIVEN,
@@ -126,6 +152,7 @@ def list(
126152
_PREFIX,
127153
options=make_request_options(
128154
query=_list_query(
155+
include_archived=include_archived,
129156
limit=limit,
130157
page=page,
131158
created_at_gte=created_at_gte,
@@ -151,8 +178,11 @@ def update(
151178
mcp_servers: Optional[List[MCPServer]] | NotGiven = NOT_GIVEN,
152179
tools: Optional[List[ToolItem]] | NotGiven = NOT_GIVEN,
153180
skills: Optional[List[AgentSkillRef]] | NotGiven = NOT_GIVEN,
154-
multiagent: Optional[MultiagentConfig] | NotGiven = NOT_GIVEN,
181+
multiagent: Optional[MultiagentPatch] | NotGiven = NOT_GIVEN,
155182
metadata: Optional[dict] | NotGiven = NOT_GIVEN,
183+
# AUTOGEN-START update-kwargs
184+
context_management: Optional[ContextManagementPoliciesParam] | NotGiven = NOT_GIVEN,
185+
# AUTOGEN-END update-kwargs
156186
extra_headers=None,
157187
extra_query=None,
158188
extra_body=None,
@@ -174,6 +204,9 @@ def update(
174204
"skills": skills,
175205
"multiagent": multiagent,
176206
"metadata": metadata,
207+
# AUTOGEN-START update-body
208+
"context_management": context_management,
209+
# AUTOGEN-END update-body
177210
}
178211
),
179212
options=make_request_options(
@@ -221,6 +254,18 @@ def list_versions(
221254
cast_to=ListAgentsResponse,
222255
)
223256

257+
def archive(self, agent_id: str, *, extra_headers=None, extra_query=None, timeout=None) -> Agent:
258+
"""Archive this agent; the POST has no request body."""
259+
if not agent_id:
260+
raise ValueError("agent_id is required")
261+
return self._post(
262+
f"{_PREFIX}/{quote(agent_id, safe='')}/archive",
263+
# Raw empty bytes bypass the client's default empty JSON object.
264+
body=b"", # type: ignore[arg-type]
265+
options=make_request_options(extra_headers=extra_headers, extra_query=extra_query, timeout=timeout),
266+
cast_to=Agent,
267+
)
268+
224269

225270
class AsyncAgents(AsyncAPIResource):
226271
async def create(
@@ -236,11 +281,15 @@ async def create(
236281
multiagent=NOT_GIVEN,
237282
metadata=NOT_GIVEN,
238283
tags=NOT_GIVEN,
284+
# AUTOGEN-START create-kwargs
285+
context_management: Optional[ContextManagementPoliciesParam] | NotGiven = NOT_GIVEN,
286+
# AUTOGEN-END create-kwargs
239287
extra_headers=None,
240288
extra_query=None,
241289
extra_body=None,
242290
timeout=None,
243291
) -> Agent:
292+
multiagent = _validate_create_multiagent(multiagent)
244293
return await self._post(
245294
_PREFIX,
246295
body=dump_body(
@@ -255,6 +304,9 @@ async def create(
255304
"multiagent": multiagent,
256305
"metadata": metadata,
257306
"tags": tags,
307+
# AUTOGEN-START create-body
308+
"context_management": context_management,
309+
# AUTOGEN-END create-body
258310
}
259311
),
260312
options=make_request_options(
@@ -293,6 +345,7 @@ async def retrieve(
293345
async def list(
294346
self,
295347
*,
348+
include_archived: bool | NotGiven = NOT_GIVEN,
296349
limit=NOT_GIVEN,
297350
page=NOT_GIVEN,
298351
created_at_gte=NOT_GIVEN,
@@ -306,6 +359,7 @@ async def list(
306359
_PREFIX,
307360
options=make_request_options(
308361
query=_list_query(
362+
include_archived=include_archived,
309363
limit=limit,
310364
page=page,
311365
created_at_gte=created_at_gte,
@@ -333,6 +387,9 @@ async def update(
333387
skills=NOT_GIVEN,
334388
multiagent=NOT_GIVEN,
335389
metadata=NOT_GIVEN,
390+
# AUTOGEN-START update-kwargs
391+
context_management: Optional[ContextManagementPoliciesParam] | NotGiven = NOT_GIVEN,
392+
# AUTOGEN-END update-kwargs
336393
extra_headers=None,
337394
extra_query=None,
338395
extra_body=None,
@@ -354,6 +411,9 @@ async def update(
354411
"skills": skills,
355412
"multiagent": multiagent,
356413
"metadata": metadata,
414+
# AUTOGEN-START update-body
415+
"context_management": context_management,
416+
# AUTOGEN-END update-body
357417
}
358418
),
359419
options=make_request_options(
@@ -400,3 +460,15 @@ async def list_versions(
400460
),
401461
cast_to=ListAgentsResponse,
402462
)
463+
464+
async def archive(self, agent_id: str, *, extra_headers=None, extra_query=None, timeout=None) -> Agent:
465+
"""Archive this agent; the POST has no request body."""
466+
if not agent_id:
467+
raise ValueError("agent_id is required")
468+
return await self._post(
469+
f"{_PREFIX}/{quote(agent_id, safe='')}/archive",
470+
# Raw empty bytes bypass the client's default empty JSON object.
471+
body=b"", # type: ignore[arg-type]
472+
options=make_request_options(extra_headers=extra_headers, extra_query=extra_query, timeout=timeout),
473+
cast_to=Agent,
474+
)

‎src/arkruntime/resources/environments/environments.py‎

Lines changed: 48 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
from __future__ import annotations
22

33
from typing import Optional
4+
from urllib.parse import quote
45

56
import httpx
67

@@ -21,12 +22,14 @@
2122
_ENV_PREFIX = "/environments"
2223

2324

24-
def _list_query(*, limit=NOT_GIVEN, page=NOT_GIVEN) -> dict:
25+
def _list_query(*, include_archived: bool | NotGiven = NOT_GIVEN, limit=NOT_GIVEN, page=NOT_GIVEN) -> dict:
2526
q: dict = {}
2627
if limit is not NOT_GIVEN and limit is not None:
2728
q["limit"] = limit
2829
if page is not NOT_GIVEN and page is not None:
2930
q["page"] = page
31+
if include_archived is not NOT_GIVEN and include_archived is not None:
32+
q["include_archived"] = include_archived
3033
return q
3134

3235

@@ -73,12 +76,20 @@ def retrieve(
7376
)
7477

7578
def list(
76-
self, *, limit=NOT_GIVEN, page=NOT_GIVEN, extra_headers=None, extra_query=None, extra_body=None, timeout=None
79+
self,
80+
*,
81+
include_archived: bool | NotGiven = NOT_GIVEN,
82+
limit=NOT_GIVEN,
83+
page=NOT_GIVEN,
84+
extra_headers=None,
85+
extra_query=None,
86+
extra_body=None,
87+
timeout=None,
7788
) -> ListEnvironmentsResponse:
7889
return self._get(
7990
_ENV_PREFIX,
8091
options=make_request_options(
81-
query=_list_query(limit=limit, page=page),
92+
query=_list_query(include_archived=include_archived, limit=limit, page=page),
8293
extra_headers=extra_headers,
8394
extra_query=extra_query,
8495
extra_body=extra_body,
@@ -127,6 +138,18 @@ def delete(
127138
cast_to=DeleteEnvironmentResponse,
128139
)
129140

141+
def archive(self, environment_id: str, *, extra_headers=None, extra_query=None, timeout=None) -> Environment:
142+
"""Archive this environment; the POST has no request body."""
143+
if not environment_id:
144+
raise ValueError("environment_id is required")
145+
return self._post(
146+
f"{_ENV_PREFIX}/{quote(environment_id, safe='')}/archive",
147+
# Raw empty bytes bypass the client's default empty JSON object.
148+
body=b"", # type: ignore[arg-type]
149+
options=make_request_options(extra_headers=extra_headers, extra_query=extra_query, timeout=timeout),
150+
cast_to=Environment,
151+
)
152+
130153

131154
class AsyncEnvironments(AsyncAPIResource):
132155
@cached_property
@@ -171,12 +194,20 @@ async def retrieve(
171194
)
172195

173196
async def list(
174-
self, *, limit=NOT_GIVEN, page=NOT_GIVEN, extra_headers=None, extra_query=None, extra_body=None, timeout=None
197+
self,
198+
*,
199+
include_archived: bool | NotGiven = NOT_GIVEN,
200+
limit=NOT_GIVEN,
201+
page=NOT_GIVEN,
202+
extra_headers=None,
203+
extra_query=None,
204+
extra_body=None,
205+
timeout=None,
175206
) -> ListEnvironmentsResponse:
176207
return await self._get(
177208
_ENV_PREFIX,
178209
options=make_request_options(
179-
query=_list_query(limit=limit, page=page),
210+
query=_list_query(include_archived=include_archived, limit=limit, page=page),
180211
extra_headers=extra_headers,
181212
extra_query=extra_query,
182213
extra_body=extra_body,
@@ -224,3 +255,15 @@ async def delete(
224255
),
225256
cast_to=DeleteEnvironmentResponse,
226257
)
258+
259+
async def archive(self, environment_id: str, *, extra_headers=None, extra_query=None, timeout=None) -> Environment:
260+
"""Archive this environment; the POST has no request body."""
261+
if not environment_id:
262+
raise ValueError("environment_id is required")
263+
return await self._post(
264+
f"{_ENV_PREFIX}/{quote(environment_id, safe='')}/archive",
265+
# Raw empty bytes bypass the client's default empty JSON object.
266+
body=b"", # type: ignore[arg-type]
267+
options=make_request_options(extra_headers=extra_headers, extra_query=extra_query, timeout=timeout),
268+
cast_to=Environment,
269+
)

0 commit comments

Comments
 (0)