Skip to content

Commit e6e13d9

Browse files
Merge 2dc0d3d into 7e1643a
2 parents 7e1643a + 2dc0d3d commit e6e13d9

7 files changed

Lines changed: 160 additions & 9 deletions

File tree

‎.castiron.stats.yml‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
schema_version: 1
2-
generation_id: 0dc2ed6b-5212-4044-b49d-2c6d60de1482
3-
openapi_spec_hash: db347f06272e97feb52de04cf9f5d97d
4-
openapi_transformed_spec_hash: b4eaee70c0715318e47ee8449ea1e803
2+
generation_id: 77e7bf2e-2222-4fa1-afde-04e9a475a2d0
3+
openapi_spec_hash: 556e1d261e2ef761c7236598cffc6a4b
4+
openapi_transformed_spec_hash: a5c09efaaff7b8e04e0a0dd5f4087246
55
config_hash: 9f2131d7bd073baa8cb2730facaadf5a
6-
codegen_sha: aa2e4495602dda9732b64aaf1ed1e572e3b30f42
7-
codegen_hash: 07d7a391cb327c8d70dd18e1878635ebb0c8d87acdc6eebd3fff6bea232a661a
8-
public_codegen_sha: 502686aec876a8af283c91c38583979f4f8e30be
6+
codegen_sha: 34af930ff9f3c6966a29960bf00baa8902974344
7+
codegen_hash: f5920470692de4e2e2b6c2c7ddc1288b169a4d7493e1a2ee73bff14056d6d30c
8+
public_codegen_sha: 4b480e5caf1d0025445164c4be5dd2d863859bc7

‎api_reference/openapi.transformed.yml‎

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36730,6 +36730,41 @@ webhooks:
3673036730
status codes will be retried.
3673136731
components:
3673236732
schemas:
36733+
SessionSpendControlParam:
36734+
type: object
36735+
properties:
36736+
limit:
36737+
type:
36738+
- integer
36739+
- 'null'
36740+
format: int64
36741+
minimum: 1
36742+
maximum: 4503599627370495
36743+
description: Positive USD cents, or null to remove the limit.
36744+
required:
36745+
- limit
36746+
additionalProperties: false
36747+
description: Sets the session-wide limit without changing recorded spend.
36748+
SessionSpendControlResource:
36749+
type: object
36750+
properties:
36751+
limit:
36752+
type: integer
36753+
format: int64
36754+
minimum: 1
36755+
maximum: 4503599627370495
36756+
description: The configured positive limit in USD cents.
36757+
consumed:
36758+
type:
36759+
- integer
36760+
- 'null'
36761+
minimum: 0
36762+
description: Best-effort recorded spend floored to whole USD cents, or null when unavailable.
36763+
required:
36764+
- limit
36765+
- consumed
36766+
additionalProperties: false
36767+
description: Session-wide spending control, present only when a limit is configured.
3673336768
AddUploadPartRequest:
3673436769
type: object
3673536770
additionalProperties: false
@@ -86336,6 +86371,9 @@ components:
8633686371
SessionResource:
8633786372
type: object
8633886373
properties:
86374+
spend_control:
86375+
$ref: '#/components/schemas/SessionSpendControlResource'
86376+
description: Configured spending limit and best-effort consumption, in USD cents. Unlimited sessions omit this object.
8633986377
metadata:
8634086378
type: object
8634186379
additionalProperties:
@@ -87134,6 +87172,11 @@ components:
8713487172
CreateAgentSessionParams:
8713587173
type: object
8713687174
properties:
87175+
spend_control:
87176+
anyOf:
87177+
- $ref: '#/components/schemas/SessionSpendControlParam'
87178+
- type: 'null'
87179+
description: Optional spending limit in USD cents. Omission or null creates an unlimited session.
8713787180
metadata:
8713887181
type:
8713987182
- object
@@ -88720,6 +88763,11 @@ components:
8872088763
UpdateAgentSessionParams:
8872188764
type: object
8872288765
properties:
88766+
spend_control:
88767+
anyOf:
88768+
- $ref: '#/components/schemas/SessionSpendControlParam'
88769+
- type: 'null'
88770+
description: Omit to retain the limit; null or a null limit removes it without resetting spend.
8872388771
agent:
8872488772
$ref: '#/components/schemas/UpdateSessionAgentParam'
8872588773
description: Model settings for subsequent turns. Omitted fields stay unchanged.

‎src/openai/resources/beta/agents/sessions/sessions.py‎

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,7 @@ def create(
166166
agent_id: str | Omit = omit,
167167
input: Union[str, Iterable[AgentSessionInputMessageParam], None] | Omit = omit,
168168
metadata: Optional[Dict[str, str]] | Omit = omit,
169+
spend_control: Optional[session_create_params.SpendControl] | Omit = omit,
169170
stream: Literal[False] | Omit = omit,
170171
vault_ids: Optional[SequenceNotStr[str]] | Omit = omit,
171172
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
@@ -197,6 +198,9 @@ def create(
197198
metadata: Up to 16 string key-value pairs, with keys up to 64 and values up to 512
198199
characters. Omission or null defaults to an empty map.
199200
201+
spend_control: Optional spending limit in USD cents. Omission or null creates an unlimited
202+
session.
203+
200204
stream: Whether to stream session events as server-sent events. Defaults to `false`.
201205
202206
vault_ids: The IDs of vaults made available to the session.
@@ -223,6 +227,7 @@ def create(
223227
agent_id: str | Omit = omit,
224228
input: Union[str, Iterable[AgentSessionInputMessageParam], None] | Omit = omit,
225229
metadata: Optional[Dict[str, str]] | Omit = omit,
230+
spend_control: Optional[session_create_params.SpendControl] | Omit = omit,
226231
vault_ids: Optional[SequenceNotStr[str]] | Omit = omit,
227232
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
228233
# The extra values given here take precedence over values defined on the client or passed to this method.
@@ -255,6 +260,9 @@ def create(
255260
metadata: Up to 16 string key-value pairs, with keys up to 64 and values up to 512
256261
characters. Omission or null defaults to an empty map.
257262
263+
spend_control: Optional spending limit in USD cents. Omission or null creates an unlimited
264+
session.
265+
258266
vault_ids: The IDs of vaults made available to the session.
259267
260268
extra_headers: Send extra headers
@@ -279,6 +287,7 @@ def create(
279287
agent_id: str | Omit = omit,
280288
input: Union[str, Iterable[AgentSessionInputMessageParam], None] | Omit = omit,
281289
metadata: Optional[Dict[str, str]] | Omit = omit,
290+
spend_control: Optional[session_create_params.SpendControl] | Omit = omit,
282291
vault_ids: Optional[SequenceNotStr[str]] | Omit = omit,
283292
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
284293
# The extra values given here take precedence over values defined on the client or passed to this method.
@@ -311,6 +320,9 @@ def create(
311320
metadata: Up to 16 string key-value pairs, with keys up to 64 and values up to 512
312321
characters. Omission or null defaults to an empty map.
313322
323+
spend_control: Optional spending limit in USD cents. Omission or null creates an unlimited
324+
session.
325+
314326
vault_ids: The IDs of vaults made available to the session.
315327
316328
extra_headers: Send extra headers
@@ -334,6 +346,7 @@ def create(
334346
agent_id: str | Omit = omit,
335347
input: Union[str, Iterable[AgentSessionInputMessageParam], None] | Omit = omit,
336348
metadata: Optional[Dict[str, str]] | Omit = omit,
349+
spend_control: Optional[session_create_params.SpendControl] | Omit = omit,
337350
stream: Literal[False] | Literal[True] | Omit = omit,
338351
vault_ids: Optional[SequenceNotStr[str]] | Omit = omit,
339352
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
@@ -360,6 +373,7 @@ def create(
360373
"agent_id": agent_id,
361374
"input": input,
362375
"metadata": metadata,
376+
"spend_control": spend_control,
363377
"vault_ids": vault_ids,
364378
},
365379
session_create_params.SessionCreateParamsStreaming
@@ -425,6 +439,7 @@ def update(
425439
*,
426440
agent: session_update_params.Agent | Omit = omit,
427441
metadata: Optional[Dict[str, str]] | Omit = omit,
442+
spend_control: Optional[session_update_params.SpendControl] | Omit = omit,
428443
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
429444
# The extra values given here take precedence over values defined on the client or passed to this method.
430445
extra_headers: Headers | None = None,
@@ -445,6 +460,9 @@ def update(
445460
Up to 16 string key-value pairs, with keys up to 64 and values up to 512
446461
characters.
447462
463+
spend_control: Omit to retain the limit; null or a null limit removes it without resetting
464+
spend.
465+
448466
extra_headers: Send extra headers
449467
450468
extra_query: Add additional query parameters to the request
@@ -462,6 +480,7 @@ def update(
462480
{
463481
"agent": agent,
464482
"metadata": metadata,
483+
"spend_control": spend_control,
465484
},
466485
session_update_params.SessionUpdateParams,
467486
),
@@ -669,6 +688,7 @@ async def create(
669688
agent_id: str | Omit = omit,
670689
input: Union[str, Iterable[AgentSessionInputMessageParam], None] | Omit = omit,
671690
metadata: Optional[Dict[str, str]] | Omit = omit,
691+
spend_control: Optional[session_create_params.SpendControl] | Omit = omit,
672692
stream: Literal[False] | Omit = omit,
673693
vault_ids: Optional[SequenceNotStr[str]] | Omit = omit,
674694
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
@@ -700,6 +720,9 @@ async def create(
700720
metadata: Up to 16 string key-value pairs, with keys up to 64 and values up to 512
701721
characters. Omission or null defaults to an empty map.
702722
723+
spend_control: Optional spending limit in USD cents. Omission or null creates an unlimited
724+
session.
725+
703726
stream: Whether to stream session events as server-sent events. Defaults to `false`.
704727
705728
vault_ids: The IDs of vaults made available to the session.
@@ -726,6 +749,7 @@ async def create(
726749
agent_id: str | Omit = omit,
727750
input: Union[str, Iterable[AgentSessionInputMessageParam], None] | Omit = omit,
728751
metadata: Optional[Dict[str, str]] | Omit = omit,
752+
spend_control: Optional[session_create_params.SpendControl] | Omit = omit,
729753
vault_ids: Optional[SequenceNotStr[str]] | Omit = omit,
730754
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
731755
# The extra values given here take precedence over values defined on the client or passed to this method.
@@ -758,6 +782,9 @@ async def create(
758782
metadata: Up to 16 string key-value pairs, with keys up to 64 and values up to 512
759783
characters. Omission or null defaults to an empty map.
760784
785+
spend_control: Optional spending limit in USD cents. Omission or null creates an unlimited
786+
session.
787+
761788
vault_ids: The IDs of vaults made available to the session.
762789
763790
extra_headers: Send extra headers
@@ -782,6 +809,7 @@ async def create(
782809
agent_id: str | Omit = omit,
783810
input: Union[str, Iterable[AgentSessionInputMessageParam], None] | Omit = omit,
784811
metadata: Optional[Dict[str, str]] | Omit = omit,
812+
spend_control: Optional[session_create_params.SpendControl] | Omit = omit,
785813
vault_ids: Optional[SequenceNotStr[str]] | Omit = omit,
786814
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
787815
# The extra values given here take precedence over values defined on the client or passed to this method.
@@ -814,6 +842,9 @@ async def create(
814842
metadata: Up to 16 string key-value pairs, with keys up to 64 and values up to 512
815843
characters. Omission or null defaults to an empty map.
816844
845+
spend_control: Optional spending limit in USD cents. Omission or null creates an unlimited
846+
session.
847+
817848
vault_ids: The IDs of vaults made available to the session.
818849
819850
extra_headers: Send extra headers
@@ -837,6 +868,7 @@ async def create(
837868
agent_id: str | Omit = omit,
838869
input: Union[str, Iterable[AgentSessionInputMessageParam], None] | Omit = omit,
839870
metadata: Optional[Dict[str, str]] | Omit = omit,
871+
spend_control: Optional[session_create_params.SpendControl] | Omit = omit,
840872
stream: Literal[False] | Literal[True] | Omit = omit,
841873
vault_ids: Optional[SequenceNotStr[str]] | Omit = omit,
842874
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
@@ -865,6 +897,7 @@ async def create(
865897
"agent_id": agent_id,
866898
"input": input,
867899
"metadata": metadata,
900+
"spend_control": spend_control,
868901
"vault_ids": vault_ids,
869902
},
870903
session_create_params.SessionCreateParamsStreaming
@@ -930,6 +963,7 @@ async def update(
930963
*,
931964
agent: session_update_params.Agent | Omit = omit,
932965
metadata: Optional[Dict[str, str]] | Omit = omit,
966+
spend_control: Optional[session_update_params.SpendControl] | Omit = omit,
933967
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
934968
# The extra values given here take precedence over values defined on the client or passed to this method.
935969
extra_headers: Headers | None = None,
@@ -950,6 +984,9 @@ async def update(
950984
Up to 16 string key-value pairs, with keys up to 64 and values up to 512
951985
characters.
952986
987+
spend_control: Omit to retain the limit; null or a null limit removes it without resetting
988+
spend.
989+
953990
extra_headers: Send extra headers
954991
955992
extra_query: Add additional query parameters to the request
@@ -967,6 +1004,7 @@ async def update(
9671004
{
9681005
"agent": agent,
9691006
"metadata": metadata,
1007+
"spend_control": spend_control,
9701008
},
9711009
session_update_params.SessionUpdateParams,
9721010
),

‎src/openai/types/beta/agent_session.py‎

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
"RequiredActionSessionRequiredActionResourceComputerUseApprovalRequestRequestComputerUseApprovalRequestKindResourceBrowserOriginAccess",
2525
"RequiredActionSessionRequiredActionResourceFunctionCall",
2626
"RequiredActionSessionRequiredActionResourceEnvironmentConnection",
27+
"SpendControl",
2728
]
2829

2930

@@ -198,6 +199,21 @@ class RequiredActionSessionRequiredActionResourceEnvironmentConnection(BaseModel
198199
]
199200

200201

202+
class SpendControl(BaseModel):
203+
"""Configured spending limit and best-effort consumption, in USD cents.
204+
205+
Unlimited sessions omit this object.
206+
"""
207+
208+
consumed: Optional[int] = None
209+
"""
210+
Best-effort recorded spend floored to whole USD cents, or null when unavailable.
211+
"""
212+
213+
limit: int
214+
"""The configured positive limit in USD cents."""
215+
216+
201217
class AgentSession(BaseModel):
202218
"""A Managed Agents session."""
203219

@@ -246,3 +262,9 @@ class AgentSession(BaseModel):
246262

247263
vault_ids: List[str]
248264
"""The IDs of vaults made available to the session."""
265+
266+
spend_control: Optional[SpendControl] = None
267+
"""Configured spending limit and best-effort consumption, in USD cents.
268+
269+
Unlimited sessions omit this object.
270+
"""

‎src/openai/types/beta/agents/session_create_params.py‎

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,13 @@
1313
from ..multi_agent_config_param import MultiAgentConfigParam
1414
from ..agent_session_input_message_param import AgentSessionInputMessageParam
1515

16-
__all__ = ["SessionCreateParamsBase", "Agent", "SessionCreateParamsNonStreaming", "SessionCreateParamsStreaming"]
16+
__all__ = [
17+
"SessionCreateParamsBase",
18+
"Agent",
19+
"SpendControl",
20+
"SessionCreateParamsNonStreaming",
21+
"SessionCreateParamsStreaming",
22+
]
1723

1824

1925
class SessionCreateParamsBase(TypedDict, total=False):
@@ -48,6 +54,12 @@ class SessionCreateParamsBase(TypedDict, total=False):
4854
characters. Omission or null defaults to an empty map.
4955
"""
5056

57+
spend_control: Optional[SpendControl]
58+
"""Optional spending limit in USD cents.
59+
60+
Omission or null creates an unlimited session.
61+
"""
62+
5163
vault_ids: Optional[SequenceNotStr[str]]
5264
"""The IDs of vaults made available to the session."""
5365

@@ -94,6 +106,16 @@ class Agent(TypedDict, total=False):
94106
"""Tools available to the agent. Omit to inherit, or pass null to clear them."""
95107

96108

109+
class SpendControl(TypedDict, total=False):
110+
"""Optional spending limit in USD cents.
111+
112+
Omission or null creates an unlimited session.
113+
"""
114+
115+
limit: Required[Optional[int]]
116+
"""Positive USD cents, or null to remove the limit."""
117+
118+
97119
class SessionCreateParamsNonStreaming(SessionCreateParamsBase, total=False):
98120
stream: Literal[False]
99121
"""Whether to stream session events as server-sent events. Defaults to `false`."""

0 commit comments

Comments
 (0)