Skip to content

Commit 85ad692

Browse files
feat: make agent version optional in API (#8858)
1 parent 7d135b9 commit 85ad692

5 files changed

Lines changed: 32 additions & 24 deletions

File tree

.stats.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
configured_endpoints: 116
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/runloop-ai%2Frunloop-c7ea174934858cd454d7de0230f9a0eef056f9deff2c4bb6b8b4e5f4a223a959.yml
3-
openapi_spec_hash: 3a398829d65372e00d413089830878ea
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/runloop-ai%2Frunloop-8d842053abe7f6230240dc5adadee3b881020d07f7505002fa33a0aee67cc74c.yml
3+
openapi_spec_hash: 09e0ffd9cd5981634a10592edeb8174e
44
config_hash: 436c8d4e665915db22b5d98fe58382c1

src/runloop_api_client/resources/agents.py

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,8 @@ def create(
5050
self,
5151
*,
5252
name: str,
53-
version: str,
5453
source: Optional[AgentSource] | Omit = omit,
54+
version: Optional[str] | Omit = omit,
5555
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
5656
# The extra values given here take precedence over values defined on the client or passed to this method.
5757
extra_headers: Headers | None = None,
@@ -68,10 +68,12 @@ def create(
6868
Args:
6969
name: The name of the Agent.
7070
71-
version: The version of the Agent. Must be a semver string (e.g., '2.0.65') or a SHA.
72-
7371
source: The source configuration for the Agent.
7472
73+
version: Optional version identifier for the Agent. For npm/pip sources this is typically
74+
a semver string (e.g. '2.0.65'). For git sources it can be a branch or tag.
75+
Semantics are user-defined for object sources.
76+
7577
extra_headers: Send extra headers
7678
7779
extra_query: Add additional query parameters to the request
@@ -87,8 +89,8 @@ def create(
8789
body=maybe_transform(
8890
{
8991
"name": name,
90-
"version": version,
9192
"source": source,
93+
"version": version,
9294
},
9395
agent_create_params.AgentCreateParams,
9496
),
@@ -357,8 +359,8 @@ async def create(
357359
self,
358360
*,
359361
name: str,
360-
version: str,
361362
source: Optional[AgentSource] | Omit = omit,
363+
version: Optional[str] | Omit = omit,
362364
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
363365
# The extra values given here take precedence over values defined on the client or passed to this method.
364366
extra_headers: Headers | None = None,
@@ -375,10 +377,12 @@ async def create(
375377
Args:
376378
name: The name of the Agent.
377379
378-
version: The version of the Agent. Must be a semver string (e.g., '2.0.65') or a SHA.
379-
380380
source: The source configuration for the Agent.
381381
382+
version: Optional version identifier for the Agent. For npm/pip sources this is typically
383+
a semver string (e.g. '2.0.65'). For git sources it can be a branch or tag.
384+
Semantics are user-defined for object sources.
385+
382386
extra_headers: Send extra headers
383387
384388
extra_query: Add additional query parameters to the request
@@ -394,8 +398,8 @@ async def create(
394398
body=await async_maybe_transform(
395399
{
396400
"name": name,
397-
"version": version,
398401
"source": source,
402+
"version": version,
399403
},
400404
agent_create_params.AgentCreateParams,
401405
),

src/runloop_api_client/types/agent_create_params.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,13 @@ class AgentCreateParams(TypedDict, total=False):
1414
name: Required[str]
1515
"""The name of the Agent."""
1616

17-
version: Required[str]
18-
"""The version of the Agent. Must be a semver string (e.g., '2.0.65') or a SHA."""
19-
2017
source: Optional[AgentSource]
2118
"""The source configuration for the Agent."""
19+
20+
version: Optional[str]
21+
"""Optional version identifier for the Agent.
22+
23+
For npm/pip sources this is typically a semver string (e.g. '2.0.65'). For git
24+
sources it can be a branch or tag. Semantics are user-defined for object
25+
sources.
26+
"""

src/runloop_api_client/types/agent_view.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,13 @@ class AgentView(BaseModel):
2323
name: str
2424
"""The name of the Agent."""
2525

26-
version: str
27-
"""The version of the Agent. A semver string (e.g., '2.0.65') or a SHA."""
28-
2926
source: Optional[AgentSource] = None
3027
"""The source configuration for the Agent."""
28+
29+
version: Optional[str] = None
30+
"""Optional version identifier for the Agent.
31+
32+
For npm/pip sources this is typically a semver string (e.g. '2.0.65'). For git
33+
sources it can be a branch or tag. Omitted for object sources or when not
34+
provided.
35+
"""

tests/api_resources/test_agents.py

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -25,15 +25,13 @@ class TestAgents:
2525
def test_method_create(self, client: Runloop) -> None:
2626
agent = client.agents.create(
2727
name="name",
28-
version="version",
2928
)
3029
assert_matches_type(AgentView, agent, path=["response"])
3130

3231
@parametrize
3332
def test_method_create_with_all_params(self, client: Runloop) -> None:
3433
agent = client.agents.create(
3534
name="name",
36-
version="version",
3735
source={
3836
"type": "type",
3937
"git": {
@@ -56,14 +54,14 @@ def test_method_create_with_all_params(self, client: Runloop) -> None:
5654
"registry_url": "registry_url",
5755
},
5856
},
57+
version="version",
5958
)
6059
assert_matches_type(AgentView, agent, path=["response"])
6160

6261
@parametrize
6362
def test_raw_response_create(self, client: Runloop) -> None:
6463
response = client.agents.with_raw_response.create(
6564
name="name",
66-
version="version",
6765
)
6866

6967
assert response.is_closed is True
@@ -75,7 +73,6 @@ def test_raw_response_create(self, client: Runloop) -> None:
7573
def test_streaming_response_create(self, client: Runloop) -> None:
7674
with client.agents.with_streaming_response.create(
7775
name="name",
78-
version="version",
7976
) as response:
8077
assert not response.is_closed
8178
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
@@ -271,15 +268,13 @@ class TestAsyncAgents:
271268
async def test_method_create(self, async_client: AsyncRunloop) -> None:
272269
agent = await async_client.agents.create(
273270
name="name",
274-
version="version",
275271
)
276272
assert_matches_type(AgentView, agent, path=["response"])
277273

278274
@parametrize
279275
async def test_method_create_with_all_params(self, async_client: AsyncRunloop) -> None:
280276
agent = await async_client.agents.create(
281277
name="name",
282-
version="version",
283278
source={
284279
"type": "type",
285280
"git": {
@@ -302,14 +297,14 @@ async def test_method_create_with_all_params(self, async_client: AsyncRunloop) -
302297
"registry_url": "registry_url",
303298
},
304299
},
300+
version="version",
305301
)
306302
assert_matches_type(AgentView, agent, path=["response"])
307303

308304
@parametrize
309305
async def test_raw_response_create(self, async_client: AsyncRunloop) -> None:
310306
response = await async_client.agents.with_raw_response.create(
311307
name="name",
312-
version="version",
313308
)
314309

315310
assert response.is_closed is True
@@ -321,7 +316,6 @@ async def test_raw_response_create(self, async_client: AsyncRunloop) -> None:
321316
async def test_streaming_response_create(self, async_client: AsyncRunloop) -> None:
322317
async with async_client.agents.with_streaming_response.create(
323318
name="name",
324-
version="version",
325319
) as response:
326320
assert not response.is_closed
327321
assert response.http_request.headers.get("X-Stainless-Lang") == "python"

0 commit comments

Comments
 (0)