agntcy_acp package

Subpackages

Submodules

agntcy_acp.exceptions module

exception agntcy_acp.exceptions.ACPDescriptorValidationException[source]

Bases: Exception

exception agntcy_acp.exceptions.ACPRunException[source]

Bases: Exception

Module contents

class agntcy_acp.ACPClient(api_client=None, configuration=None, manifest=None, stream_chunk_size=4096)[source]

Bases: AgentsApi, StatelessRunsApi, ThreadsApi, ThreadRunsApi

Client for ACP API.

classmethod fromConfiguration(host=None, api_key=None, api_key_prefix=None, username=None, password=None, access_token=None, server_variables=None, server_operation_variables=None, ssl_ca_cert=None, retries=None, ca_cert_data=None, *, debug=None)[source]

Construct an ACPClient object using configuration values. For example, with env_var_prefix=”MY_”, the default host parameter value would be looked up in the “MY_HOST” environment variable if not provided.

Parameters:

env_var_prefix – String used as prefix for environment variable names.

Returns:

ACP client object

Return type:

ACPClient

classmethod fromEnvPrefix(env_var_prefix, host=None, api_key=None, api_key_prefix=None, username=None, password=None, access_token=None, server_variables=None, server_operation_variables=None, ssl_ca_cert=None, retries=None, ca_cert_data=None, *, debug=None)[source]

Construct an ACPClient object using environment variables as default source of the API client configuration values. For example, with env_var_prefix=”MY_”, the default host parameter value would be looked up in the “MY_HOST” environment variable if not provided.

Parameters:

env_var_prefix (str) – String used as prefix for environment variable names.

Returns:

ACP client object

Return type:

ACPClient

exception agntcy_acp.ACPDescriptorValidationException[source]

Bases: Exception

exception agntcy_acp.ACPRunException[source]

Bases: Exception

exception agntcy_acp.ApiAttributeError(msg, path_to_item=None)[source]

Bases: OpenApiException, AttributeError

class agntcy_acp.ApiClient(configuration=None, header_name=None, header_value=None, cookie=None)[source]

Bases: object

Generic API client for OpenAPI client library builds.

OpenAPI generic API client. This client handles the client- server communication, and is invariant across implementations. Specifics of the methods and models for each application are generated from the OpenAPI templates.

Parameters:
  • configuration – .Configuration object for this client

  • header_name – a header to pass when making calls to the API.

  • header_value – a header value to pass when making calls to the API.

  • cookie – a cookie to include in the header when making calls to the API

NATIVE_TYPES_MAPPING = {'bool': <class 'bool'>, 'date': <class 'datetime.date'>, 'datetime': <class 'datetime.datetime'>, 'decimal': <class 'decimal.Decimal'>, 'float': <class 'float'>, 'int': <class 'int'>, 'long': <class 'int'>, 'object': <class 'object'>, 'str': <class 'str'>}
PRIMITIVE_TYPES = (<class 'float'>, <class 'bool'>, <class 'bytes'>, <class 'str'>, <class 'int'>)
call_api(method, url, header_params=None, body=None, post_params=None, _request_timeout=None)[source]

Makes the HTTP request (synchronous)

Parameters:
  • method – Method to call.

  • url – Path to method endpoint.

  • header_params – Header parameters to be placed in the request header.

  • body – Request body.

  • dict (post_params) – Request post form parameters, for application/x-www-form-urlencoded, multipart/form-data.

  • _request_timeout – timeout setting for this request.

Return type:

RESTResponse

Returns:

RESTResponse

deserialize(response_text, response_type, content_type)[source]

Deserializes response into an object.

Parameters:
  • response – RESTResponse object to be deserialized.

  • response_type (str) – class literal for deserialized object, or string of class name.

  • content_type (Optional[str]) – content type of response.

Returns:

deserialized object.

files_parameters(files)[source]

Builds form parameters.

Parameters:

files (Dict[str, Union[str, bytes, List[str], List[bytes], Tuple[str, bytes]]]) – File parameters.

Returns:

Form parameters with files.

classmethod get_default()[source]

Return new instance of ApiClient.

This method returns newly created, based on default constructor, object of ApiClient class or returns a copy of default ApiClient.

Returns:

The ApiClient object.

param_serialize(method, resource_path, path_params=None, query_params=None, header_params=None, body=None, post_params=None, files=None, auth_settings=None, collection_formats=None, _host=None, _request_auth=None)[source]

Builds the HTTP request params needed by the request.

Parameters:
  • method – Method to call.

  • resource_path – Path to method endpoint.

  • path_params – Path parameters in the url.

  • query_params – Query parameters in the url.

  • header_params – Header parameters to be placed in the request header.

  • body – Request body.

  • dict (files) – Request post form parameters, for application/x-www-form-urlencoded, multipart/form-data.

  • list (auth_settings) – Auth Settings names for the request.

  • dict – key -> filename, value -> filepath, for multipart/form-data.

  • collection_formats – dict of collection formats for path, query, header, and post parameters.

  • _request_auth – set to override the auth_settings for an a single request; this effectively ignores the authentication in the spec for a single request.

Return type:

Tuple[str, str, Dict[str, str], Optional[str], List[str]]

Returns:

tuple of form (path, http_method, query_params, header_params, body, post_params, files)

parameters_to_tuples(params, collection_formats)[source]

Get parameters as list of tuples, formatting collections.

Parameters:
  • params – Parameters as dict or list of two-tuples

  • collection_formats (dict) – Parameter collection formats

Returns:

Parameters as list of tuples, collections formatted

parameters_to_url_query(params, collection_formats)[source]

Get parameters as list of tuples, formatting collections.

Parameters:
  • params – Parameters as dict or list of two-tuples

  • collection_formats (dict) – Parameter collection formats

Returns:

URL query string (e.g. a=Hello%20World&b=123)

response_deserialize(response_data, response_types_map=None)[source]

Deserializes response into an object.

Parameters:
  • response_data (RESTResponse) – RESTResponse object to be deserialized.

  • response_types_map (Optional[Dict[str, TypeVar(T)]]) – dict of response types.

Return type:

ApiResponse

Returns:

ApiResponse

sanitize_for_serialization(obj)[source]

Builds a JSON POST object.

If obj is None, return None. If obj is SecretStr, return obj.get_secret_value() If obj is str, int, long, float, bool, return directly. If obj is datetime.datetime, datetime.date convert to string in iso8601 format. If obj is decimal.Decimal return string representation. If obj is list, sanitize each element in the list. If obj is dict, return the dict. If obj is OpenAPI model, return the properties dict.

Parameters:

obj – The data to serialize.

Returns:

The serialized form of data.

select_header_accept(accepts)[source]

Returns Accept based on an array of accepts provided.

Parameters:

accepts (List[str]) – List of headers.

Return type:

Optional[str]

Returns:

Accept (e.g. application/json).

select_header_content_type(content_types)[source]

Returns Content-Type based on an array of content_types provided.

Parameters:

content_types – List of content-types.

Returns:

Content-Type (e.g. application/json).

classmethod set_default(default)[source]

Set default instance of ApiClient.

It stores default ApiClient.

Parameters:

default – object of ApiClient.

set_default_header(header_name, header_value)[source]
update_params_for_auth(headers, queries, auth_settings, resource_path, method, body, request_auth=None)[source]

Updates header and query params based on authentication setting.

Parameters:
  • headers – Header parameters dict to be updated.

  • queries – Query parameters tuple list to be updated.

  • auth_settings – Authentication setting identifiers list.

  • request_auth – if set, the provided settings will override the token in the configuration.

Resource_path:

A string representation of the HTTP request resource path.

Method:

A string representation of the HTTP request method.

Body:

A object representing the body of the HTTP request. The object type is the return value of sanitize_for_serialization().

Return type:

None

property user_agent

User agent for this API client

class agntcy_acp.ApiClientConfiguration(host=None, api_key=None, api_key_prefix=None, username=None, password=None, access_token=None, server_variables=None, server_operation_variables=None, ssl_ca_cert=None, retries=None, ca_cert_data=None, *, debug=None)[source]

Bases: Configuration, BaseModel

This class contains various settings of the API client.

Parameters:
  • host (Optional[str]) – Base url.

  • api_key (Optional[Dict[str, str]]) – Dict to store API key(s). Each entry in the dict specifies an API key. The dict key is the name of the security scheme in the OAS specification. The dict value is the API key secret.

  • api_key_prefix (Optional[Dict[str, str]]) – Dict to store API prefix (e.g. Bearer). The dict key is the name of the security scheme in the OAS specification. The dict value is an API key prefix when generating the auth data.

  • username (Optional[str]) – Username for HTTP basic authentication.

  • password (Optional[str]) – Password for HTTP basic authentication.

  • access_token (Optional[str]) – Access token.

  • server_variables (Optional[Dict[str, str]]) – Mapping with string values to replace variables in templated server configuration. The validation of enums is performed for variables with defined enum values before.

  • server_operation_variables (Optional[Dict[int, Dict[str, str]]]) – Mapping from operation ID to a mapping with string values to replace variables in templated server configuration. The validation of enums is performed for variables with defined enum values before.

  • ssl_ca_cert (Optional[str]) – str - the path to a file of concatenated CA certificates in PEM format.

  • retries (Optional[int]) – Number of retries for API requests.

  • ca_cert_data (Union[str, bytes, None]) – verify the peer using concatenated CA certificate data in PEM (str) or DER (bytes) format.

  • debug (Optional[bool]) – Debug switch.

classmethod fromEnvPrefix(env_var_prefix, host=None, api_key=None, api_key_prefix=None, username=None, password=None, access_token=None, server_variables=None, server_operation_variables=None, ssl_ca_cert=None, retries=None, ca_cert_data=None, *, debug=None)[source]

Construct a configuration object using environment variables as default source of parameter values. For example, with env_var_prefix=”MY_”, the default host parameter value would be looked up in the “MY_HOST” environment variable if not provided.

Parameters:

env_var_prefix (str) – String used as prefix for environment variable names.

Returns:

Configuration object

Return type:

ApiClientConfiguration

model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

exception agntcy_acp.ApiException(status=None, reason=None, http_resp=None, *, body=None, data=None)[source]

Bases: OpenApiException

classmethod from_response(*, http_resp, body, data)[source]
Return type:

Self

exception agntcy_acp.ApiKeyError(msg, path_to_item=None)[source]

Bases: OpenApiException, KeyError

class agntcy_acp.ApiResponse(**data)[source]

Bases: BaseModel, Generic[T]

API response object

data: T
headers: Optional[Mapping[str, str]]
model_config: ClassVar[ConfigDict] = {'arbitrary_types_allowed': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

raw_data: StrictBytes
status_code: StrictInt
exception agntcy_acp.ApiTypeError(msg, path_to_item=None, valid_classes=None, key_type=None)[source]

Bases: OpenApiException, TypeError

exception agntcy_acp.ApiValueError(msg, path_to_item=None)[source]

Bases: OpenApiException, ValueError

class agntcy_acp.AsyncACPClient(api_client=None, configuration=None, manifest=None, stream_chunk_size=4096)[source]

Bases: AgentsApi, StatelessRunsApi, ThreadsApi, ThreadRunsApi

Async client for ACP API.

classmethod fromConfiguration(host=None, api_key=None, api_key_prefix=None, username=None, password=None, access_token=None, server_variables=None, server_operation_variables=None, ssl_ca_cert=None, retries=None, ca_cert_data=None, *, debug=None)[source]

Construct an AsyncACPClient object using configuration values. For example, with env_var_prefix=”MY_”, the default host parameter value would be looked up in the “MY_HOST” environment variable if not provided.

Parameters:

env_var_prefix – String used as prefix for environment variable names.

Returns:

Async ACP client object

Return type:

AsyncACPClient

classmethod fromEnvPrefix(env_var_prefix, host=None, api_key=None, api_key_prefix=None, username=None, password=None, access_token=None, server_variables=None, server_operation_variables=None, ssl_ca_cert=None, retries=None, ca_cert_data=None, *, debug=None)[source]

Construct an AsyncACPClient object using environment variables as default source of the API client configuration values. For example, with env_var_prefix=”MY_”, the default host parameter value would be looked up in the “MY_HOST” environment variable if not provided.

Parameters:

env_var_prefix (str) – String used as prefix for environment variable names.

Returns:

Async ACP client object

Return type:

AsyncACPClient

agntcy_acp.AsyncApiClient

alias of ApiClient

exception agntcy_acp.BadRequestException(status=None, reason=None, http_resp=None, *, body=None, data=None)[source]

Bases: ApiException

exception agntcy_acp.ConflictException(status=None, reason=None, http_resp=None, *, body=None, data=None)[source]

Bases: ApiException

Exception for HTTP 409 Conflict.

exception agntcy_acp.ForbiddenException(status=None, reason=None, http_resp=None, *, body=None, data=None)[source]

Bases: ApiException

exception agntcy_acp.NotFoundException(status=None, reason=None, http_resp=None, *, body=None, data=None)[source]

Bases: ApiException

exception agntcy_acp.OpenApiException[source]

Bases: Exception

The base exception class for all OpenAPIExceptions

exception agntcy_acp.ServiceException(status=None, reason=None, http_resp=None, *, body=None, data=None)[source]

Bases: ApiException

exception agntcy_acp.UnauthorizedException(status=None, reason=None, http_resp=None, *, body=None, data=None)[source]

Bases: ApiException

exception agntcy_acp.UnprocessableEntityException(status=None, reason=None, http_resp=None, *, body=None, data=None)[source]

Bases: ApiException

Exception for HTTP 422 Unprocessable Entity.