Skip to content

Commit 1d4e049

Browse files
feat: [APP-3106] Specs: Explicit QueryMode for cloud agent run creation
1 parent 15d68a1 commit 1d4e049

11 files changed

Lines changed: 117 additions & 8 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: 22
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/warp-bnavetta/warp-api-8eb8e46de29b887cbcb25b90fec55d34e11ff82b174b7a5c1d1ce4ba4d7c2fb4.yml
3-
openapi_spec_hash: a071b7c932453dc870e7e6cf39df0535
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/warp-bnavetta/warp-api-f4c3bab952ad19ea9d246794add1bda6d3911eb32d8372f0d7271b52267b6d0b.yml
3+
openapi_spec_hash: 9fd38bfc2e640fb456258f50fccacf88
44
config_hash: c15534df6c8d861059e44d9dd5483b3f

src/oz_agent_sdk/resources/agent/agent.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -262,6 +262,7 @@ def run(
262262
config: AmbientAgentConfigParam | Omit = omit,
263263
conversation_id: str | Omit = omit,
264264
interactive: bool | Omit = omit,
265+
mode: Literal["normal", "plan", "orchestrate"] | Omit = omit,
265266
parent_run_id: str | Omit = omit,
266267
prompt: str | Omit = omit,
267268
skill: str | Omit = omit,
@@ -293,6 +294,10 @@ def run(
293294
294295
interactive: Whether the run should be interactive. If not set, defaults to false.
295296
297+
mode: Optional query mode for the run. Defaults to `normal` when omitted. The server
298+
does not infer mode from prompt prefixes such as `/plan`, so callers should pass
299+
this field explicitly to request non-normal behavior.
300+
296301
parent_run_id: Optional run ID of the parent that spawned this run. Used for orchestration
297302
hierarchies.
298303
@@ -329,6 +334,7 @@ def run(
329334
"config": config,
330335
"conversation_id": conversation_id,
331336
"interactive": interactive,
337+
"mode": mode,
332338
"parent_run_id": parent_run_id,
333339
"prompt": prompt,
334340
"skill": skill,
@@ -547,6 +553,7 @@ async def run(
547553
config: AmbientAgentConfigParam | Omit = omit,
548554
conversation_id: str | Omit = omit,
549555
interactive: bool | Omit = omit,
556+
mode: Literal["normal", "plan", "orchestrate"] | Omit = omit,
550557
parent_run_id: str | Omit = omit,
551558
prompt: str | Omit = omit,
552559
skill: str | Omit = omit,
@@ -578,6 +585,10 @@ async def run(
578585
579586
interactive: Whether the run should be interactive. If not set, defaults to false.
580587
588+
mode: Optional query mode for the run. Defaults to `normal` when omitted. The server
589+
does not infer mode from prompt prefixes such as `/plan`, so callers should pass
590+
this field explicitly to request non-normal behavior.
591+
581592
parent_run_id: Optional run ID of the parent that spawned this run. Used for orchestration
582593
hierarchies.
583594
@@ -614,6 +625,7 @@ async def run(
614625
"config": config,
615626
"conversation_id": conversation_id,
616627
"interactive": interactive,
628+
"mode": mode,
617629
"parent_run_id": parent_run_id,
618630
"prompt": prompt,
619631
"skill": skill,

src/oz_agent_sdk/resources/agent/runs.py

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -302,6 +302,7 @@ def submit_followup(
302302
run_id: str,
303303
*,
304304
message: str,
305+
mode: Literal["normal", "plan", "orchestrate"] | Omit = omit,
305306
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
306307
# The extra values given here take precedence over values defined on the client or passed to this method.
307308
extra_headers: Headers | None = None,
@@ -319,6 +320,9 @@ def submit_followup(
319320
Args:
320321
message: The follow-up message to send to the run.
321322
323+
mode: Optional query mode for the follow-up. Defaults to `normal` when omitted. The
324+
server does not infer mode from prompt prefixes such as `/plan`.
325+
322326
extra_headers: Send extra headers
323327
324328
extra_query: Add additional query parameters to the request
@@ -331,7 +335,13 @@ def submit_followup(
331335
raise ValueError(f"Expected a non-empty value for `run_id` but received {run_id!r}")
332336
return self._post(
333337
path_template("/agent/runs/{run_id}/followups", run_id=run_id),
334-
body=maybe_transform({"message": message}, run_submit_followup_params.RunSubmitFollowupParams),
338+
body=maybe_transform(
339+
{
340+
"message": message,
341+
"mode": mode,
342+
},
343+
run_submit_followup_params.RunSubmitFollowupParams,
344+
),
335345
options=make_request_options(
336346
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
337347
),
@@ -612,6 +622,7 @@ async def submit_followup(
612622
run_id: str,
613623
*,
614624
message: str,
625+
mode: Literal["normal", "plan", "orchestrate"] | Omit = omit,
615626
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
616627
# The extra values given here take precedence over values defined on the client or passed to this method.
617628
extra_headers: Headers | None = None,
@@ -629,6 +640,9 @@ async def submit_followup(
629640
Args:
630641
message: The follow-up message to send to the run.
631642
643+
mode: Optional query mode for the follow-up. Defaults to `normal` when omitted. The
644+
server does not infer mode from prompt prefixes such as `/plan`.
645+
632646
extra_headers: Send extra headers
633647
634648
extra_query: Add additional query parameters to the request
@@ -641,7 +655,13 @@ async def submit_followup(
641655
raise ValueError(f"Expected a non-empty value for `run_id` but received {run_id!r}")
642656
return await self._post(
643657
path_template("/agent/runs/{run_id}/followups", run_id=run_id),
644-
body=await async_maybe_transform({"message": message}, run_submit_followup_params.RunSubmitFollowupParams),
658+
body=await async_maybe_transform(
659+
{
660+
"message": message,
661+
"mode": mode,
662+
},
663+
run_submit_followup_params.RunSubmitFollowupParams,
664+
),
645665
options=make_request_options(
646666
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
647667
),

src/oz_agent_sdk/resources/agent/schedules.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
from __future__ import annotations
44

5+
from typing_extensions import Literal
6+
57
import httpx
68

79
from ..._types import Body, Omit, Query, Headers, NotGiven, omit, not_given
@@ -54,6 +56,7 @@ def create(
5456
agent_config: AmbientAgentConfigParam | Omit = omit,
5557
agent_uid: str | Omit = omit,
5658
enabled: bool | Omit = omit,
59+
mode: Literal["normal", "plan", "orchestrate"] | Omit = omit,
5760
prompt: str | Omit = omit,
5861
team: bool | Omit = omit,
5962
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
@@ -81,6 +84,9 @@ def create(
8184
8285
enabled: Whether the schedule should be active immediately
8386
87+
mode: Optional query mode applied to every triggered run. Defaults to `normal` when
88+
omitted. The server does not infer mode from prompt prefixes such as `/plan`.
89+
8490
prompt: The prompt/instruction for the agent to execute. Required unless
8591
agent_config.skill_spec is provided.
8692
@@ -104,6 +110,7 @@ def create(
104110
"agent_config": agent_config,
105111
"agent_uid": agent_uid,
106112
"enabled": enabled,
113+
"mode": mode,
107114
"prompt": prompt,
108115
"team": team,
109116
},
@@ -158,6 +165,7 @@ def update(
158165
name: str,
159166
agent_config: AmbientAgentConfigParam | Omit = omit,
160167
agent_uid: str | Omit = omit,
168+
mode: Literal["normal", "plan", "orchestrate"] | Omit = omit,
161169
prompt: str | Omit = omit,
162170
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
163171
# The extra values given here take precedence over values defined on the client or passed to this method.
@@ -183,6 +191,9 @@ def update(
183191
agent_uid: Agent UID to use as the execution principal for this schedule. Only valid for
184192
team-owned schedules.
185193
194+
mode: Optional query mode applied to every triggered run. Defaults to `normal` when
195+
omitted. The server does not infer mode from prompt prefixes such as `/plan`.
196+
186197
prompt: The prompt/instruction for the agent to execute. Required unless
187198
agent_config.skill_spec is provided.
188199
@@ -205,6 +216,7 @@ def update(
205216
"name": name,
206217
"agent_config": agent_config,
207218
"agent_uid": agent_uid,
219+
"mode": mode,
208220
"prompt": prompt,
209221
},
210222
schedule_update_params.ScheduleUpdateParams,
@@ -372,6 +384,7 @@ async def create(
372384
agent_config: AmbientAgentConfigParam | Omit = omit,
373385
agent_uid: str | Omit = omit,
374386
enabled: bool | Omit = omit,
387+
mode: Literal["normal", "plan", "orchestrate"] | Omit = omit,
375388
prompt: str | Omit = omit,
376389
team: bool | Omit = omit,
377390
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
@@ -399,6 +412,9 @@ async def create(
399412
400413
enabled: Whether the schedule should be active immediately
401414
415+
mode: Optional query mode applied to every triggered run. Defaults to `normal` when
416+
omitted. The server does not infer mode from prompt prefixes such as `/plan`.
417+
402418
prompt: The prompt/instruction for the agent to execute. Required unless
403419
agent_config.skill_spec is provided.
404420
@@ -422,6 +438,7 @@ async def create(
422438
"agent_config": agent_config,
423439
"agent_uid": agent_uid,
424440
"enabled": enabled,
441+
"mode": mode,
425442
"prompt": prompt,
426443
"team": team,
427444
},
@@ -476,6 +493,7 @@ async def update(
476493
name: str,
477494
agent_config: AmbientAgentConfigParam | Omit = omit,
478495
agent_uid: str | Omit = omit,
496+
mode: Literal["normal", "plan", "orchestrate"] | Omit = omit,
479497
prompt: str | Omit = omit,
480498
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
481499
# The extra values given here take precedence over values defined on the client or passed to this method.
@@ -501,6 +519,9 @@ async def update(
501519
agent_uid: Agent UID to use as the execution principal for this schedule. Only valid for
502520
team-owned schedules.
503521
522+
mode: Optional query mode applied to every triggered run. Defaults to `normal` when
523+
omitted. The server does not infer mode from prompt prefixes such as `/plan`.
524+
504525
prompt: The prompt/instruction for the agent to execute. Required unless
505526
agent_config.skill_spec is provided.
506527
@@ -523,6 +544,7 @@ async def update(
523544
"name": name,
524545
"agent_config": agent_config,
525546
"agent_uid": agent_uid,
547+
"mode": mode,
526548
"prompt": prompt,
527549
},
528550
schedule_update_params.ScheduleUpdateParams,

src/oz_agent_sdk/types/agent/run_submit_followup_params.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,18 @@
22

33
from __future__ import annotations
44

5-
from typing_extensions import Required, TypedDict
5+
from typing_extensions import Literal, Required, TypedDict
66

77
__all__ = ["RunSubmitFollowupParams"]
88

99

1010
class RunSubmitFollowupParams(TypedDict, total=False):
1111
message: Required[str]
1212
"""The follow-up message to send to the run."""
13+
14+
mode: Literal["normal", "plan", "orchestrate"]
15+
"""Optional query mode for the follow-up.
16+
17+
Defaults to `normal` when omitted. The server does not infer mode from prompt
18+
prefixes such as `/plan`.
19+
"""

src/oz_agent_sdk/types/agent/schedule_create_params.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
from __future__ import annotations
44

5-
from typing_extensions import Required, TypedDict
5+
from typing_extensions import Literal, Required, TypedDict
66

77
from ..ambient_agent_config_param import AmbientAgentConfigParam
88

@@ -31,6 +31,13 @@ class ScheduleCreateParams(TypedDict, total=False):
3131
enabled: bool
3232
"""Whether the schedule should be active immediately"""
3333

34+
mode: Literal["normal", "plan", "orchestrate"]
35+
"""Optional query mode applied to every triggered run.
36+
37+
Defaults to `normal` when omitted. The server does not infer mode from prompt
38+
prefixes such as `/plan`.
39+
"""
40+
3441
prompt: str
3542
"""
3643
The prompt/instruction for the agent to execute. Required unless

src/oz_agent_sdk/types/agent/schedule_update_params.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
from __future__ import annotations
44

5-
from typing_extensions import Required, TypedDict
5+
from typing_extensions import Literal, Required, TypedDict
66

77
from ..ambient_agent_config_param import AmbientAgentConfigParam
88

@@ -28,6 +28,13 @@ class ScheduleUpdateParams(TypedDict, total=False):
2828
team-owned schedules.
2929
"""
3030

31+
mode: Literal["normal", "plan", "orchestrate"]
32+
"""Optional query mode applied to every triggered run.
33+
34+
Defaults to `normal` when omitted. The server does not infer mode from prompt
35+
prefixes such as `/plan`.
36+
"""
37+
3138
prompt: str
3239
"""
3340
The prompt/instruction for the agent to execute. Required unless

src/oz_agent_sdk/types/agent_run_params.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
from __future__ import annotations
44

55
from typing import Union, Iterable
6-
from typing_extensions import Required, Annotated, TypedDict
6+
from typing_extensions import Literal, Required, Annotated, TypedDict
77

88
from .._types import Base64FileInput
99
from .._utils import PropertyInfo
@@ -38,6 +38,14 @@ class AgentRunParams(TypedDict, total=False):
3838
interactive: bool
3939
"""Whether the run should be interactive. If not set, defaults to false."""
4040

41+
mode: Literal["normal", "plan", "orchestrate"]
42+
"""Optional query mode for the run.
43+
44+
Defaults to `normal` when omitted. The server does not infer mode from prompt
45+
prefixes such as `/plan`, so callers should pass this field explicitly to
46+
request non-normal behavior.
47+
"""
48+
4149
parent_run_id: str
4250
"""
4351
Optional run ID of the parent that spawned this run. Used for orchestration

tests/api_resources/agent/test_runs.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,16 @@ def test_method_submit_followup(self, client: OzAPI) -> None:
213213
)
214214
assert_matches_type(object, run, path=["response"])
215215

216+
@pytest.mark.skip(reason="Mock server tests are disabled")
217+
@parametrize
218+
def test_method_submit_followup_with_all_params(self, client: OzAPI) -> None:
219+
run = client.agent.runs.submit_followup(
220+
run_id="runId",
221+
message="message",
222+
mode="normal",
223+
)
224+
assert_matches_type(object, run, path=["response"])
225+
216226
@pytest.mark.skip(reason="Mock server tests are disabled")
217227
@parametrize
218228
def test_raw_response_submit_followup(self, client: OzAPI) -> None:
@@ -447,6 +457,16 @@ async def test_method_submit_followup(self, async_client: AsyncOzAPI) -> None:
447457
)
448458
assert_matches_type(object, run, path=["response"])
449459

460+
@pytest.mark.skip(reason="Mock server tests are disabled")
461+
@parametrize
462+
async def test_method_submit_followup_with_all_params(self, async_client: AsyncOzAPI) -> None:
463+
run = await async_client.agent.runs.submit_followup(
464+
run_id="runId",
465+
message="message",
466+
mode="normal",
467+
)
468+
assert_matches_type(object, run, path=["response"])
469+
450470
@pytest.mark.skip(reason="Mock server tests are disabled")
451471
@parametrize
452472
async def test_raw_response_submit_followup(self, async_client: AsyncOzAPI) -> None:

tests/api_resources/agent/test_schedules.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ def test_method_create_with_all_params(self, client: OzAPI) -> None:
6161
},
6262
agent_uid="agent_uid",
6363
enabled=True,
64+
mode="normal",
6465
prompt="Review open pull requests and provide feedback",
6566
team=True,
6667
)
@@ -179,6 +180,7 @@ def test_method_update_with_all_params(self, client: OzAPI) -> None:
179180
"worker_host": "worker_host",
180181
},
181182
agent_uid="agent_uid",
183+
mode="normal",
182184
prompt="prompt",
183185
)
184186
assert_matches_type(ScheduledAgentItem, schedule, path=["response"])
@@ -426,6 +428,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncOzAPI) ->
426428
},
427429
agent_uid="agent_uid",
428430
enabled=True,
431+
mode="normal",
429432
prompt="Review open pull requests and provide feedback",
430433
team=True,
431434
)
@@ -544,6 +547,7 @@ async def test_method_update_with_all_params(self, async_client: AsyncOzAPI) ->
544547
"worker_host": "worker_host",
545548
},
546549
agent_uid="agent_uid",
550+
mode="normal",
547551
prompt="prompt",
548552
)
549553
assert_matches_type(ScheduledAgentItem, schedule, path=["response"])

0 commit comments

Comments
 (0)