3939 agent_create_params ,
4040 agent_update_params ,
4141 agent_retrieve_params ,
42+ agent_recompile_params ,
4243 agent_export_file_params ,
4344 agent_import_file_params ,
4445)
@@ -1038,6 +1039,58 @@ def import_file(
10381039 cast_to = AgentImportFileResponse ,
10391040 )
10401041
1042+ def recompile (
1043+ self ,
1044+ agent_id : str ,
1045+ * ,
1046+ dry_run : bool | Omit = omit ,
1047+ update_timestamp : bool | Omit = omit ,
1048+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
1049+ # The extra values given here take precedence over values defined on the client or passed to this method.
1050+ extra_headers : Headers | None = None ,
1051+ extra_query : Query | None = None ,
1052+ extra_body : Body | None = None ,
1053+ timeout : float | httpx .Timeout | None | NotGiven = not_given ,
1054+ ) -> str :
1055+ """
1056+ Manually trigger system prompt recompilation for an agent.
1057+
1058+ Args:
1059+ agent_id: The ID of the agent in the format 'agent-<uuid4>'
1060+
1061+ dry_run: If True, do not persist changes; still returns the compiled system prompt.
1062+
1063+ update_timestamp: If True, update the in-context memory last edit timestamp embedded in the system
1064+ prompt.
1065+
1066+ extra_headers: Send extra headers
1067+
1068+ extra_query: Add additional query parameters to the request
1069+
1070+ extra_body: Add additional JSON properties to the request
1071+
1072+ timeout: Override the client-level default timeout for this request, in seconds
1073+ """
1074+ if not agent_id :
1075+ raise ValueError (f"Expected a non-empty value for `agent_id` but received { agent_id !r} " )
1076+ return self ._post (
1077+ f"/v1/agents/{ agent_id } /recompile" ,
1078+ options = make_request_options (
1079+ extra_headers = extra_headers ,
1080+ extra_query = extra_query ,
1081+ extra_body = extra_body ,
1082+ timeout = timeout ,
1083+ query = maybe_transform (
1084+ {
1085+ "dry_run" : dry_run ,
1086+ "update_timestamp" : update_timestamp ,
1087+ },
1088+ agent_recompile_params .AgentRecompileParams ,
1089+ ),
1090+ ),
1091+ cast_to = str ,
1092+ )
1093+
10411094
10421095class AsyncAgentsResource (AsyncAPIResource ):
10431096 @cached_property
@@ -1953,6 +2006,58 @@ async def import_file(
19532006 cast_to = AgentImportFileResponse ,
19542007 )
19552008
2009+ async def recompile (
2010+ self ,
2011+ agent_id : str ,
2012+ * ,
2013+ dry_run : bool | Omit = omit ,
2014+ update_timestamp : bool | Omit = omit ,
2015+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
2016+ # The extra values given here take precedence over values defined on the client or passed to this method.
2017+ extra_headers : Headers | None = None ,
2018+ extra_query : Query | None = None ,
2019+ extra_body : Body | None = None ,
2020+ timeout : float | httpx .Timeout | None | NotGiven = not_given ,
2021+ ) -> str :
2022+ """
2023+ Manually trigger system prompt recompilation for an agent.
2024+
2025+ Args:
2026+ agent_id: The ID of the agent in the format 'agent-<uuid4>'
2027+
2028+ dry_run: If True, do not persist changes; still returns the compiled system prompt.
2029+
2030+ update_timestamp: If True, update the in-context memory last edit timestamp embedded in the system
2031+ prompt.
2032+
2033+ extra_headers: Send extra headers
2034+
2035+ extra_query: Add additional query parameters to the request
2036+
2037+ extra_body: Add additional JSON properties to the request
2038+
2039+ timeout: Override the client-level default timeout for this request, in seconds
2040+ """
2041+ if not agent_id :
2042+ raise ValueError (f"Expected a non-empty value for `agent_id` but received { agent_id !r} " )
2043+ return await self ._post (
2044+ f"/v1/agents/{ agent_id } /recompile" ,
2045+ options = make_request_options (
2046+ extra_headers = extra_headers ,
2047+ extra_query = extra_query ,
2048+ extra_body = extra_body ,
2049+ timeout = timeout ,
2050+ query = await async_maybe_transform (
2051+ {
2052+ "dry_run" : dry_run ,
2053+ "update_timestamp" : update_timestamp ,
2054+ },
2055+ agent_recompile_params .AgentRecompileParams ,
2056+ ),
2057+ ),
2058+ cast_to = str ,
2059+ )
2060+
19562061
19572062class AgentsResourceWithRawResponse :
19582063 def __init__ (self , agents : AgentsResource ) -> None :
@@ -1979,6 +2084,9 @@ def __init__(self, agents: AgentsResource) -> None:
19792084 self .import_file = to_raw_response_wrapper (
19802085 agents .import_file ,
19812086 )
2087+ self .recompile = to_raw_response_wrapper (
2088+ agents .recompile ,
2089+ )
19822090
19832091 @cached_property
19842092 def messages (self ) -> MessagesResourceWithRawResponse :
@@ -2042,6 +2150,9 @@ def __init__(self, agents: AsyncAgentsResource) -> None:
20422150 self .import_file = async_to_raw_response_wrapper (
20432151 agents .import_file ,
20442152 )
2153+ self .recompile = async_to_raw_response_wrapper (
2154+ agents .recompile ,
2155+ )
20452156
20462157 @cached_property
20472158 def messages (self ) -> AsyncMessagesResourceWithRawResponse :
@@ -2105,6 +2216,9 @@ def __init__(self, agents: AgentsResource) -> None:
21052216 self .import_file = to_streamed_response_wrapper (
21062217 agents .import_file ,
21072218 )
2219+ self .recompile = to_streamed_response_wrapper (
2220+ agents .recompile ,
2221+ )
21082222
21092223 @cached_property
21102224 def messages (self ) -> MessagesResourceWithStreamingResponse :
@@ -2168,6 +2282,9 @@ def __init__(self, agents: AsyncAgentsResource) -> None:
21682282 self .import_file = async_to_streamed_response_wrapper (
21692283 agents .import_file ,
21702284 )
2285+ self .recompile = async_to_streamed_response_wrapper (
2286+ agents .recompile ,
2287+ )
21712288
21722289 @cached_property
21732290 def messages (self ) -> AsyncMessagesResourceWithStreamingResponse :
0 commit comments