### Install Dependencies Source: https://github.com/agntcy/acp-sdk/blob/main/examples/echo-agent/README.md Installs project dependencies using uv. ```shell uv sync ``` -------------------------------- ### Install Dependencies and Run Interrupt Agent Source: https://github.com/agntcy/acp-sdk/blob/main/examples/interrupt/README.md Installs project dependencies using Poetry and then runs the interrupt agent script. Ensure you have Poetry installed and configured. ```bash poetry install python interrupt/interrupt.py ``` -------------------------------- ### AsyncACPClient Initialization Source: https://github.com/agntcy/acp-sdk/blob/main/docs/html/agntcy_acp.html Provides asynchronous methods to instantiate the AsyncACPClient, supporting configuration-based or environment-prefix-based setup. ```APIDOC ## AsyncACPClient ### Description Represents the asynchronous client for interacting with the ACP service. ### Methods #### `fromConfiguration(configuration: ApiClientConfiguration)` Asynchronously initializes the AsyncACPClient using a provided ApiClientConfiguration object. #### `fromEnvPrefix(prefix: str)` Asynchronously initializes the AsyncACPClient using environment variables prefixed with the given string. ``` -------------------------------- ### Get Host Settings Array Source: https://github.com/agntcy/acp-sdk/blob/main/docs/html/_modules/agntcy_acp/acp_v0/configuration.html Returns a list of host settings, where each setting includes a URL and a description. Currently, it provides a single default entry. ```python def get_host_settings(self) -> List[HostSetting]: """Gets an array of host settings :return: An array of host settings """ return [ { 'url': "", 'description': "No description provided", } ] ``` -------------------------------- ### Default ApiClient Instance Source: https://github.com/agntcy/acp-sdk/blob/main/docs/html/_modules/agntcy_acp/acp_v0/async_client/api_client.html Explains how to get and set a default instance of the ApiClient that can be used globally. ```APIDOC ## Default ApiClient Instance ### Description Provides class methods to manage a singleton default instance of the `ApiClient`. ### Methods - **`ApiClient.get_default()`**: Returns the default `ApiClient` instance. Creates one if it doesn't exist. - **`ApiClient.set_default(default: ApiClient)`**: Sets a specific `ApiClient` instance as the default. ### Example ```python from agntcy_acp.acp_v0.api_client import ApiClient # Get the default client default_client = ApiClient.get_default() # Create a new client and set it as default new_client = ApiClient() ApiClient.set_default(new_client) # Verify assert ApiClient.get_default() is new_client ``` ``` -------------------------------- ### Construct ApiClientConfiguration from Environment Variables Source: https://github.com/agntcy/acp-sdk/blob/main/docs/html/_modules/agntcy_acp/client.html Use this class method to create an ApiClientConfiguration object by reading parameters from environment variables. The `env_var_prefix` is used to namespace the environment variables. For example, `MY_HOST` would be used for the `host` parameter if `env_var_prefix` is 'MY_'. ```python from typing import Optional, Dict, List, Union from pathlib import Path from agntcy_acp.client import ApiClient, ApiClientConfiguration from agntcy_acp.models.agent_manifest import AgentManifest from agntcy_acp.models.agent_acp_spec import AgentACPSpec from agntcy_acp.api.agents import AgentsApi from agntcy_acp.api.stateless_runs import StatelessRunsApi from agntcy_acp.api.threads import ThreadsApi from agntcy_acp.api.thread_runs import ThreadRunsApi class ACPClient(AgentsApi, StatelessRunsApi, ThreadsApi, ThreadRunsApi): """Client for ACP API.""" def __init__( self, api_client: Optional[ApiClient] = None, configuration: Optional[ApiClientConfiguration] = None, manifest: Optional[Union[str, Path, AgentManifest, AgentACPSpec]] = None, stream_chunk_size: int = 4096, ): if api_client is None and configuration is not None: api_client = ApiClient(configuration) super().__init__(api_client) self.__workflow_server_update_api_client() self.stream_chunk_size = stream_chunk_size # Example usage (assuming environment variables are set): # config = ApiClientConfiguration.fromEnvPrefix("MY_") # client = ACPClient(configuration=config) ``` -------------------------------- ### Get Host URL from Settings Source: https://github.com/agntcy/acp-sdk/blob/main/docs/html/_modules/agntcy_acp/acp_v0/configuration.html Constructs a host URL based on an index, optional variables, and a list of server settings. It handles variable substitution and validates enum values. ```python def get_host_from_settings( self, index: Optional[int], variables: Optional[ServerVariablesT]=None, servers: Optional[List[HostSetting]]=None, ) -> str: """Gets host URL based on the index and variables :param index: array index of the host settings :param variables: hash of variable and the corresponding value :param servers: an array of host settings or None :return: URL based on host settings """ if index is None: return self._base_path variables = {} if variables is None else variables servers = self.get_host_settings() if servers is None else servers try: server = servers[index] except IndexError: raise ValueError( "Invalid index {0} when selecting the host settings. " "Must be less than {1}".format(index, len(servers))) url = server['url'] # go through variables and replace placeholders for variable_name, variable in server.get('variables', {}).items(): used_value = variables.get( variable_name, variable['default_value']) if 'enum_values' in variable \ and used_value not in variable['enum_values']: raise ValueError( "The variable `{0}` in the host URL has invalid value " "{1}. Must be {2}.".format( variable_name, variables[variable_name], variable['enum_values'])) url = url.replace("{" + variable_name + "}", used_value) return url ``` -------------------------------- ### Answer Agent Prompt via Workflow Server Source: https://github.com/agntcy/acp-sdk/blob/main/examples/interrupt-li/README.md Provides an example of how to send input to the interrupt agent when running with the Agent Workflow Server. This is useful for automated testing or integration. ```bash curl -s -H 'content-type: application/json' -H "x-api-key: ${API_KEY}" -d '{"agent_id": "'${AGENT_ID}'", "input": "My favorite food is pizza."}' http://127.0.0.1:${WORKFLOW_SERVER_PORT}/runs/${RUN_ID} ``` -------------------------------- ### Get API Key with Prefix Source: https://github.com/agntcy/acp-sdk/blob/main/docs/html/_modules/agntcy_acp/acp_v0/configuration.html Retrieves an API key, prepending a prefix if one is configured for the given identifier. Handles optional alias and refresh hooks. ```python def get_api_key_with_prefix(self, identifier: str, alias: Optional[str]=None) -> Optional[str]: """Gets API key (with prefix if set). :param identifier: The identifier of apiKey. :param alias: The alternative identifier of apiKey. :return: The token for api key authentication. """ if self.refresh_api_key_hook is not None: self.refresh_api_key_hook(self) key = self.api_key.get(identifier, self.api_key.get(alias) if alias is not None else None) if key: prefix = self.api_key_prefix.get(identifier) if prefix: return "%s %s" % (prefix, key) else: return key return None ``` -------------------------------- ### AsyncACPClient Context Manager Source: https://github.com/agntcy/acp-sdk/blob/main/docs/html/_modules/agntcy_acp/client.html Allows the AsyncACPClient to be used as an asynchronous context manager, ensuring proper setup and teardown of the underlying API client. ```python async def __aenter__(self): await self.api_client.__aenter__() return self async def __aexit__(self, exc_type, exc_value, traceback): await self.api_client.__aexit__(exc_type, exc_value, traceback) ``` -------------------------------- ### Get Stateless Run Operation Source: https://github.com/agntcy/acp-sdk/blob/main/test-client/README.md Example of a Jinja-templated YAML operation to retrieve a stateless run. It uses the results from a previous operation to get the run ID. ```yaml - operation_id: get_stateless_run test_input: run_id: type: str value: "{{ results[-1].run_id }}" output_at_least: status: success ``` -------------------------------- ### ApiClient Initialization and Configuration Source: https://github.com/agntcy/acp-sdk/blob/main/docs/html/_modules/agntcy_acp/acp_v0/async_client/api_client.html Demonstrates how to initialize and configure the asynchronous API client. It shows how to use default configurations or provide custom ones, and how to set default headers and cookies. ```APIDOC ## ApiClient Initialization ### Description Initializes the API client with optional configuration, headers, and cookies. ### Parameters - **configuration** (.Configuration) - Optional: Configuration object for the client. Defaults to `Configuration.get_default()`. - **header_name** (str) - Optional: Name of a custom header to pass. - **header_value** (str) - Optional: Value of the custom header. - **cookie** (str) - Optional: A cookie to include in the header. ### Example ```python from agntcy_acp.acp_v0.api_client import ApiClient from agntcy_acp.acp_v0.configuration import Configuration # Using default configuration client = ApiClient() # With custom configuration config = Configuration() config.host = "http://localhost:8080" client = ApiClient(configuration=config) # With custom header client = ApiClient(header_name="X-Custom-Header", header_value="MyValue") # With cookie client = ApiClient(cookie="sessionid=12345") ``` ``` -------------------------------- ### User-Agent Management Source: https://github.com/agntcy/acp-sdk/blob/main/docs/html/_modules/agntcy_acp/acp_v0/async_client/api_client.html Explains how to get and set the User-Agent header for API requests. ```APIDOC ## User-Agent Management ### Description Allows retrieval and modification of the User-Agent string sent with API requests. ### Properties - **user_agent** (str) - Gets or sets the User-Agent header value. ### Example ```python from agntcy_acp.acp_v0.api_client import ApiClient client = ApiClient() # Get User-Agent current_ua = client.user_agent print(f"Current User-Agent: {current_ua}") # Set User-Agent client.user_agent = "MyCustomClient/1.0" print(f"New User-Agent: {client.user_agent}") ``` ``` -------------------------------- ### AsyncACPClient.fromEnvPrefix Source: https://github.com/agntcy/acp-sdk/blob/main/docs/html/_modules/agntcy_acp/client.html Constructs an AsyncACPClient object using environment variables as default configuration values. This is a class method. ```APIDOC ## AsyncACPClient.fromEnvPrefix ### Description Constructs 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. ### Method classmethod ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Parameters * **env_var_prefix** (str) - String used as prefix for environment variable names. * **host** (Optional[str]) - Default: None * **api_key** (Optional[Dict[str, str]]) - Default: None * **api_key_prefix** (Optional[Dict[str, str]]) - Default: None * **username** (Optional[str]) - Default: None * **password** (Optional[str]) - Default: None * **access_token** (Optional[str]) - Default: None * **server_variables** (Optional[ServerVariablesT]) - Default: None * **server_operation_variables** (Optional[Dict[int, ServerVariablesT]]) - Default: None * **ssl_ca_cert** (Optional[str]) - Default: None * **retries** (Optional[int]) - Default: None * **timeout** (Optional[Union[List[Union[int, float]], int, float]]) - Default: None * **ca_cert_data** (Optional[Union[str, bytes]]) - Default: None * **debug** (Optional[bool]) - Default: None ### Returns AsyncACPClient object ``` -------------------------------- ### Set User Agent Source: https://github.com/agntcy/acp-sdk/blob/main/docs/html/_modules/agntcy_acp/acp_v0/async_client/api_client.html Allows setting and getting the User-Agent header for API requests. ```python @property def user_agent(self): """User agent for this API client""" return self.default_headers["User-Agent"] ``` ```python @user_agent.setter def user_agent(self, value): self.default_headers["User-Agent"] = value ``` -------------------------------- ### AsyncACPClient Initialization from Environment Prefix Source: https://github.com/agntcy/acp-sdk/blob/main/docs/html/agntcy_acp.html Construct an AsyncACPClient object using an environment variable prefix. This method simplifies configuration by allowing environment variables to define parameters. ```APIDOC ## AsyncACPClient.fromEnvPrefix ### Description Construct an AsyncACPClient object using an environment variable prefix. 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. ### Method classmethod ### Parameters - **env_var_prefix** (str) - String used as prefix for environment variable names. - **host** (str) - Optional - The base URL for the API. - **api_key** (str) - Optional - API key for authentication. - **api_key_prefix** (str) - Optional - Prefix for the API key. - **username** (str) - Optional - Username for basic authentication. - **password** (str) - Optional - Password for basic authentication. - **access_token** (str) - Optional - Access token for authentication. - **server_variables** (dict) - Optional - Server variables for templated URLs. - **server_operation_variables** (dict) - Optional - Server operation variables for templated URLs. - **ssl_ca_cert** (str) - Optional - Path to SSL CA certificate file. - **retries** (int) - Optional - Number of retries for failed requests. - **timeout** (float) - Optional - Request timeout in seconds. - **ca_cert_data** (str) - Optional - SSL CA certificate data. - **debug** (bool) - Optional - Enable debug logging. ### Returns Async ACP client object ### Return type [AsyncACPClient](#agntcy_acp.AsyncACPClient "agntcy_acp.AsyncACPClient") ``` -------------------------------- ### Get Thread ID from Config Source: https://github.com/agntcy/acp-sdk/blob/main/docs/html/_modules/agntcy_acp/langgraph/acp_node.html Retrieves the thread ID from the runnable configuration. Returns None if not found. ```python def _get_thread_id(self, config: RunnableConfig) -> Optional[str]: configurable = config.get("configurable", {}) thread_id = configurable.get("thread_id", None) return thread_id ``` -------------------------------- ### AsyncACPClient fromConfiguration Method Source: https://github.com/agntcy/acp-sdk/blob/main/docs/html/_modules/agntcy_acp/client.html Constructs an AsyncACPClient object using configuration values. Environment variables can be used for configuration if parameters are not explicitly provided. ```python @classmethod def fromConfiguration( cls, host: Optional[str] = None, api_key: Optional[Dict[str, str]] = None, api_key_prefix: Optional[Dict[str, str]] = None, username: Optional[str] = None, password: Optional[str] = None, access_token: Optional[str] = None, server_variables: Optional[ServerVariablesT] = None, server_operation_variables: Optional[Dict[int, ServerVariablesT]] = None, ssl_ca_cert: Optional[str] = None, retries: Optional[int] = None, timeout: Optional[Union[List[Union[int, float]], int, float]] = None, ca_cert_data: Optional[Union[str, bytes]] = None, *, debug: Optional[bool] = None, ) -> "AsyncACPClient": """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. :param env_var_prefix: String used as prefix for environment variable names. :return: Async ACP client object :rtype: AsyncACPClient """ client_config = ApiClientConfiguration( host, api_key, api_key_prefix, username, password, access_token, server_variables, server_operation_variables, ssl_ca_cert, retries, timeout, ca_cert_data, debug=debug, ) return AsyncACPClient(api_client=AsyncApiClient(client_config)) ``` -------------------------------- ### Get Generated Host Property Source: https://github.com/agntcy/acp-sdk/blob/main/docs/html/_modules/agntcy_acp/acp_v0/configuration.html Provides a property to retrieve the generated host URL using the configured server index and variables. ```python @property def host(self) -> str: """Return generated host.""" return self.get_host_from_settings(self.server_index, variables=self.server_variables) ``` -------------------------------- ### AsyncACPClient from Environment Variables Source: https://github.com/agntcy/acp-sdk/blob/main/docs/html/_modules/agntcy_acp/client.html Constructs an AsyncACPClient using environment variables for configuration. This is useful for setting up the client without hardcoding sensitive information. ```python @classmethod def fromEnvPrefix( cls, env_var_prefix: str, host: Optional[str] = None, api_key: Optional[Dict[str, str]] = None, api_key_prefix: Optional[Dict[str, str]] = None, username: Optional[str] = None, password: Optional[str] = None, access_token: Optional[str] = None, server_variables: Optional[ServerVariablesT] = None, server_operation_variables: Optional[Dict[int, ServerVariablesT]] = None, ssl_ca_cert: Optional[str] = None, retries: Optional[int] = None, timeout: Optional[Union[List[Union[int, float]], int, float]] = None, ca_cert_data: Optional[Union[str, bytes]] = None, *, debug: Optional[bool] = None, ) -> "AsyncACPClient": """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. :param env_var_prefix: String used as prefix for environment variable names. :return: Async ACP client object :rtype: AsyncACPClient """ client_config = ApiClientConfiguration.fromEnvPrefix( env_var_prefix, host, api_key, api_key_prefix, username, password, access_token, server_variables, server_operation_variables, ssl_ca_cert, retries, timeout, ca_cert_data, debug=debug, ) return AsyncACPClient(api_client=AsyncApiClient(client_config)) ``` -------------------------------- ### Client Initialization Source: https://github.com/agntcy/acp-sdk/blob/main/docs/html/genindex.html Methods for initializing ACPClient and AsyncACPClient. ```APIDOC ## ACPClient.fromConfiguration ### Description Initializes the ACPClient with a given configuration. ### Method `fromConfiguration` ### Parameters - **configuration** (object) - Required - The API client configuration object. ``` ```APIDOC ## AsyncACPClient.fromConfiguration ### Description Initializes the AsyncACPClient with a given configuration. ### Method `fromConfiguration` ### Parameters - **configuration** (object) - Required - The API client configuration object. ``` ```APIDOC ## ACPClient.fromEnvPrefix ### Description Initializes the ACPClient using environment variables with a specified prefix. ### Method `fromEnvPrefix` ### Parameters - **prefix** (str) - Optional - The prefix for environment variables. ``` ```APIDOC ## ApiClientConfiguration.fromEnvPrefix ### Description Creates an ApiClientConfiguration using environment variables with a specified prefix. ### Method `fromEnvPrefix` ### Parameters - **prefix** (str) - Optional - The prefix for environment variables. ``` ```APIDOC ## AsyncACPClient.fromEnvPrefix ### Description Initializes the AsyncACPClient using environment variables with a specified prefix. ### Method `fromEnvPrefix` ### Parameters - **prefix** (str) - Optional - The prefix for environment variables. ``` -------------------------------- ### Model Validation Example Source: https://github.com/agntcy/acp-sdk/blob/main/docs/html/_modules/agntcy_acp/acp_v0/models/value_run_interrupt_update.html Validates an object against the ValueRunInterruptUpdate model, extracting specific fields. This is useful for ensuring data integrity before processing. ```python _obj = cls.model_validate( { "type": obj.get("type"), "interrupt": obj.get("interrupt"), "run_id": obj.get("run_id"), "status": obj.get("status"), } ) return _obj ``` -------------------------------- ### Get Default ApiClient Instance Source: https://github.com/agntcy/acp-sdk/blob/main/docs/html/_modules/agntcy_acp/acp_v0/async_client/api_client.html Returns a singleton instance of ApiClient based on default configuration. Creates a new instance if none exists. ```python @classmethod def get_default(cls): """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. :return: The ApiClient object. """ if cls._default is None: cls._default = ApiClient() return cls._default ``` -------------------------------- ### ApiClientConfiguration.__init__ Source: https://github.com/agntcy/acp-sdk/blob/main/docs/html/_modules/agntcy_acp.html Initializes the API client configuration with specified parameters. Allows for detailed configuration of host, API keys, authentication credentials, server variables, and SSL settings. ```APIDOC ## ApiClientConfiguration.__init__ ### Description Initializes the API client configuration with specified parameters. Allows for detailed configuration of host, API keys, authentication credentials, server variables, and SSL settings. ### Method __init__ ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### 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[ServerVariablesT]) - 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, ServerVariablesT]]) - 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** (Optional[Union[str, bytes]]) - verify the peer using concatenated CA certificate data in PEM (str) or DER (bytes) format. * **debug** (Optional[bool]) - Debug switch. ``` -------------------------------- ### Initialize ApiClientConfiguration Source: https://github.com/agntcy/acp-sdk/blob/main/docs/html/_modules/agntcy_acp.html Initializes the API client configuration with various parameters. Use this to set up the client with specific connection details and authentication methods. ```python def __init__( self, host: Optional[str]=None, api_key: Optional[Dict[str, str]]=None, api_key_prefix: Optional[Dict[str, str]]=None, username: Optional[str]=None, password: Optional[str]=None, access_token: Optional[str]=None, server_variables: Optional[ServerVariablesT]=None, server_operation_variables: Optional[Dict[int, ServerVariablesT]]=None, ssl_ca_cert: Optional[str]=None, retries: Optional[int] = None, ca_cert_data: Optional[Union[str, bytes]] = None, *, debug: Optional[bool] = None, ): super().__init__(host, api_key, api_key_prefix, username, password, access_token, None, server_variables, None, server_operation_variables, True, ssl_ca_cert, retries, ca_cert_data, debug=debug) ``` -------------------------------- ### ACPClient Initialization Source: https://github.com/agntcy/acp-sdk/blob/main/docs/html/agntcy_acp.html Demonstrates how to construct an ACPClient object using configuration values, including environment variable support. ```APIDOC ## ACPClient.fromConfiguration ### Description 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. ### Method classmethod ### Parameters - **host** (string) - Optional - The host URL for the API. - **api_key** (string) - Optional - API key for authentication. - **api_key_prefix** (string) - Optional - Prefix for the API key. - **username** (string) - Optional - Username for basic authentication. - **password** (string) - Optional - Password for basic authentication. - **access_token** (string) - Optional - Access token for OAuth2 authentication. - **server_variables** (dict) - Optional - Server variables for dynamic endpoint configuration. - **server_operation_variables** (dict) - Optional - Server operation variables. - **ssl_ca_cert** (string) - Optional - Path to SSL CA certificate file. - **retries** (int) - Optional - Number of retries for failed requests. - **timeout** (float) - Optional - Request timeout in seconds. - **ca_cert_data** (string) - Optional - SSL CA certificate data. - **debug** (bool) - Optional - Enable debug logging. ### Returns ACP client object ### Return Type ACPClient ``` -------------------------------- ### Run Sync Test Client Source: https://github.com/agntcy/acp-sdk/blob/main/test-client/README.md Executes the test client synchronously on the stateful API set. Assumes 'uv sync' has been run. ```shell cd test-client ; uv sync && uv run cli ./examples/echo_agent_stateful.yaml ``` -------------------------------- ### add_io_mapped_edge Source: https://github.com/agntcy/acp-sdk/blob/main/docs/html/_modules/agntcy_acp/langgraph/io_mapper.html Adds a standard I/O-mapped edge between two nodes in a LangGraph StateGraph. This function configures an IOMappingAgent to handle data translation between the start and end nodes. ```APIDOC ## add_io_mapped_edge ### Description Adds an I/O-mapped edge to a LangGraph StateGraph. This function is used to establish a connection between two nodes where data translation is required. ### Method `add_io_mapped_edge` ### Parameters - `g` (StateGraph): The LangGraph StateGraph to which the edge will be added. - `start` (Union[str, acp_node.ACPNode]): The starting node of the edge. Can be a string identifier or an ACPNode instance. - `end` (Union[str, acp_node.ACPNode]): The ending node of the edge. Can be a string identifier or an ACPNode instance. - `iomapper_config` (IOMappingAgentMetadata): Metadata for the IO mapper agent, including input and output fields for data translation. - `llm` (BaseChatModel): An instance of a language model to be used by the IO mapper agent. ### Returns - `IOMappingAgent`: The configured IOMappingAgent instance. ``` -------------------------------- ### AsyncACPClient Initialization Source: https://github.com/agntcy/acp-sdk/blob/main/docs/html/_modules/agntcy_acp/client.html Initializes the AsyncACPClient. It can take an existing AsyncApiClient, or a configuration object. It also handles manifest loading for agent specifications. ```python class AsyncACPClient( AsyncAgentsApi, AsyncStatelessRunsApi, AsyncThreadsApi, AsyncThreadRunsApi ): """Async client for ACP API.""" def __init__( self, api_client: Optional[AsyncApiClient] = None, configuration: Optional[ApiClientConfiguration] = None, manifest: Optional[Union[str, Path, AgentManifest, AgentACPSpec]] = None, stream_chunk_size: int = 4096, ): if api_client is None and configuration is not None: api_client = AsyncApiClient(configuration) super().__init__(api_client) self.__workflow_server_update_api_client() self.stream_chunk_size = stream_chunk_size self.manifest = manifest self.agent_acp_spec = None ``` -------------------------------- ### AsyncACPClient.fromConfiguration Source: https://github.com/agntcy/acp-sdk/blob/main/docs/html/_modules/agntcy_acp/client.html Constructs an AsyncACPClient object using configuration values. It supports environment variables for configuration parameters if they are not explicitly provided. ```APIDOC ## AsyncACPClient.fromConfiguration ### Description 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. ### Method Signature ```python @classmethod def fromConfiguration( cls, host: Optional[str] = None, api_key: Optional[Dict[str, str]] = None, api_key_prefix: Optional[Dict[str, str]] = None, username: Optional[str] = None, password: Optional[str] = None, access_token: Optional[str] = None, server_variables: Optional[ServerVariablesT] = None, server_operation_variables: Optional[Dict[int, ServerVariablesT]] = None, ssl_ca_cert: Optional[str] = None, retries: Optional[int] = None, timeout: Optional[Union[List[Union[int, float]], int, float]] = None, ca_cert_data: Optional[Union[str, bytes]] = None, *, debug: Optional[bool] = None, ) -> "AsyncACPClient": ``` ### Parameters * **host** (Optional[str]) - The host to connect to. * **api_key** (Optional[Dict[str, str]]) - API key dictionary. * **api_key_prefix** (Optional[Dict[str, str]]) - API key prefix dictionary. * **username** (Optional[str]) - Username for basic authentication. * **password** (Optional[str]) - Password for basic authentication. * **access_token** (Optional[str]) - Access token for OAuth2 authentication. * **server_variables** (Optional[ServerVariablesT]) - Server variables for template substitution. * **server_operation_variables** (Optional[Dict[int, ServerVariablesT]]) - Server operation variables. * **ssl_ca_cert** (Optional[str]) - Path to SSL CA certificate file. * **retries** (Optional[int]) - Number of retries for requests. * **timeout** (Optional[Union[List[Union[int, float]], int, float]]) - Request timeout value(s). * **ca_cert_data** (Optional[Union[str, bytes]]) - SSL CA certificate data. * **debug** (Optional[bool]) - Enable debug logging. ### Returns * **AsyncACPClient** - An Async ACP client object. ``` -------------------------------- ### Get Basic Auth Token Source: https://github.com/agntcy/acp-sdk/blob/main/docs/html/_modules/agntcy_acp/acp_v0/configuration.html Generates an HTTP basic authentication header string from username and password. Ensures that empty strings are used if username or password are not set. ```python def get_basic_auth_token(self) -> Optional[str]: """Gets HTTP basic authentication header (string). :return: The token for basic HTTP authentication. """ username = "" if self.username is not None: username = self.username password = "" if self.password is not None: password = self.password return urllib3.util.make_headers( basic_auth=username + ':' + password ).get('authorization') ``` -------------------------------- ### Initialize ApiClient Source: https://github.com/agntcy/acp-sdk/blob/main/docs/html/_modules/agntcy_acp/acp_v0/async_client/api_client.html Initializes the ApiClient with optional configuration, headers, and cookies. Uses default configuration if none is provided. ```python def __init__( self, configuration=None, header_name=None, header_value=None, cookie=None ) -> None: # use default configuration if none is provided if configuration is None: configuration = Configuration.get_default() self.configuration = configuration self.rest_client = rest.RESTClientObject(configuration) self.default_headers = {} if header_name is not None: self.default_headers[header_name] = header_value self.cookie = cookie # Set default User-Agent. self.user_agent = "OpenAPI-Generator/1.0.0/python" self.client_side_validation = configuration.client_side_validation ``` -------------------------------- ### ApiClientConfiguration Source: https://github.com/agntcy/acp-sdk/blob/main/docs/html/_modules/agntcy_acp/client.html Configuration class for the ACP API client. It inherits from OpenAPI Generator's Configuration and Pydantic's BaseModel, allowing for flexible setup of connection parameters. ```APIDOC ## ApiClientConfiguration ### Description This class contains various settings of the API client, enabling users to configure connection details such as host, API keys, authentication credentials, server variables, SSL certificates, request retries, and timeouts. ### Parameters - **host** (Optional[str]) - Base url for the API. - **api_key** (Optional[Dict[str, str]]) - Dictionary to store API key(s). The key is the security scheme name, and the value is the API key secret. - **api_key_prefix** (Optional[Dict[str, str]]) - Dictionary to store API prefix (e.g., 'Bearer'). The key is the security scheme name, and the value is the API key prefix. - **username** (Optional[str]) - Username for HTTP basic authentication. - **password** (Optional[str]) - Password for HTTP basic authentication. - **access_token** (Optional[str]) - Access token for authentication. - **server_variables** (Optional[ServerVariablesT]) - Mapping with string values to replace variables in templated server configuration. - **server_operation_variables** (Optional[Dict[int, ServerVariablesT]]) - Mapping from operation ID to a mapping with string values to replace variables in templated server configuration. - **ssl_ca_cert** (Optional[str]) - Path to a file of concatenated CA certificates in PEM format. - **retries** (Optional[int]) - Number of retries for API requests. - **timeout** (Optional[Union[List[Union[int, float]], int, float]]) - Total timeout in seconds or a tuple for (connect, read) timeouts. - **ca_cert_data** (Optional[Union[str, bytes]]) - Verify the peer using concatenated CA certificate data in PEM (str) or DER (bytes) format. - **debug** (Optional[bool]) - Debug switch. ``` -------------------------------- ### Create Stateless Run Operation Source: https://github.com/agntcy/acp-sdk/blob/main/test-client/README.md Example of a Jinja-templated YAML operation to create a stateless run. It uses environment variables for agent ID and defines input messages. ```yaml - operation_id: create_stateless_run test_input: run_create_stateless: type: agntcy_acp.models.RunCreateStateless arguments: agent_id: "{{ env.ECHO_AGENT_AGENT_ID }}" input: messages: - type: human content: "What is up, Dude?" config: configurable: to_upper: true output_at_least: status: pending ``` -------------------------------- ### Initialize Empty Auth Settings Source: https://github.com/agntcy/acp-sdk/blob/main/docs/html/_modules/agntcy_acp/acp_v0/configuration.html Returns an empty dictionary intended for API client authentication settings. This serves as a default or placeholder. ```python def auth_settings(self)-> AuthSettings: """Gets Auth Settings dict for api client. :return: The Auth Settings information dict. """ auth: AuthSettings = {} return auth ``` -------------------------------- ### ApiClientConfiguration.fromEnvPrefix Source: https://github.com/agntcy/acp-sdk/blob/main/docs/html/_modules/agntcy_acp.html Constructs an API client configuration object using environment variables as default parameter values. This is useful for setting up configurations in different environments without hardcoding values. ```APIDOC ## ApiClientConfiguration.fromEnvPrefix ### Description Constructs an API client configuration object using environment variables as default parameter values. This is useful for setting up configurations in different environments without hardcoding values. ### Method fromEnvPrefix ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Parameters * **env_var_prefix** (str) - String used as prefix for environment variable names. * **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[ServerVariablesT]) - 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, ServerVariablesT]]) - 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** (Optional[Union[str, bytes]]) - verify the peer using concatenated CA certificate data in PEM (str) or DER (bytes) format. * **debug** (Optional[bool]) - Debug switch. ### Returns * **ApiClientConfiguration** - Configuration object ``` -------------------------------- ### Run Async Test Client Source: https://github.com/agntcy/acp-sdk/blob/main/test-client/README.md Executes the test client asynchronously on the stateless API set. Assumes 'uv sync' has been run. ```shell cd test-client ; uv sync && uv run cli --async ./examples/echo_agent_stateless.yaml ``` -------------------------------- ### RunCreate Model Source: https://github.com/agntcy/acp-sdk/blob/main/docs/html/agntcy_acp.acp_v0.models.html Payload for creating a new run. It allows specifying an agent ID, configuration, and input data. Optionally, it can define a delay before the run starts using `after_seconds`. ```APIDOC ## RunCreate Model ### Description Payload for creating a new run. It allows specifying an agent ID, configuration, and input data. Optionally, it can define a delay before the run starts using `after_seconds`. ### Attributes - **after_seconds** (integer, optional) - Delay in seconds before the run starts. - **agent_id** (string, optional) - Identifier for the agent. - **config** (Config, optional) - Configuration for the run. - **input** (dict, optional) - Input data for the run. ### Methods - **from_dict(obj)**: Create an instance of RunCreate from a dictionary. - **from_json(json_str)**: Create an instance of RunCreate from a JSON string. ``` -------------------------------- ### RunCreateStateful Methods Source: https://github.com/agntcy/acp-sdk/blob/main/docs/html/_modules/agntcy_acp/acp_v0/models/run_create_stateful.html This section details the methods available for the RunCreateStateful model, including converting the model to a string, JSON, or dictionary, and creating an instance from JSON or a dictionary. ```APIDOC ## RunCreateStateful.to_str() ### Description Returns the string representation of the model using alias. ### Method ``` def to_str(self) -> str: """Returns the string representation of the model using alias""" return pprint.pformat(self.model_dump(by_alias=True)) ``` ## RunCreateStateful.to_json() ### Description Returns the JSON representation of the model using alias. ### Method ```python def to_json(self) -> str: """Returns the JSON representation of the model using alias""" # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead return self.model_dump_json(by_alias=True, exclude_unset=True) ``` ## RunCreateStateful.from_json(json_str: str) ### Description Create an instance of RunCreateStateful from a JSON string. ### Method ```python @classmethod def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of RunCreateStateful from a JSON string""" return cls.from_dict(json.loads(json_str)) ``` ## RunCreateStateful.to_dict() ### Description Return the dictionary representation of the model using alias. This has the following differences from calling pydantic's `self.model_dump(by_alias=True)`: * `None` is only added to the output dict for nullable fields that were set at model initialization. Other fields with value `None` are ignored. ### Method ```python def to_dict(self) -> Dict[str, Any]: """Return the dictionary representation of the model using alias.""" excluded_fields: Set[str] = set([]) _dict = self.model_dump( by_alias=True, exclude=excluded_fields, exclude_none=True, ) # override the default output from pydantic by calling `to_dict()` of config if self.config: _dict["config"] = self.config.to_dict() # override the default output from pydantic by calling `to_dict()` of stream_mode if self.stream_mode: _dict["stream_mode"] = self.stream_mode.to_dict() # set to None if stream_mode (nullable) is None # and model_fields_set contains the field if self.stream_mode is None and "stream_mode" in self.model_fields_set: _dict["stream_mode"] = None return _dict ``` ## RunCreateStateful.from_dict(obj: Optional[Dict[str, Any]]) ### Description Create an instance of RunCreateStateful from a dict. ### Method ```python @classmethod def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: """Create an instance of RunCreateStateful from a dict""" if obj is None: return None if not isinstance(obj, dict): return cls.model_validate(obj) _obj = cls.model_validate( { "agent_id": obj.get("agent_id"), "input": obj.get("input"), "metadata": obj.get("metadata"), "config": Config.from_dict(obj["config"]) if obj.get("config") is not None else None, "webhook": obj.get("webhook"), "stream_mode": StreamMode.from_dict(obj["stream_mode"]) if obj.get("stream_mode") is not None else None, "on_disconnect": obj.get("on_disconnect") if obj.get("on_disconnect") is not None else "cancel", "multitask_strategy": obj.get("multitask_strategy") if obj.get("multitask_strategy") is not None else "reject", "after_seconds": obj.get("after_seconds"), "stream_subgraphs": obj.get("stream_subgraphs") if obj.get("stream_subgraphs") is not None else False, "if_not_exists": obj.get("if_not_exists") if obj.get("if_not_exists") is not None else "reject", } ) return _obj ``` ``` -------------------------------- ### StreamEventPayload Initialization Source: https://github.com/agntcy/acp-sdk/blob/main/docs/html/_modules/agntcy_acp/acp_v0/models/stream_event_payload.html Demonstrates how to initialize the StreamEventPayload model with different types of run result updates. It handles initialization using positional arguments for the actual instance or keyword arguments. ```python from agntcy_acp.acp_v0.models.stream_event_payload import StreamEventPayload from agntcy_acp.acp_v0.models.value_run_result_update import ValueRunResultUpdate # Example initialization with ValueRunResultUpdate payload_instance = StreamEventPayload(ValueRunResultUpdate(...)) # Example initialization with keyword arguments payload_instance_kw = StreamEventPayload(actual_instance=ValueRunResultUpdate(...)) ``` -------------------------------- ### Config.from_dict Source: https://github.com/agntcy/acp-sdk/blob/main/docs/html/agntcy_acp.models.html Create an instance of Config from a dict. ```APIDOC ## Config.from_dict ### Description Creates an instance of the `Config` model from a dictionary. ### Method ```python @classmethod def from_dict(cls, obj: Dict[str, Any]) -> Optional[Self] ``` ### Parameters #### Path Parameters - **obj** (Dict[str, Any]) - The dictionary to create the Config instance from. ### Returns - `Optional[Self]`: An instance of `Config` or `None` if creation fails. ``` -------------------------------- ### Create ApiClientConfiguration from Environment Variables Source: https://github.com/agntcy/acp-sdk/blob/main/docs/html/_modules/agntcy_acp.html Constructs an API client configuration object using environment variables as default values. If a parameter is not provided, it will be looked up in the environment using the specified prefix. ```python @classmethod def fromEnvPrefix( cls, env_var_prefix: str, host: Optional[str]=None, api_key: Optional[Dict[str, str]]=None, api_key_prefix: Optional[Dict[str, str]]=None, username: Optional[str]=None, password: Optional[str]=None, access_token: Optional[str]=None, server_variables: Optional[ServerVariablesT]=None, server_operation_variables: Optional[Dict[int, ServerVariablesT]]=None, ssl_ca_cert: Optional[str]=None, retries: Optional[int] = None, ca_cert_data: Optional[Union[str, bytes]] = None, *, debug: Optional[bool] = None, ) -> "ApiClientConfiguration": """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. :param env_var_prefix: String used as prefix for environment variable names. :return: Configuration object :rtype: ApiClientConfiguration """ prefix = env_var_prefix.upper() ``` -------------------------------- ### ApiClient Initialization Source: https://github.com/agntcy/acp-sdk/blob/main/docs/html/_modules/agntcy_acp/acp_v0/sync_client/api_client.html Initializes the ApiClient with optional configuration, default headers, and cookies. If no configuration is provided, it uses the default configuration. ```APIDOC ## ApiClient ### Description Generic API client for OpenAPI client library builds. 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) - Optional - Configuration object for this client. * **header_name** (str) - Optional - A header to pass when making calls to the API. * **header_value** (str) - Optional - A header value to pass when making calls to the API. * **cookie** (str) - Optional - A cookie to include in the header when making calls to the API. ``` -------------------------------- ### DeploymentOptions Model Source: https://github.com/agntcy/acp-sdk/blob/main/docs/html/agntcy_acp.html Defines options for deployment. ```APIDOC ## DeploymentOptions Model ### Description Specifies configuration options for deployments. ### Properties - `root` (any): The root configuration for deployment options. - `model_config`: Configuration for the model. ```