|
3 | 3 | from __future__ import annotations |
4 | 4 |
|
5 | 5 | import json |
6 | | -from typing import Any, Union, Optional, Generator, AsyncGenerator |
| 6 | +from typing import Any, Dict, Union, Optional, Generator, AsyncGenerator |
7 | 7 | from typing_extensions import Literal |
8 | 8 |
|
9 | 9 | import httpx |
10 | 10 | from pydantic import ValidationError |
11 | 11 |
|
12 | | -from ...types import agent_rpc_params, agent_list_params, agent_rpc_by_name_params |
| 12 | +from ...types import agent_rpc_params, agent_list_params, agent_rpc_by_name_params, agent_register_build_params |
13 | 13 | from ..._types import NOT_GIVEN, Body, Omit, Query, Headers, NotGiven, omit, not_given |
14 | 14 | from ..._utils import path_template, maybe_transform, async_maybe_transform |
15 | 15 | from ..._compat import cached_property |
@@ -237,6 +237,62 @@ def delete_by_name( |
237 | 237 | cast_to=DeleteResponse, |
238 | 238 | ) |
239 | 239 |
|
| 240 | + def register_build( |
| 241 | + self, |
| 242 | + *, |
| 243 | + description: str, |
| 244 | + name: str, |
| 245 | + agent_input_type: Optional[Literal["text", "json"]] | Omit = omit, |
| 246 | + principal_context: object | Omit = omit, |
| 247 | + registration_metadata: Optional[Dict[str, object]] | Omit = omit, |
| 248 | + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. |
| 249 | + # The extra values given here take precedence over values defined on the client or passed to this method. |
| 250 | + extra_headers: Headers | None = None, |
| 251 | + extra_query: Query | None = None, |
| 252 | + extra_body: Body | None = None, |
| 253 | + timeout: float | httpx.Timeout | None | NotGiven = not_given, |
| 254 | + ) -> Agent: |
| 255 | + """ |
| 256 | + Register an agent at build time, before it is deployed, so it can be |
| 257 | + permissioned and shared prior to deploy. Idempotent by name. |
| 258 | +
|
| 259 | + Args: |
| 260 | + description: The description of the agent. |
| 261 | +
|
| 262 | + name: The unique name of the agent. |
| 263 | +
|
| 264 | + agent_input_type: The type of input the agent expects. |
| 265 | +
|
| 266 | + principal_context: Principal used for authorization |
| 267 | +
|
| 268 | + registration_metadata: The metadata for the agent's build registration. |
| 269 | +
|
| 270 | + extra_headers: Send extra headers |
| 271 | +
|
| 272 | + extra_query: Add additional query parameters to the request |
| 273 | +
|
| 274 | + extra_body: Add additional JSON properties to the request |
| 275 | +
|
| 276 | + timeout: Override the client-level default timeout for this request, in seconds |
| 277 | + """ |
| 278 | + return self._post( |
| 279 | + "/agents/register-build", |
| 280 | + body=maybe_transform( |
| 281 | + { |
| 282 | + "description": description, |
| 283 | + "name": name, |
| 284 | + "agent_input_type": agent_input_type, |
| 285 | + "principal_context": principal_context, |
| 286 | + "registration_metadata": registration_metadata, |
| 287 | + }, |
| 288 | + agent_register_build_params.AgentRegisterBuildParams, |
| 289 | + ), |
| 290 | + options=make_request_options( |
| 291 | + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout |
| 292 | + ), |
| 293 | + cast_to=Agent, |
| 294 | + ) |
| 295 | + |
240 | 296 | def retrieve_by_name( |
241 | 297 | self, |
242 | 298 | agent_name: str, |
@@ -846,6 +902,62 @@ async def delete_by_name( |
846 | 902 | cast_to=DeleteResponse, |
847 | 903 | ) |
848 | 904 |
|
| 905 | + async def register_build( |
| 906 | + self, |
| 907 | + *, |
| 908 | + description: str, |
| 909 | + name: str, |
| 910 | + agent_input_type: Optional[Literal["text", "json"]] | Omit = omit, |
| 911 | + principal_context: object | Omit = omit, |
| 912 | + registration_metadata: Optional[Dict[str, object]] | Omit = omit, |
| 913 | + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. |
| 914 | + # The extra values given here take precedence over values defined on the client or passed to this method. |
| 915 | + extra_headers: Headers | None = None, |
| 916 | + extra_query: Query | None = None, |
| 917 | + extra_body: Body | None = None, |
| 918 | + timeout: float | httpx.Timeout | None | NotGiven = not_given, |
| 919 | + ) -> Agent: |
| 920 | + """ |
| 921 | + Register an agent at build time, before it is deployed, so it can be |
| 922 | + permissioned and shared prior to deploy. Idempotent by name. |
| 923 | +
|
| 924 | + Args: |
| 925 | + description: The description of the agent. |
| 926 | +
|
| 927 | + name: The unique name of the agent. |
| 928 | +
|
| 929 | + agent_input_type: The type of input the agent expects. |
| 930 | +
|
| 931 | + principal_context: Principal used for authorization |
| 932 | +
|
| 933 | + registration_metadata: The metadata for the agent's build registration. |
| 934 | +
|
| 935 | + extra_headers: Send extra headers |
| 936 | +
|
| 937 | + extra_query: Add additional query parameters to the request |
| 938 | +
|
| 939 | + extra_body: Add additional JSON properties to the request |
| 940 | +
|
| 941 | + timeout: Override the client-level default timeout for this request, in seconds |
| 942 | + """ |
| 943 | + return await self._post( |
| 944 | + "/agents/register-build", |
| 945 | + body=await async_maybe_transform( |
| 946 | + { |
| 947 | + "description": description, |
| 948 | + "name": name, |
| 949 | + "agent_input_type": agent_input_type, |
| 950 | + "principal_context": principal_context, |
| 951 | + "registration_metadata": registration_metadata, |
| 952 | + }, |
| 953 | + agent_register_build_params.AgentRegisterBuildParams, |
| 954 | + ), |
| 955 | + options=make_request_options( |
| 956 | + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout |
| 957 | + ), |
| 958 | + cast_to=Agent, |
| 959 | + ) |
| 960 | + |
849 | 961 | async def retrieve_by_name( |
850 | 962 | self, |
851 | 963 | agent_name: str, |
@@ -1287,6 +1399,9 @@ def __init__(self, agents: AgentsResource) -> None: |
1287 | 1399 | self.delete_by_name = to_raw_response_wrapper( |
1288 | 1400 | agents.delete_by_name, |
1289 | 1401 | ) |
| 1402 | + self.register_build = to_raw_response_wrapper( |
| 1403 | + agents.register_build, |
| 1404 | + ) |
1290 | 1405 | self.retrieve_by_name = to_raw_response_wrapper( |
1291 | 1406 | agents.retrieve_by_name, |
1292 | 1407 | ) |
@@ -1322,6 +1437,9 @@ def __init__(self, agents: AsyncAgentsResource) -> None: |
1322 | 1437 | self.delete_by_name = async_to_raw_response_wrapper( |
1323 | 1438 | agents.delete_by_name, |
1324 | 1439 | ) |
| 1440 | + self.register_build = async_to_raw_response_wrapper( |
| 1441 | + agents.register_build, |
| 1442 | + ) |
1325 | 1443 | self.retrieve_by_name = async_to_raw_response_wrapper( |
1326 | 1444 | agents.retrieve_by_name, |
1327 | 1445 | ) |
@@ -1357,6 +1475,9 @@ def __init__(self, agents: AgentsResource) -> None: |
1357 | 1475 | self.delete_by_name = to_streamed_response_wrapper( |
1358 | 1476 | agents.delete_by_name, |
1359 | 1477 | ) |
| 1478 | + self.register_build = to_streamed_response_wrapper( |
| 1479 | + agents.register_build, |
| 1480 | + ) |
1360 | 1481 | self.retrieve_by_name = to_streamed_response_wrapper( |
1361 | 1482 | agents.retrieve_by_name, |
1362 | 1483 | ) |
@@ -1392,6 +1513,9 @@ def __init__(self, agents: AsyncAgentsResource) -> None: |
1392 | 1513 | self.delete_by_name = async_to_streamed_response_wrapper( |
1393 | 1514 | agents.delete_by_name, |
1394 | 1515 | ) |
| 1516 | + self.register_build = async_to_streamed_response_wrapper( |
| 1517 | + agents.register_build, |
| 1518 | + ) |
1395 | 1519 | self.retrieve_by_name = async_to_streamed_response_wrapper( |
1396 | 1520 | agents.retrieve_by_name, |
1397 | 1521 | ) |
|
0 commit comments