Skip to content

Commit 59738a2

Browse files
authored
feat(api): expand agent, image, Live, and external key support (#4269)
## Summary Adds API support for agent sessions, SVG image edits, Live sessions, and OCI external keys, along with updated API documentation. ## Changes - Configure agent session prompt-cache lifetimes and handle MCP tool approval requests. - Request SVG output from image edits and configure SVG authoring options. - Set Live session safety identifiers and handle `live.transport.connected` webhooks. - Configure OCI Vault external keys. Co-authored-by: dpiet-oai <[email protected]>
1 parent f44c1ec commit 59738a2

56 files changed

Lines changed: 1533 additions & 865 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.

‎.castiron.stats.yml‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
schema_version: 1
2-
generation_id: a703ecb8-183a-4c22-8e77-18203e398b8f
3-
openapi_spec_hash: 52d15bd95ffcc576831a8ca7e180916c
4-
openapi_transformed_spec_hash: 77b815b67f6981a5aa066591d9dac163
5-
config_hash: 01f2d28b82141ac460c9d9e8cc45ee74
6-
codegen_sha: 1b8f9204c450821b2b1348d998e8dff20643c92a
7-
codegen_hash: 0c31d87d7acc6add6f5302e2333d8b49f1bb678b7187c171e8b00dbe8ca2e4ea
2+
generation_id: 728acbb1-0215-430b-b809-3c94b73fb7b8
3+
openapi_spec_hash: 95b8b142415913b5a7beac665b74dc0e
4+
openapi_transformed_spec_hash: cf6502e7d6d450e285f5c23128167142
5+
config_hash: 324072e5fd63aac926519c90531b7789
6+
codegen_sha: 1bfd60377b278b5cfc5951d897167a214956e45f
7+
codegen_hash: 40ffb85d504b3e11a9ed15284f95e25c428d534a5072a5164e5b23cdb1d70cfc

‎api_reference/openapi.transformed.yml‎

Lines changed: 661 additions & 600 deletions
Large diffs are not rendered by default.

‎scripts/castiron/generated-files.json‎

Lines changed: 55 additions & 51 deletions
Large diffs are not rendered by default.

‎src/openai/resources/admin/organization/external_keys.py‎

Lines changed: 104 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,48 @@ def create(
187187
"""
188188
...
189189

190+
@overload
191+
def create(
192+
self,
193+
*,
194+
key_ocid: str,
195+
name: str,
196+
region: str,
197+
type: Literal["oci"],
198+
vault_ocid: str,
199+
key_version_ocid: str | Omit = omit,
200+
purpose: Union[Literal["ekm"], Literal["psp_decryption"]] | Omit = omit,
201+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
202+
# The extra values given here take precedence over values defined on the client or passed to this method.
203+
extra_headers: Headers | None = None,
204+
extra_query: Query | None = None,
205+
extra_body: Body | None = None,
206+
timeout: float | httpx2.Timeout | None | NotGiven = not_given,
207+
) -> ExternalKey:
208+
"""
209+
Add an external key config for an organization
210+
211+
Args:
212+
key_ocid: The OCI Vault key OCID
213+
214+
name: A friendly name to identify this config
215+
216+
region: The OCI region containing the vault
217+
218+
vault_ocid: The customer OCI Vault OCID
219+
220+
key_version_ocid: The exact OCI key version OCID for PSP decryption.
221+
222+
extra_headers: Send extra headers
223+
224+
extra_query: Add additional query parameters to the request
225+
226+
extra_body: Add additional JSON properties to the request
227+
228+
timeout: Override the client-level default timeout for this request, in seconds
229+
"""
230+
...
231+
190232
@required_args(
191233
["external_id", "kms_arn", "name", "role_arn", "type"],
192234
[
@@ -202,6 +244,7 @@ def create(
202244
"workload_identity_provider_id",
203245
],
204246
["key_name", "name", "tenant_id", "type", "vault_uri"],
247+
["key_ocid", "name", "region", "type", "vault_ocid"],
205248
)
206249
def create(
207250
self,
@@ -210,7 +253,7 @@ def create(
210253
kms_arn: str | Omit = omit,
211254
name: str,
212255
role_arn: str | Omit = omit,
213-
type: Literal["aws"] | Literal["gcp"] | Literal["azure"],
256+
type: Literal["aws"] | Literal["gcp"] | Literal["azure"] | Literal["oci"],
214257
purpose: Union[Literal["ekm"], Literal["psp_decryption"]] | Omit = omit,
215258
audience: str | Omit = omit,
216259
kms_key_location: str | Omit = omit,
@@ -225,6 +268,10 @@ def create(
225268
tenant_id: str | Omit = omit,
226269
vault_uri: str | Omit = omit,
227270
key_version: str | Omit = omit,
271+
key_ocid: str | Omit = omit,
272+
region: str | Omit = omit,
273+
vault_ocid: str | Omit = omit,
274+
key_version_ocid: str | Omit = omit,
228275
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
229276
# The extra values given here take precedence over values defined on the client or passed to this method.
230277
extra_headers: Headers | None = None,
@@ -255,6 +302,10 @@ def create(
255302
"tenant_id": tenant_id,
256303
"vault_uri": vault_uri,
257304
"key_version": key_version,
305+
"key_ocid": key_ocid,
306+
"region": region,
307+
"vault_ocid": vault_ocid,
308+
"key_version_ocid": key_version_ocid,
258309
},
259310
external_key_create_params.ExternalKeyCreateParams,
260311
),
@@ -595,6 +646,48 @@ async def create(
595646
"""
596647
...
597648

649+
@overload
650+
async def create(
651+
self,
652+
*,
653+
key_ocid: str,
654+
name: str,
655+
region: str,
656+
type: Literal["oci"],
657+
vault_ocid: str,
658+
key_version_ocid: str | Omit = omit,
659+
purpose: Union[Literal["ekm"], Literal["psp_decryption"]] | Omit = omit,
660+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
661+
# The extra values given here take precedence over values defined on the client or passed to this method.
662+
extra_headers: Headers | None = None,
663+
extra_query: Query | None = None,
664+
extra_body: Body | None = None,
665+
timeout: float | httpx2.Timeout | None | NotGiven = not_given,
666+
) -> ExternalKey:
667+
"""
668+
Add an external key config for an organization
669+
670+
Args:
671+
key_ocid: The OCI Vault key OCID
672+
673+
name: A friendly name to identify this config
674+
675+
region: The OCI region containing the vault
676+
677+
vault_ocid: The customer OCI Vault OCID
678+
679+
key_version_ocid: The exact OCI key version OCID for PSP decryption.
680+
681+
extra_headers: Send extra headers
682+
683+
extra_query: Add additional query parameters to the request
684+
685+
extra_body: Add additional JSON properties to the request
686+
687+
timeout: Override the client-level default timeout for this request, in seconds
688+
"""
689+
...
690+
598691
@required_args(
599692
["external_id", "kms_arn", "name", "role_arn", "type"],
600693
[
@@ -610,6 +703,7 @@ async def create(
610703
"workload_identity_provider_id",
611704
],
612705
["key_name", "name", "tenant_id", "type", "vault_uri"],
706+
["key_ocid", "name", "region", "type", "vault_ocid"],
613707
)
614708
async def create(
615709
self,
@@ -618,7 +712,7 @@ async def create(
618712
kms_arn: str | Omit = omit,
619713
name: str,
620714
role_arn: str | Omit = omit,
621-
type: Literal["aws"] | Literal["gcp"] | Literal["azure"],
715+
type: Literal["aws"] | Literal["gcp"] | Literal["azure"] | Literal["oci"],
622716
purpose: Union[Literal["ekm"], Literal["psp_decryption"]] | Omit = omit,
623717
audience: str | Omit = omit,
624718
kms_key_location: str | Omit = omit,
@@ -633,6 +727,10 @@ async def create(
633727
tenant_id: str | Omit = omit,
634728
vault_uri: str | Omit = omit,
635729
key_version: str | Omit = omit,
730+
key_ocid: str | Omit = omit,
731+
region: str | Omit = omit,
732+
vault_ocid: str | Omit = omit,
733+
key_version_ocid: str | Omit = omit,
636734
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
637735
# The extra values given here take precedence over values defined on the client or passed to this method.
638736
extra_headers: Headers | None = None,
@@ -663,6 +761,10 @@ async def create(
663761
"tenant_id": tenant_id,
664762
"vault_uri": vault_uri,
665763
"key_version": key_version,
764+
"key_ocid": key_ocid,
765+
"region": region,
766+
"vault_ocid": vault_ocid,
767+
"key_version_ocid": key_version_ocid,
666768
},
667769
external_key_create_params.ExternalKeyCreateParams,
668770
),

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

Lines changed: 28 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,7 @@ def create(
164164
agent_id: str | Omit = omit,
165165
input: Union[str, Iterable[AgentSessionInputMessageParam], None] | Omit = omit,
166166
metadata: Optional[Dict[str, str]] | Omit = omit,
167+
prompt_cache_options: Optional[session_create_params.PromptCacheOptions] | Omit = omit,
167168
review: Literal["none", "auto_review"] | Omit = omit,
168169
spend_control: Optional[session_create_params.SpendControl] | Omit = omit,
169170
stream: Literal[False] | Omit = omit,
@@ -187,6 +188,7 @@ def create(
187188
agent_id: str | Omit = omit,
188189
input: Union[str, Iterable[AgentSessionInputMessageParam], None] | Omit = omit,
189190
metadata: Optional[Dict[str, str]] | Omit = omit,
191+
prompt_cache_options: Optional[session_create_params.PromptCacheOptions] | Omit = omit,
190192
review: Literal["none", "auto_review"] | Omit = omit,
191193
spend_control: Optional[session_create_params.SpendControl] | Omit = omit,
192194
stream_options: session_create_params.StreamOptions | Omit = omit,
@@ -209,6 +211,7 @@ def create(
209211
agent_id: str | Omit = omit,
210212
input: Union[str, Iterable[AgentSessionInputMessageParam], None] | Omit = omit,
211213
metadata: Optional[Dict[str, str]] | Omit = omit,
214+
prompt_cache_options: Optional[session_create_params.PromptCacheOptions] | Omit = omit,
212215
review: Literal["none", "auto_review"] | Omit = omit,
213216
spend_control: Optional[session_create_params.SpendControl] | Omit = omit,
214217
stream_options: session_create_params.StreamOptions | Omit = omit,
@@ -230,6 +233,7 @@ def create(
230233
agent_id: str | Omit = omit,
231234
input: Union[str, Iterable[AgentSessionInputMessageParam], None] | Omit = omit,
232235
metadata: Optional[Dict[str, str]] | Omit = omit,
236+
prompt_cache_options: Optional[session_create_params.PromptCacheOptions] | Omit = omit,
233237
review: Literal["none", "auto_review"] | Omit = omit,
234238
spend_control: Optional[session_create_params.SpendControl] | Omit = omit,
235239
stream: Literal[False] | Literal[True] | Omit = omit,
@@ -250,6 +254,7 @@ def create(
250254
"agent_id": agent_id,
251255
"input": input,
252256
"metadata": metadata,
257+
"prompt_cache_options": prompt_cache_options,
253258
"review": review,
254259
"spend_control": spend_control,
255260
"stream_options": stream_options,
@@ -328,6 +333,7 @@ def update(
328333
*,
329334
agent: session_update_params.Agent | Omit = omit,
330335
metadata: Optional[Dict[str, str]] | Omit = omit,
336+
prompt_cache_options: Optional[session_update_params.PromptCacheOptions] | Omit = omit,
331337
review: Literal["none", "auto_review"] | Omit = omit,
332338
spend_control: Optional[session_update_params.SpendControl] | Omit = omit,
333339
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
@@ -337,10 +343,10 @@ def update(
337343
extra_body: Body | None = None,
338344
timeout: float | httpx2.Timeout | None | NotGiven = not_given,
339345
) -> AgentSession:
340-
"""Updates session tools, metadata, model, reasoning effort, or service tier.
341-
342-
Model
343-
settings apply to subsequent turns. Omitted fields are unchanged. See
346+
"""
347+
Updates session tools, metadata, model, reasoning effort, service tier, or the
348+
default prompt cache lifetime. Model settings apply to subsequent turns. Omitted
349+
fields are unchanged. See
344350
[managing sessions](https://developers.openai.com/api/docs/guides/agents-api/sessions/manage).
345351
346352
Args:
@@ -350,6 +356,9 @@ def update(
350356
Up to 16 string key-value pairs, with keys up to 64 and values up to 512
351357
characters.
352358
359+
prompt_cache_options: Default prompt cache lifetime for future turns. Send null to clear the session
360+
default.
361+
353362
review: Default action review for new root turns. Existing turns and their subagents
354363
keep their review mode.
355364
@@ -377,6 +386,7 @@ def update(
377386
{
378387
"agent": agent,
379388
"metadata": metadata,
389+
"prompt_cache_options": prompt_cache_options,
380390
"review": review,
381391
"spend_control": spend_control,
382392
},
@@ -592,6 +602,7 @@ async def create(
592602
agent_id: str | Omit = omit,
593603
input: Union[str, Iterable[AgentSessionInputMessageParam], None] | Omit = omit,
594604
metadata: Optional[Dict[str, str]] | Omit = omit,
605+
prompt_cache_options: Optional[session_create_params.PromptCacheOptions] | Omit = omit,
595606
review: Literal["none", "auto_review"] | Omit = omit,
596607
spend_control: Optional[session_create_params.SpendControl] | Omit = omit,
597608
stream: Literal[False] | Omit = omit,
@@ -615,6 +626,7 @@ async def create(
615626
agent_id: str | Omit = omit,
616627
input: Union[str, Iterable[AgentSessionInputMessageParam], None] | Omit = omit,
617628
metadata: Optional[Dict[str, str]] | Omit = omit,
629+
prompt_cache_options: Optional[session_create_params.PromptCacheOptions] | Omit = omit,
618630
review: Literal["none", "auto_review"] | Omit = omit,
619631
spend_control: Optional[session_create_params.SpendControl] | Omit = omit,
620632
stream_options: session_create_params.StreamOptions | Omit = omit,
@@ -637,6 +649,7 @@ async def create(
637649
agent_id: str | Omit = omit,
638650
input: Union[str, Iterable[AgentSessionInputMessageParam], None] | Omit = omit,
639651
metadata: Optional[Dict[str, str]] | Omit = omit,
652+
prompt_cache_options: Optional[session_create_params.PromptCacheOptions] | Omit = omit,
640653
review: Literal["none", "auto_review"] | Omit = omit,
641654
spend_control: Optional[session_create_params.SpendControl] | Omit = omit,
642655
stream_options: session_create_params.StreamOptions | Omit = omit,
@@ -658,6 +671,7 @@ async def create(
658671
agent_id: str | Omit = omit,
659672
input: Union[str, Iterable[AgentSessionInputMessageParam], None] | Omit = omit,
660673
metadata: Optional[Dict[str, str]] | Omit = omit,
674+
prompt_cache_options: Optional[session_create_params.PromptCacheOptions] | Omit = omit,
661675
review: Literal["none", "auto_review"] | Omit = omit,
662676
spend_control: Optional[session_create_params.SpendControl] | Omit = omit,
663677
stream: Literal[False] | Literal[True] | Omit = omit,
@@ -678,6 +692,7 @@ async def create(
678692
"agent_id": agent_id,
679693
"input": input,
680694
"metadata": metadata,
695+
"prompt_cache_options": prompt_cache_options,
681696
"review": review,
682697
"spend_control": spend_control,
683698
"stream_options": stream_options,
@@ -756,6 +771,7 @@ async def update(
756771
*,
757772
agent: session_update_params.Agent | Omit = omit,
758773
metadata: Optional[Dict[str, str]] | Omit = omit,
774+
prompt_cache_options: Optional[session_update_params.PromptCacheOptions] | Omit = omit,
759775
review: Literal["none", "auto_review"] | Omit = omit,
760776
spend_control: Optional[session_update_params.SpendControl] | Omit = omit,
761777
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
@@ -765,10 +781,10 @@ async def update(
765781
extra_body: Body | None = None,
766782
timeout: float | httpx2.Timeout | None | NotGiven = not_given,
767783
) -> AgentSession:
768-
"""Updates session tools, metadata, model, reasoning effort, or service tier.
769-
770-
Model
771-
settings apply to subsequent turns. Omitted fields are unchanged. See
784+
"""
785+
Updates session tools, metadata, model, reasoning effort, service tier, or the
786+
default prompt cache lifetime. Model settings apply to subsequent turns. Omitted
787+
fields are unchanged. See
772788
[managing sessions](https://developers.openai.com/api/docs/guides/agents-api/sessions/manage).
773789
774790
Args:
@@ -778,6 +794,9 @@ async def update(
778794
Up to 16 string key-value pairs, with keys up to 64 and values up to 512
779795
characters.
780796
797+
prompt_cache_options: Default prompt cache lifetime for future turns. Send null to clear the session
798+
default.
799+
781800
review: Default action review for new root turns. Existing turns and their subagents
782801
keep their review mode.
783802
@@ -805,6 +824,7 @@ async def update(
805824
{
806825
"agent": agent,
807826
"metadata": metadata,
827+
"prompt_cache_options": prompt_cache_options,
808828
"review": review,
809829
"spend_control": spend_control,
810830
},

‎src/openai/resources/beta/responses/input_tokens.py‎

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -117,11 +117,15 @@ def count(
117117
tools: An array of tools the model may call while generating a response. You can
118118
specify which tool to use by setting the `tool_choice` parameter.
119119
120-
truncation: The truncation strategy to use for the model response. - `auto`: If the input to
121-
this Response exceeds the model's context window size, the model will truncate
122-
the response to fit the context window by dropping items from the beginning of
123-
the conversation. - `disabled` (default): If the input size will exceed the
124-
context window size for a model, the request will fail with a 400 error.
120+
truncation: The truncation strategy to use for the model response.
121+
122+
- `auto`: If the input to this Response exceeds the model's context window size,
123+
the model will truncate the response to fit the context window by dropping
124+
items from the beginning of the conversation. On some models, trimming can
125+
begin earlier because the API subtracts the model's maximum output allowance
126+
from its input limit before counting tokens.
127+
- `disabled` (default): If the input size will exceed the context window size
128+
for a model, the request will fail with a 400 error.
125129
126130
extra_headers: Send extra headers
127131
@@ -260,11 +264,15 @@ async def count(
260264
tools: An array of tools the model may call while generating a response. You can
261265
specify which tool to use by setting the `tool_choice` parameter.
262266
263-
truncation: The truncation strategy to use for the model response. - `auto`: If the input to
264-
this Response exceeds the model's context window size, the model will truncate
265-
the response to fit the context window by dropping items from the beginning of
266-
the conversation. - `disabled` (default): If the input size will exceed the
267-
context window size for a model, the request will fail with a 400 error.
267+
truncation: The truncation strategy to use for the model response.
268+
269+
- `auto`: If the input to this Response exceeds the model's context window size,
270+
the model will truncate the response to fit the context window by dropping
271+
items from the beginning of the conversation. On some models, trimming can
272+
begin earlier because the API subtracts the model's maximum output allowance
273+
from its input limit before counting tokens.
274+
- `disabled` (default): If the input size will exceed the context window size
275+
for a model, the request will fail with a 400 error.
268276
269277
extra_headers: Send extra headers
270278

0 commit comments

Comments
 (0)