Skip to content

Client Reference API

ACP Objects

ApiClientConfiguration

Bases: Configuration

This class contains various settings of the API client.

Parameters:

  • host (Optional[str], default: None ) –

    Base url.

  • api_key (Optional[Dict[str, str]], default: None ) –

    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]], default: None ) –

    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], default: None ) –

    Username for HTTP basic authentication.

  • password (Optional[str], default: None ) –

    Password for HTTP basic authentication.

  • access_token (Optional[str], default: None ) –

    Access token.

  • server_variables (Optional[ServerVariablesT], default: None ) –

    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]], default: None ) –

    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], default: None ) –

    str - the path to a file of concatenated CA certificates in PEM format.

  • retries (Optional[int], default: None ) –

    Number of retries for API requests.

  • ca_cert_data (Optional[Union[str, bytes]], default: None ) –

    verify the peer using concatenated CA certificate data in PEM (str) or DER (bytes) format.

  • debug (Optional[bool], default: None ) –

    Debug switch.

Source code in .venv/lib/python3.13/site-packages/agntcy_acp/__init__.py
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
class ApiClientConfiguration(Configuration):
    """This class contains various settings of the API client.

    :param host: Base url.
    :param api_key: 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.
    :param api_key_prefix: 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.
    :param username: Username for HTTP basic authentication.
    :param password: Password for HTTP basic authentication.
    :param access_token: Access token.
    :param server_variables: Mapping with string values to replace variables in
      templated server configuration. The validation of enums is performed for
      variables with defined enum values before.
    :param server_operation_variables: 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.
    :param ssl_ca_cert: str - the path to a file of concatenated CA certificates
      in PEM format.
    :param retries: Number of retries for API requests.
    :param ca_cert_data: verify the peer using concatenated CA certificate data
      in PEM (str) or DER (bytes) format.
    :param debug: Debug switch.

    """
    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)

    @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()

        if host is None:
            host = _get_envvar_param(prefix, "host")
            # Workflow server uses "endpoint"
            if host is None:
                host = _get_envvar_param(prefix, "endpoint")
        if api_key is None:
            str_value = _get_envvar_param(prefix, "api_key")
            if str_value is not None:
                api_key = json.loads(str_value)
        if api_key_prefix is None:
            str_value = _get_envvar_param(prefix, "api_key_prefix")
            if str_value is not None:
                api_key_prefix = json.loads(str_value)
        if username is None:
            username = _get_envvar_param(prefix, "username")
        if password is None:
            password = _get_envvar_param(prefix, "password")
        if access_token is None:
            access_token = _get_envvar_param(prefix, "access_token")
        if server_variables is None:
            str_value = _get_envvar_param(prefix, "server_variables")
            if str_value is not None:
                server_variables = json.loads(str_value)
        if server_operation_variables is None:
            str_value = _get_envvar_param(prefix, "server_operation_variables")
            if str_value is not None:
                server_operation_variables = json.loads(str_value)
        if ssl_ca_cert is None:
            ssl_ca_cert = _get_envvar_param(prefix, "ssl_ca_cert")
        if retries is None:
            str_value = _get_envvar_param(prefix, "retries")
            if str_value is not None:
                retries = int(str_value)
        if ca_cert_data is None:
            str_value = _get_envvar_param(prefix, "ca_cert_data")
            if str_value is not None:
                ca_cert_data = str_value
        if debug is None:
            str_value = _get_envvar_param(prefix, "debug")
            if str_value is not None:
                debug = str_value.lower() == 'true'

        return ApiClientConfiguration(
            host,
            api_key, 
            api_key_prefix,
            username,
            password,
            access_token,
            server_variables, 
            server_operation_variables, 
            ssl_ca_cert,
            retries, 
            ca_cert_data,
            debug=debug,
        )

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) classmethod

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:

  • ApiClientConfiguration

    Configuration object

Source code in .venv/lib/python3.13/site-packages/agntcy_acp/__init__.py
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
@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()

    if host is None:
        host = _get_envvar_param(prefix, "host")
        # Workflow server uses "endpoint"
        if host is None:
            host = _get_envvar_param(prefix, "endpoint")
    if api_key is None:
        str_value = _get_envvar_param(prefix, "api_key")
        if str_value is not None:
            api_key = json.loads(str_value)
    if api_key_prefix is None:
        str_value = _get_envvar_param(prefix, "api_key_prefix")
        if str_value is not None:
            api_key_prefix = json.loads(str_value)
    if username is None:
        username = _get_envvar_param(prefix, "username")
    if password is None:
        password = _get_envvar_param(prefix, "password")
    if access_token is None:
        access_token = _get_envvar_param(prefix, "access_token")
    if server_variables is None:
        str_value = _get_envvar_param(prefix, "server_variables")
        if str_value is not None:
            server_variables = json.loads(str_value)
    if server_operation_variables is None:
        str_value = _get_envvar_param(prefix, "server_operation_variables")
        if str_value is not None:
            server_operation_variables = json.loads(str_value)
    if ssl_ca_cert is None:
        ssl_ca_cert = _get_envvar_param(prefix, "ssl_ca_cert")
    if retries is None:
        str_value = _get_envvar_param(prefix, "retries")
        if str_value is not None:
            retries = int(str_value)
    if ca_cert_data is None:
        str_value = _get_envvar_param(prefix, "ca_cert_data")
        if str_value is not None:
            ca_cert_data = str_value
    if debug is None:
        str_value = _get_envvar_param(prefix, "debug")
        if str_value is not None:
            debug = str_value.lower() == 'true'

    return ApiClientConfiguration(
        host,
        api_key, 
        api_key_prefix,
        username,
        password,
        access_token,
        server_variables, 
        server_operation_variables, 
        ssl_ca_cert,
        retries, 
        ca_cert_data,
        debug=debug,
    )

ACPClient

Bases: AgentsApi, StatelessRunsApi, ThreadsApi, ThreadRunsApi

Client for ACP API.

Source code in .venv/lib/python3.13/site-packages/agntcy_acp/__init__.py
40
41
42
43
44
45
46
47
48
49
50
51
52
53
class ACPClient(AgentsApi, StatelessRunsApi, ThreadsApi, ThreadRunsApi):
    """Client for ACP API.
    """
    def __init__(self, api_client: Optional[ApiClient] = None):
        super().__init__(api_client)
        self.__workflow_server_update_api_client()

    def __workflow_server_update_api_client(self):
        if self.api_client.configuration.api_key is not None:
            # Check for 'x-api-key' config and move to header.
            try:
                self.api_client.default_headers['x-api-key'] = self.api_client.configuration.api_key['x-api-key']
            except KeyError:
                pass # ignore

AsyncACPClient

Bases: AgentsApi, StatelessRunsApi, ThreadsApi, ThreadRunsApi

Async client for ACP API.

Source code in .venv/lib/python3.13/site-packages/agntcy_acp/__init__.py
55
56
57
58
59
60
61
62
63
64
65
66
67
68
class AsyncACPClient(AsyncAgentsApi, AsyncStatelessRunsApi, AsyncThreadsApi, AsyncThreadRunsApi):
    """Async client for ACP API.
    """
    def __init__(self, api_client: Optional[AsyncApiClient] = None):
        super().__init__(api_client)
        self.__workflow_server_update_api_client()

    def __workflow_server_update_api_client(self):
        if self.api_client.configuration.api_key is not None:
            # Check for 'x-api-key' config and move to header.
            try:
                self.api_client.default_headers['x-api-key'] = self.api_client.configuration.api_key['x-api-key']
            except KeyError:
                pass # ignore

ApiClient

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

Source code in .venv/lib/python3.13/site-packages/agntcy_acp/acp_v0/sync_client/api_client.py
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
class ApiClient:
    """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.

    :param configuration: .Configuration object for this client
    :param header_name: a header to pass when making calls to the API.
    :param header_value: a header value to pass when making calls to
        the API.
    :param cookie: a cookie to include in the header when making calls
        to the API
    """

    PRIMITIVE_TYPES = (float, bool, bytes, str, int)
    NATIVE_TYPES_MAPPING = {
        'int': int,
        'long': int, # TODO remove as only py3 is supported?
        'float': float,
        'str': str,
        'bool': bool,
        'date': datetime.date,
        'datetime': datetime.datetime,
        'decimal': decimal.Decimal,
        'object': object,
    }
    _pool = None

    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

    def __enter__(self):
        return self

    def __exit__(self, exc_type, exc_value, traceback):
        pass

    @property
    def user_agent(self):
        """User agent for this API client"""
        return self.default_headers['User-Agent']

    @user_agent.setter
    def user_agent(self, value):
        self.default_headers['User-Agent'] = value

    def set_default_header(self, header_name, header_value):
        self.default_headers[header_name] = header_value


    _default = None

    @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

    @classmethod
    def set_default(cls, default):
        """Set default instance of ApiClient.

        It stores default ApiClient.

        :param default: object of ApiClient.
        """
        cls._default = default

    def param_serialize(
        self,
        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
    ) -> RequestSerialized:

        """Builds the HTTP request params needed by the request.
        :param method: Method to call.
        :param resource_path: Path to method endpoint.
        :param path_params: Path parameters in the url.
        :param query_params: Query parameters in the url.
        :param header_params: Header parameters to be
            placed in the request header.
        :param body: Request body.
        :param post_params dict: Request post form parameters,
            for `application/x-www-form-urlencoded`, `multipart/form-data`.
        :param auth_settings list: Auth Settings names for the request.
        :param files dict: key -> filename, value -> filepath,
            for `multipart/form-data`.
        :param collection_formats: dict of collection formats for path, query,
            header, and post parameters.
        :param _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: tuple of form (path, http_method, query_params, header_params,
            body, post_params, files)
        """

        config = self.configuration

        # header parameters
        header_params = header_params or {}
        header_params.update(self.default_headers)
        if self.cookie:
            header_params['Cookie'] = self.cookie
        if header_params:
            header_params = self.sanitize_for_serialization(header_params)
            header_params = dict(
                self.parameters_to_tuples(header_params,collection_formats)
            )

        # path parameters
        if path_params:
            path_params = self.sanitize_for_serialization(path_params)
            path_params = self.parameters_to_tuples(
                path_params,
                collection_formats
            )
            for k, v in path_params:
                # specified safe chars, encode everything
                resource_path = resource_path.replace(
                    '{%s}' % k,
                    quote(str(v), safe=config.safe_chars_for_path_param)
                )

        # post parameters
        if post_params or files:
            post_params = post_params if post_params else []
            post_params = self.sanitize_for_serialization(post_params)
            post_params = self.parameters_to_tuples(
                post_params,
                collection_formats
            )
            if files:
                post_params.extend(self.files_parameters(files))

        # auth setting
        self.update_params_for_auth(
            header_params,
            query_params,
            auth_settings,
            resource_path,
            method,
            body,
            request_auth=_request_auth
        )

        # body
        if body:
            body = self.sanitize_for_serialization(body)

        # request url
        if _host is None or self.configuration.ignore_operation_servers:
            url = self.configuration.host + resource_path
        else:
            # use server/host defined in path or operation instead
            url = _host + resource_path

        # query parameters
        if query_params:
            query_params = self.sanitize_for_serialization(query_params)
            url_query = self.parameters_to_url_query(
                query_params,
                collection_formats
            )
            url += "?" + url_query

        return method, url, header_params, body, post_params


    def call_api(
        self,
        method,
        url,
        header_params=None,
        body=None,
        post_params=None,
        _request_timeout=None
    ) -> rest.RESTResponse:
        """Makes the HTTP request (synchronous)
        :param method: Method to call.
        :param url: Path to method endpoint.
        :param header_params: Header parameters to be
            placed in the request header.
        :param body: Request body.
        :param post_params dict: Request post form parameters,
            for `application/x-www-form-urlencoded`, `multipart/form-data`.
        :param _request_timeout: timeout setting for this request.
        :return: RESTResponse
        """

        try:
            # perform request and return response
            response_data = self.rest_client.request(
                method, url,
                headers=header_params,
                body=body, post_params=post_params,
                _request_timeout=_request_timeout
            )

        except ApiException as e:
            raise e

        return response_data

    def response_deserialize(
        self,
        response_data: rest.RESTResponse,
        response_types_map: Optional[Dict[str, ApiResponseT]]=None
    ) -> ApiResponse[ApiResponseT]:
        """Deserializes response into an object.
        :param response_data: RESTResponse object to be deserialized.
        :param response_types_map: dict of response types.
        :return: ApiResponse
        """

        msg = "RESTResponse.read() must be called before passing it to response_deserialize()"
        assert response_data.data is not None, msg

        response_type = response_types_map.get(str(response_data.status), None)
        if not response_type and isinstance(response_data.status, int) and 100 <= response_data.status <= 599:
            # if not found, look for '1XX', '2XX', etc.
            response_type = response_types_map.get(str(response_data.status)[0] + "XX", None)

        # deserialize response data
        response_text = None
        return_data = None
        try:
            if response_type == "bytearray":
                return_data = response_data.data
            elif response_type == "file":
                return_data = self.__deserialize_file(response_data)
            elif response_type is not None:
                match = None
                content_type = response_data.getheader('content-type')
                if content_type is not None:
                    match = re.search(r"charset=([a-zA-Z\-\d]+)[\s;]?", content_type)
                encoding = match.group(1) if match else "utf-8"
                response_text = response_data.data.decode(encoding)
                return_data = self.deserialize(response_text, response_type, content_type)
        finally:
            if not 200 <= response_data.status <= 299:
                raise ApiException.from_response(
                    http_resp=response_data,
                    body=response_text,
                    data=return_data,
                )

        return ApiResponse(
            status_code = response_data.status,
            data = return_data,
            headers = response_data.getheaders(),
            raw_data = response_data.data
        )

    def sanitize_for_serialization(self, obj):
        """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.

        :param obj: The data to serialize.
        :return: The serialized form of data.
        """
        if obj is None:
            return None
        elif isinstance(obj, Enum):
            return obj.value
        elif isinstance(obj, SecretStr):
            return obj.get_secret_value()
        elif isinstance(obj, self.PRIMITIVE_TYPES):
            return obj
        elif isinstance(obj, list):
            return [
                self.sanitize_for_serialization(sub_obj) for sub_obj in obj
            ]
        elif isinstance(obj, tuple):
            return tuple(
                self.sanitize_for_serialization(sub_obj) for sub_obj in obj
            )
        elif isinstance(obj, (datetime.datetime, datetime.date)):
            return obj.isoformat()
        elif isinstance(obj, decimal.Decimal):
            return str(obj)

        elif isinstance(obj, dict):
            obj_dict = obj
        else:
            # Convert model obj to dict except
            # attributes `openapi_types`, `attribute_map`
            # and attributes which value is not None.
            # Convert attribute name to json key in
            # model definition for request.
            if hasattr(obj, 'to_dict') and callable(getattr(obj, 'to_dict')):
                obj_dict = obj.to_dict()
            else:
                obj_dict = obj.__dict__

        return {
            key: self.sanitize_for_serialization(val)
            for key, val in obj_dict.items()
        }

    def deserialize(self, response_text: str, response_type: str, content_type: Optional[str]):
        """Deserializes response into an object.

        :param response: RESTResponse object to be deserialized.
        :param response_type: class literal for
            deserialized object, or string of class name.
        :param content_type: content type of response.

        :return: deserialized object.
        """

        # fetch data from response object
        if content_type is None:
            try:
                data = json.loads(response_text)
            except ValueError:
                data = response_text
        elif re.match(r'^application/(json|[\w!#$&.+-^_]+\+json)\s*(;|$)', content_type, re.IGNORECASE):
            if response_text == "":
                data = ""
            else:
                data = json.loads(response_text)
        elif re.match(r'^text\/[a-z.+-]+\s*(;|$)', content_type, re.IGNORECASE):
            data = response_text
        else:
            raise ApiException(
                status=0,
                reason="Unsupported content type: {0}".format(content_type)
            )

        return self.__deserialize(data, response_type)

    def __deserialize(self, data, klass):
        """Deserializes dict, list, str into an object.

        :param data: dict, list or str.
        :param klass: class literal, or string of class name.

        :return: object.
        """
        if data is None:
            return None

        if isinstance(klass, str):
            if klass.startswith('List['):
                m = re.match(r'List\[(.*)]', klass)
                assert m is not None, "Malformed List type definition"
                sub_kls = m.group(1)
                return [self.__deserialize(sub_data, sub_kls)
                        for sub_data in data]

            if klass.startswith('Dict['):
                m = re.match(r'Dict\[([^,]*), (.*)]', klass)
                assert m is not None, "Malformed Dict type definition"
                sub_kls = m.group(2)
                return {k: self.__deserialize(v, sub_kls)
                        for k, v in data.items()}

            # convert str to class
            if klass in self.NATIVE_TYPES_MAPPING:
                klass = self.NATIVE_TYPES_MAPPING[klass]
            else:
                klass = getattr(agntcy_acp.acp_v0.models, klass)

        if klass in self.PRIMITIVE_TYPES:
            return self.__deserialize_primitive(data, klass)
        elif klass == object:
            return self.__deserialize_object(data)
        elif klass == datetime.date:
            return self.__deserialize_date(data)
        elif klass == datetime.datetime:
            return self.__deserialize_datetime(data)
        elif klass == decimal.Decimal:
            return decimal.Decimal(data)
        elif issubclass(klass, Enum):
            return self.__deserialize_enum(data, klass)
        else:
            return self.__deserialize_model(data, klass)

    def parameters_to_tuples(self, params, collection_formats):
        """Get parameters as list of tuples, formatting collections.

        :param params: Parameters as dict or list of two-tuples
        :param dict collection_formats: Parameter collection formats
        :return: Parameters as list of tuples, collections formatted
        """
        new_params: List[Tuple[str, str]] = []
        if collection_formats is None:
            collection_formats = {}
        for k, v in params.items() if isinstance(params, dict) else params:
            if k in collection_formats:
                collection_format = collection_formats[k]
                if collection_format == 'multi':
                    new_params.extend((k, value) for value in v)
                else:
                    if collection_format == 'ssv':
                        delimiter = ' '
                    elif collection_format == 'tsv':
                        delimiter = '\t'
                    elif collection_format == 'pipes':
                        delimiter = '|'
                    else:  # csv is the default
                        delimiter = ','
                    new_params.append(
                        (k, delimiter.join(str(value) for value in v)))
            else:
                new_params.append((k, v))
        return new_params

    def parameters_to_url_query(self, params, collection_formats):
        """Get parameters as list of tuples, formatting collections.

        :param params: Parameters as dict or list of two-tuples
        :param dict collection_formats: Parameter collection formats
        :return: URL query string (e.g. a=Hello%20World&b=123)
        """
        new_params: List[Tuple[str, str]] = []
        if collection_formats is None:
            collection_formats = {}
        for k, v in params.items() if isinstance(params, dict) else params:
            if isinstance(v, bool):
                v = str(v).lower()
            if isinstance(v, (int, float)):
                v = str(v)
            if isinstance(v, dict):
                v = json.dumps(v)

            if k in collection_formats:
                collection_format = collection_formats[k]
                if collection_format == 'multi':
                    new_params.extend((k, quote(str(value))) for value in v)
                else:
                    if collection_format == 'ssv':
                        delimiter = ' '
                    elif collection_format == 'tsv':
                        delimiter = '\t'
                    elif collection_format == 'pipes':
                        delimiter = '|'
                    else:  # csv is the default
                        delimiter = ','
                    new_params.append(
                        (k, delimiter.join(quote(str(value)) for value in v))
                    )
            else:
                new_params.append((k, quote(str(v))))

        return "&".join(["=".join(map(str, item)) for item in new_params])

    def files_parameters(
        self,
        files: Dict[str, Union[str, bytes, List[str], List[bytes], Tuple[str, bytes]]],
    ):
        """Builds form parameters.

        :param files: File parameters.
        :return: Form parameters with files.
        """
        params = []
        for k, v in files.items():
            if isinstance(v, str):
                with open(v, 'rb') as f:
                    filename = os.path.basename(f.name)
                    filedata = f.read()
            elif isinstance(v, bytes):
                filename = k
                filedata = v
            elif isinstance(v, tuple):
                filename, filedata = v
            elif isinstance(v, list):
                for file_param in v:
                    params.extend(self.files_parameters({k: file_param}))
                continue
            else:
                raise ValueError("Unsupported file value")
            mimetype = (
                mimetypes.guess_type(filename)[0]
                or 'application/octet-stream'
            )
            params.append(
                tuple([k, tuple([filename, filedata, mimetype])])
            )
        return params

    def select_header_accept(self, accepts: List[str]) -> Optional[str]:
        """Returns `Accept` based on an array of accepts provided.

        :param accepts: List of headers.
        :return: Accept (e.g. application/json).
        """
        if not accepts:
            return None

        for accept in accepts:
            if re.search('json', accept, re.IGNORECASE):
                return accept

        return accepts[0]

    def select_header_content_type(self, content_types):
        """Returns `Content-Type` based on an array of content_types provided.

        :param content_types: List of content-types.
        :return: Content-Type (e.g. application/json).
        """
        if not content_types:
            return None

        for content_type in content_types:
            if re.search('json', content_type, re.IGNORECASE):
                return content_type

        return content_types[0]

    def update_params_for_auth(
        self,
        headers,
        queries,
        auth_settings,
        resource_path,
        method,
        body,
        request_auth=None
    ) -> None:
        """Updates header and query params based on authentication setting.

        :param headers: Header parameters dict to be updated.
        :param queries: Query parameters tuple list to be updated.
        :param auth_settings: Authentication setting identifiers list.
        :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().
        :param request_auth: if set, the provided settings will
                             override the token in the configuration.
        """
        if not auth_settings:
            return

        if request_auth:
            self._apply_auth_params(
                headers,
                queries,
                resource_path,
                method,
                body,
                request_auth
            )
        else:
            for auth in auth_settings:
                auth_setting = self.configuration.auth_settings().get(auth)
                if auth_setting:
                    self._apply_auth_params(
                        headers,
                        queries,
                        resource_path,
                        method,
                        body,
                        auth_setting
                    )

    def _apply_auth_params(
        self,
        headers,
        queries,
        resource_path,
        method,
        body,
        auth_setting
    ) -> None:
        """Updates the request parameters based on a single auth_setting

        :param headers: Header parameters dict to be updated.
        :param queries: Query parameters tuple list to be updated.
        :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().
        :param auth_setting: auth settings for the endpoint
        """
        if auth_setting['in'] == 'cookie':
            headers['Cookie'] = auth_setting['value']
        elif auth_setting['in'] == 'header':
            if auth_setting['type'] != 'http-signature':
                headers[auth_setting['key']] = auth_setting['value']
        elif auth_setting['in'] == 'query':
            queries.append((auth_setting['key'], auth_setting['value']))
        else:
            raise ApiValueError(
                'Authentication token must be in `query` or `header`'
            )

    def __deserialize_file(self, response):
        """Deserializes body to file

        Saves response body into a file in a temporary folder,
        using the filename from the `Content-Disposition` header if provided.

        handle file downloading
        save response body into a tmp file and return the instance

        :param response:  RESTResponse.
        :return: file path.
        """
        fd, path = tempfile.mkstemp(dir=self.configuration.temp_folder_path)
        os.close(fd)
        os.remove(path)

        content_disposition = response.getheader("Content-Disposition")
        if content_disposition:
            m = re.search(
                r'filename=[\'"]?([^\'"\s]+)[\'"]?',
                content_disposition
            )
            assert m is not None, "Unexpected 'content-disposition' header value"
            filename = m.group(1)
            path = os.path.join(os.path.dirname(path), filename)

        with open(path, "wb") as f:
            f.write(response.data)

        return path

    def __deserialize_primitive(self, data, klass):
        """Deserializes string to primitive type.

        :param data: str.
        :param klass: class literal.

        :return: int, long, float, str, bool.
        """
        try:
            return klass(data)
        except UnicodeEncodeError:
            return str(data)
        except TypeError:
            return data

    def __deserialize_object(self, value):
        """Return an original value.

        :return: object.
        """
        return value

    def __deserialize_date(self, string):
        """Deserializes string to date.

        :param string: str.
        :return: date.
        """
        try:
            return parse(string).date()
        except ImportError:
            return string
        except ValueError:
            raise rest.ApiException(
                status=0,
                reason="Failed to parse `{0}` as date object".format(string)
            )

    def __deserialize_datetime(self, string):
        """Deserializes string to datetime.

        The string should be in iso8601 datetime format.

        :param string: str.
        :return: datetime.
        """
        try:
            return parse(string)
        except ImportError:
            return string
        except ValueError:
            raise rest.ApiException(
                status=0,
                reason=(
                    "Failed to parse `{0}` as datetime object"
                    .format(string)
                )
            )

    def __deserialize_enum(self, data, klass):
        """Deserializes primitive type to enum.

        :param data: primitive type.
        :param klass: class literal.
        :return: enum value.
        """
        try:
            return klass(data)
        except ValueError:
            raise rest.ApiException(
                status=0,
                reason=(
                    "Failed to parse `{0}` as `{1}`"
                    .format(data, klass)
                )
            )

    def __deserialize_model(self, data, klass):
        """Deserializes list or dict to model.

        :param data: dict, list.
        :param klass: class literal.
        :return: model object.
        """

        return klass.from_dict(data)

user_agent property writable

User agent for this API client

__deserialize(data, klass)

Deserializes dict, list, str into an object.

Parameters:

  • data

    dict, list or str.

  • klass

    class literal, or string of class name.

Returns:

  • object.

Source code in .venv/lib/python3.13/site-packages/agntcy_acp/acp_v0/sync_client/api_client.py
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
def __deserialize(self, data, klass):
    """Deserializes dict, list, str into an object.

    :param data: dict, list or str.
    :param klass: class literal, or string of class name.

    :return: object.
    """
    if data is None:
        return None

    if isinstance(klass, str):
        if klass.startswith('List['):
            m = re.match(r'List\[(.*)]', klass)
            assert m is not None, "Malformed List type definition"
            sub_kls = m.group(1)
            return [self.__deserialize(sub_data, sub_kls)
                    for sub_data in data]

        if klass.startswith('Dict['):
            m = re.match(r'Dict\[([^,]*), (.*)]', klass)
            assert m is not None, "Malformed Dict type definition"
            sub_kls = m.group(2)
            return {k: self.__deserialize(v, sub_kls)
                    for k, v in data.items()}

        # convert str to class
        if klass in self.NATIVE_TYPES_MAPPING:
            klass = self.NATIVE_TYPES_MAPPING[klass]
        else:
            klass = getattr(agntcy_acp.acp_v0.models, klass)

    if klass in self.PRIMITIVE_TYPES:
        return self.__deserialize_primitive(data, klass)
    elif klass == object:
        return self.__deserialize_object(data)
    elif klass == datetime.date:
        return self.__deserialize_date(data)
    elif klass == datetime.datetime:
        return self.__deserialize_datetime(data)
    elif klass == decimal.Decimal:
        return decimal.Decimal(data)
    elif issubclass(klass, Enum):
        return self.__deserialize_enum(data, klass)
    else:
        return self.__deserialize_model(data, klass)

__deserialize_date(string)

Deserializes string to date.

Parameters:

  • string

    str.

Returns:

  • date.

Source code in .venv/lib/python3.13/site-packages/agntcy_acp/acp_v0/sync_client/api_client.py
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
def __deserialize_date(self, string):
    """Deserializes string to date.

    :param string: str.
    :return: date.
    """
    try:
        return parse(string).date()
    except ImportError:
        return string
    except ValueError:
        raise rest.ApiException(
            status=0,
            reason="Failed to parse `{0}` as date object".format(string)
        )

__deserialize_datetime(string)

Deserializes string to datetime.

The string should be in iso8601 datetime format.

Parameters:

  • string

    str.

Returns:

  • datetime.

Source code in .venv/lib/python3.13/site-packages/agntcy_acp/acp_v0/sync_client/api_client.py
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
def __deserialize_datetime(self, string):
    """Deserializes string to datetime.

    The string should be in iso8601 datetime format.

    :param string: str.
    :return: datetime.
    """
    try:
        return parse(string)
    except ImportError:
        return string
    except ValueError:
        raise rest.ApiException(
            status=0,
            reason=(
                "Failed to parse `{0}` as datetime object"
                .format(string)
            )
        )

__deserialize_enum(data, klass)

Deserializes primitive type to enum.

Parameters:

  • data

    primitive type.

  • klass

    class literal.

Returns:

  • enum value.

Source code in .venv/lib/python3.13/site-packages/agntcy_acp/acp_v0/sync_client/api_client.py
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
def __deserialize_enum(self, data, klass):
    """Deserializes primitive type to enum.

    :param data: primitive type.
    :param klass: class literal.
    :return: enum value.
    """
    try:
        return klass(data)
    except ValueError:
        raise rest.ApiException(
            status=0,
            reason=(
                "Failed to parse `{0}` as `{1}`"
                .format(data, klass)
            )
        )

__deserialize_file(response)

Deserializes body to file

Saves response body into a file in a temporary folder, using the filename from the Content-Disposition header if provided.

handle file downloading save response body into a tmp file and return the instance

Parameters:

  • response

    RESTResponse.

Returns:

  • file path.

Source code in .venv/lib/python3.13/site-packages/agntcy_acp/acp_v0/sync_client/api_client.py
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
def __deserialize_file(self, response):
    """Deserializes body to file

    Saves response body into a file in a temporary folder,
    using the filename from the `Content-Disposition` header if provided.

    handle file downloading
    save response body into a tmp file and return the instance

    :param response:  RESTResponse.
    :return: file path.
    """
    fd, path = tempfile.mkstemp(dir=self.configuration.temp_folder_path)
    os.close(fd)
    os.remove(path)

    content_disposition = response.getheader("Content-Disposition")
    if content_disposition:
        m = re.search(
            r'filename=[\'"]?([^\'"\s]+)[\'"]?',
            content_disposition
        )
        assert m is not None, "Unexpected 'content-disposition' header value"
        filename = m.group(1)
        path = os.path.join(os.path.dirname(path), filename)

    with open(path, "wb") as f:
        f.write(response.data)

    return path

__deserialize_model(data, klass)

Deserializes list or dict to model.

Parameters:

  • data

    dict, list.

  • klass

    class literal.

Returns:

  • model object.

Source code in .venv/lib/python3.13/site-packages/agntcy_acp/acp_v0/sync_client/api_client.py
791
792
793
794
795
796
797
798
799
def __deserialize_model(self, data, klass):
    """Deserializes list or dict to model.

    :param data: dict, list.
    :param klass: class literal.
    :return: model object.
    """

    return klass.from_dict(data)

__deserialize_object(value)

Return an original value.

Returns:

  • object.

Source code in .venv/lib/python3.13/site-packages/agntcy_acp/acp_v0/sync_client/api_client.py
729
730
731
732
733
734
def __deserialize_object(self, value):
    """Return an original value.

    :return: object.
    """
    return value

__deserialize_primitive(data, klass)

Deserializes string to primitive type.

Parameters:

  • data

    str.

  • klass

    class literal.

Returns:

  • int, long, float, str, bool.

Source code in .venv/lib/python3.13/site-packages/agntcy_acp/acp_v0/sync_client/api_client.py
714
715
716
717
718
719
720
721
722
723
724
725
726
727
def __deserialize_primitive(self, data, klass):
    """Deserializes string to primitive type.

    :param data: str.
    :param klass: class literal.

    :return: int, long, float, str, bool.
    """
    try:
        return klass(data)
    except UnicodeEncodeError:
        return str(data)
    except TypeError:
        return data

call_api(method, url, header_params=None, body=None, post_params=None, _request_timeout=None)

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.

Returns:

  • RESTResponse

    RESTResponse

Source code in .venv/lib/python3.13/site-packages/agntcy_acp/acp_v0/sync_client/api_client.py
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
def call_api(
    self,
    method,
    url,
    header_params=None,
    body=None,
    post_params=None,
    _request_timeout=None
) -> rest.RESTResponse:
    """Makes the HTTP request (synchronous)
    :param method: Method to call.
    :param url: Path to method endpoint.
    :param header_params: Header parameters to be
        placed in the request header.
    :param body: Request body.
    :param post_params dict: Request post form parameters,
        for `application/x-www-form-urlencoded`, `multipart/form-data`.
    :param _request_timeout: timeout setting for this request.
    :return: RESTResponse
    """

    try:
        # perform request and return response
        response_data = self.rest_client.request(
            method, url,
            headers=header_params,
            body=body, post_params=post_params,
            _request_timeout=_request_timeout
        )

    except ApiException as e:
        raise e

    return response_data

deserialize(response_text, response_type, content_type)

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.

Source code in .venv/lib/python3.13/site-packages/agntcy_acp/acp_v0/sync_client/api_client.py
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
def deserialize(self, response_text: str, response_type: str, content_type: Optional[str]):
    """Deserializes response into an object.

    :param response: RESTResponse object to be deserialized.
    :param response_type: class literal for
        deserialized object, or string of class name.
    :param content_type: content type of response.

    :return: deserialized object.
    """

    # fetch data from response object
    if content_type is None:
        try:
            data = json.loads(response_text)
        except ValueError:
            data = response_text
    elif re.match(r'^application/(json|[\w!#$&.+-^_]+\+json)\s*(;|$)', content_type, re.IGNORECASE):
        if response_text == "":
            data = ""
        else:
            data = json.loads(response_text)
    elif re.match(r'^text\/[a-z.+-]+\s*(;|$)', content_type, re.IGNORECASE):
        data = response_text
    else:
        raise ApiException(
            status=0,
            reason="Unsupported content type: {0}".format(content_type)
        )

    return self.__deserialize(data, response_type)

files_parameters(files)

Builds form parameters.

Parameters:

  • files (Dict[str, Union[str, bytes, List[str], List[bytes], Tuple[str, bytes]]]) –

    File parameters.

Returns:

  • Form parameters with files.

Source code in .venv/lib/python3.13/site-packages/agntcy_acp/acp_v0/sync_client/api_client.py
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
def files_parameters(
    self,
    files: Dict[str, Union[str, bytes, List[str], List[bytes], Tuple[str, bytes]]],
):
    """Builds form parameters.

    :param files: File parameters.
    :return: Form parameters with files.
    """
    params = []
    for k, v in files.items():
        if isinstance(v, str):
            with open(v, 'rb') as f:
                filename = os.path.basename(f.name)
                filedata = f.read()
        elif isinstance(v, bytes):
            filename = k
            filedata = v
        elif isinstance(v, tuple):
            filename, filedata = v
        elif isinstance(v, list):
            for file_param in v:
                params.extend(self.files_parameters({k: file_param}))
            continue
        else:
            raise ValueError("Unsupported file value")
        mimetype = (
            mimetypes.guess_type(filename)[0]
            or 'application/octet-stream'
        )
        params.append(
            tuple([k, tuple([filename, filedata, mimetype])])
        )
    return params

get_default() classmethod

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.

Source code in .venv/lib/python3.13/site-packages/agntcy_acp/acp_v0/sync_client/api_client.py
119
120
121
122
123
124
125
126
127
128
129
130
131
@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

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)

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 (post_params) –

    Request post form parameters, for application/x-www-form-urlencoded, multipart/form-data.

  • list (auth_settings) –

    Auth Settings names for the request.

  • 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.

Returns:

  • RequestSerialized

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

Source code in .venv/lib/python3.13/site-packages/agntcy_acp/acp_v0/sync_client/api_client.py
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
def param_serialize(
    self,
    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
) -> RequestSerialized:

    """Builds the HTTP request params needed by the request.
    :param method: Method to call.
    :param resource_path: Path to method endpoint.
    :param path_params: Path parameters in the url.
    :param query_params: Query parameters in the url.
    :param header_params: Header parameters to be
        placed in the request header.
    :param body: Request body.
    :param post_params dict: Request post form parameters,
        for `application/x-www-form-urlencoded`, `multipart/form-data`.
    :param auth_settings list: Auth Settings names for the request.
    :param files dict: key -> filename, value -> filepath,
        for `multipart/form-data`.
    :param collection_formats: dict of collection formats for path, query,
        header, and post parameters.
    :param _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: tuple of form (path, http_method, query_params, header_params,
        body, post_params, files)
    """

    config = self.configuration

    # header parameters
    header_params = header_params or {}
    header_params.update(self.default_headers)
    if self.cookie:
        header_params['Cookie'] = self.cookie
    if header_params:
        header_params = self.sanitize_for_serialization(header_params)
        header_params = dict(
            self.parameters_to_tuples(header_params,collection_formats)
        )

    # path parameters
    if path_params:
        path_params = self.sanitize_for_serialization(path_params)
        path_params = self.parameters_to_tuples(
            path_params,
            collection_formats
        )
        for k, v in path_params:
            # specified safe chars, encode everything
            resource_path = resource_path.replace(
                '{%s}' % k,
                quote(str(v), safe=config.safe_chars_for_path_param)
            )

    # post parameters
    if post_params or files:
        post_params = post_params if post_params else []
        post_params = self.sanitize_for_serialization(post_params)
        post_params = self.parameters_to_tuples(
            post_params,
            collection_formats
        )
        if files:
            post_params.extend(self.files_parameters(files))

    # auth setting
    self.update_params_for_auth(
        header_params,
        query_params,
        auth_settings,
        resource_path,
        method,
        body,
        request_auth=_request_auth
    )

    # body
    if body:
        body = self.sanitize_for_serialization(body)

    # request url
    if _host is None or self.configuration.ignore_operation_servers:
        url = self.configuration.host + resource_path
    else:
        # use server/host defined in path or operation instead
        url = _host + resource_path

    # query parameters
    if query_params:
        query_params = self.sanitize_for_serialization(query_params)
        url_query = self.parameters_to_url_query(
            query_params,
            collection_formats
        )
        url += "?" + url_query

    return method, url, header_params, body, post_params

parameters_to_tuples(params, collection_formats)

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

Source code in .venv/lib/python3.13/site-packages/agntcy_acp/acp_v0/sync_client/api_client.py
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
def parameters_to_tuples(self, params, collection_formats):
    """Get parameters as list of tuples, formatting collections.

    :param params: Parameters as dict or list of two-tuples
    :param dict collection_formats: Parameter collection formats
    :return: Parameters as list of tuples, collections formatted
    """
    new_params: List[Tuple[str, str]] = []
    if collection_formats is None:
        collection_formats = {}
    for k, v in params.items() if isinstance(params, dict) else params:
        if k in collection_formats:
            collection_format = collection_formats[k]
            if collection_format == 'multi':
                new_params.extend((k, value) for value in v)
            else:
                if collection_format == 'ssv':
                    delimiter = ' '
                elif collection_format == 'tsv':
                    delimiter = '\t'
                elif collection_format == 'pipes':
                    delimiter = '|'
                else:  # csv is the default
                    delimiter = ','
                new_params.append(
                    (k, delimiter.join(str(value) for value in v)))
        else:
            new_params.append((k, v))
    return new_params

parameters_to_url_query(params, collection_formats)

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)

Source code in .venv/lib/python3.13/site-packages/agntcy_acp/acp_v0/sync_client/api_client.py
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
def parameters_to_url_query(self, params, collection_formats):
    """Get parameters as list of tuples, formatting collections.

    :param params: Parameters as dict or list of two-tuples
    :param dict collection_formats: Parameter collection formats
    :return: URL query string (e.g. a=Hello%20World&b=123)
    """
    new_params: List[Tuple[str, str]] = []
    if collection_formats is None:
        collection_formats = {}
    for k, v in params.items() if isinstance(params, dict) else params:
        if isinstance(v, bool):
            v = str(v).lower()
        if isinstance(v, (int, float)):
            v = str(v)
        if isinstance(v, dict):
            v = json.dumps(v)

        if k in collection_formats:
            collection_format = collection_formats[k]
            if collection_format == 'multi':
                new_params.extend((k, quote(str(value))) for value in v)
            else:
                if collection_format == 'ssv':
                    delimiter = ' '
                elif collection_format == 'tsv':
                    delimiter = '\t'
                elif collection_format == 'pipes':
                    delimiter = '|'
                else:  # csv is the default
                    delimiter = ','
                new_params.append(
                    (k, delimiter.join(quote(str(value)) for value in v))
                )
        else:
            new_params.append((k, quote(str(v))))

    return "&".join(["=".join(map(str, item)) for item in new_params])

response_deserialize(response_data, response_types_map=None)

Deserializes response into an object.

Parameters:

  • response_data (RESTResponse) –

    RESTResponse object to be deserialized.

  • response_types_map (Optional[Dict[str, T]], default: None ) –

    dict of response types.

Returns:

Source code in .venv/lib/python3.13/site-packages/agntcy_acp/acp_v0/sync_client/api_client.py
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
def response_deserialize(
    self,
    response_data: rest.RESTResponse,
    response_types_map: Optional[Dict[str, ApiResponseT]]=None
) -> ApiResponse[ApiResponseT]:
    """Deserializes response into an object.
    :param response_data: RESTResponse object to be deserialized.
    :param response_types_map: dict of response types.
    :return: ApiResponse
    """

    msg = "RESTResponse.read() must be called before passing it to response_deserialize()"
    assert response_data.data is not None, msg

    response_type = response_types_map.get(str(response_data.status), None)
    if not response_type and isinstance(response_data.status, int) and 100 <= response_data.status <= 599:
        # if not found, look for '1XX', '2XX', etc.
        response_type = response_types_map.get(str(response_data.status)[0] + "XX", None)

    # deserialize response data
    response_text = None
    return_data = None
    try:
        if response_type == "bytearray":
            return_data = response_data.data
        elif response_type == "file":
            return_data = self.__deserialize_file(response_data)
        elif response_type is not None:
            match = None
            content_type = response_data.getheader('content-type')
            if content_type is not None:
                match = re.search(r"charset=([a-zA-Z\-\d]+)[\s;]?", content_type)
            encoding = match.group(1) if match else "utf-8"
            response_text = response_data.data.decode(encoding)
            return_data = self.deserialize(response_text, response_type, content_type)
    finally:
        if not 200 <= response_data.status <= 299:
            raise ApiException.from_response(
                http_resp=response_data,
                body=response_text,
                data=return_data,
            )

    return ApiResponse(
        status_code = response_data.status,
        data = return_data,
        headers = response_data.getheaders(),
        raw_data = response_data.data
    )

sanitize_for_serialization(obj)

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.

Source code in .venv/lib/python3.13/site-packages/agntcy_acp/acp_v0/sync_client/api_client.py
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
def sanitize_for_serialization(self, obj):
    """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.

    :param obj: The data to serialize.
    :return: The serialized form of data.
    """
    if obj is None:
        return None
    elif isinstance(obj, Enum):
        return obj.value
    elif isinstance(obj, SecretStr):
        return obj.get_secret_value()
    elif isinstance(obj, self.PRIMITIVE_TYPES):
        return obj
    elif isinstance(obj, list):
        return [
            self.sanitize_for_serialization(sub_obj) for sub_obj in obj
        ]
    elif isinstance(obj, tuple):
        return tuple(
            self.sanitize_for_serialization(sub_obj) for sub_obj in obj
        )
    elif isinstance(obj, (datetime.datetime, datetime.date)):
        return obj.isoformat()
    elif isinstance(obj, decimal.Decimal):
        return str(obj)

    elif isinstance(obj, dict):
        obj_dict = obj
    else:
        # Convert model obj to dict except
        # attributes `openapi_types`, `attribute_map`
        # and attributes which value is not None.
        # Convert attribute name to json key in
        # model definition for request.
        if hasattr(obj, 'to_dict') and callable(getattr(obj, 'to_dict')):
            obj_dict = obj.to_dict()
        else:
            obj_dict = obj.__dict__

    return {
        key: self.sanitize_for_serialization(val)
        for key, val in obj_dict.items()
    }

select_header_accept(accepts)

Returns Accept based on an array of accepts provided.

Parameters:

  • accepts (List[str]) –

    List of headers.

Returns:

  • Optional[str]

    Accept (e.g. application/json).

Source code in .venv/lib/python3.13/site-packages/agntcy_acp/acp_v0/sync_client/api_client.py
575
576
577
578
579
580
581
582
583
584
585
586
587
588
def select_header_accept(self, accepts: List[str]) -> Optional[str]:
    """Returns `Accept` based on an array of accepts provided.

    :param accepts: List of headers.
    :return: Accept (e.g. application/json).
    """
    if not accepts:
        return None

    for accept in accepts:
        if re.search('json', accept, re.IGNORECASE):
            return accept

    return accepts[0]

select_header_content_type(content_types)

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).

Source code in .venv/lib/python3.13/site-packages/agntcy_acp/acp_v0/sync_client/api_client.py
590
591
592
593
594
595
596
597
598
599
600
601
602
603
def select_header_content_type(self, content_types):
    """Returns `Content-Type` based on an array of content_types provided.

    :param content_types: List of content-types.
    :return: Content-Type (e.g. application/json).
    """
    if not content_types:
        return None

    for content_type in content_types:
        if re.search('json', content_type, re.IGNORECASE):
            return content_type

    return content_types[0]

set_default(default) classmethod

Set default instance of ApiClient.

It stores default ApiClient.

Parameters:

  • default

    object of ApiClient.

Source code in .venv/lib/python3.13/site-packages/agntcy_acp/acp_v0/sync_client/api_client.py
133
134
135
136
137
138
139
140
141
@classmethod
def set_default(cls, default):
    """Set default instance of ApiClient.

    It stores default ApiClient.

    :param default: object of ApiClient.
    """
    cls._default = default

update_params_for_auth(headers, queries, auth_settings, resource_path, method, body, request_auth=None)

Updates header and query params based on authentication setting.

: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().

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.

Source code in .venv/lib/python3.13/site-packages/agntcy_acp/acp_v0/sync_client/api_client.py
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
def update_params_for_auth(
    self,
    headers,
    queries,
    auth_settings,
    resource_path,
    method,
    body,
    request_auth=None
) -> None:
    """Updates header and query params based on authentication setting.

    :param headers: Header parameters dict to be updated.
    :param queries: Query parameters tuple list to be updated.
    :param auth_settings: Authentication setting identifiers list.
    :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().
    :param request_auth: if set, the provided settings will
                         override the token in the configuration.
    """
    if not auth_settings:
        return

    if request_auth:
        self._apply_auth_params(
            headers,
            queries,
            resource_path,
            method,
            body,
            request_auth
        )
    else:
        for auth in auth_settings:
            auth_setting = self.configuration.auth_settings().get(auth)
            if auth_setting:
                self._apply_auth_params(
                    headers,
                    queries,
                    resource_path,
                    method,
                    body,
                    auth_setting
                )

AsyncApiClient

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

Source code in .venv/lib/python3.13/site-packages/agntcy_acp/acp_v0/async_client/api_client.py
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
class ApiClient:
    """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.

    :param configuration: .Configuration object for this client
    :param header_name: a header to pass when making calls to the API.
    :param header_value: a header value to pass when making calls to
        the API.
    :param cookie: a cookie to include in the header when making calls
        to the API
    """

    PRIMITIVE_TYPES = (float, bool, bytes, str, int)
    NATIVE_TYPES_MAPPING = {
        'int': int,
        'long': int, # TODO remove as only py3 is supported?
        'float': float,
        'str': str,
        'bool': bool,
        'date': datetime.date,
        'datetime': datetime.datetime,
        'decimal': decimal.Decimal,
        'object': object,
    }
    _pool = None

    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

    async def __aenter__(self):
        return self

    async def __aexit__(self, exc_type, exc_value, traceback):
        await self.close()

    async def close(self):
        await self.rest_client.close()

    @property
    def user_agent(self):
        """User agent for this API client"""
        return self.default_headers['User-Agent']

    @user_agent.setter
    def user_agent(self, value):
        self.default_headers['User-Agent'] = value

    def set_default_header(self, header_name, header_value):
        self.default_headers[header_name] = header_value


    _default = None

    @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

    @classmethod
    def set_default(cls, default):
        """Set default instance of ApiClient.

        It stores default ApiClient.

        :param default: object of ApiClient.
        """
        cls._default = default

    def param_serialize(
        self,
        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
    ) -> RequestSerialized:

        """Builds the HTTP request params needed by the request.
        :param method: Method to call.
        :param resource_path: Path to method endpoint.
        :param path_params: Path parameters in the url.
        :param query_params: Query parameters in the url.
        :param header_params: Header parameters to be
            placed in the request header.
        :param body: Request body.
        :param post_params dict: Request post form parameters,
            for `application/x-www-form-urlencoded`, `multipart/form-data`.
        :param auth_settings list: Auth Settings names for the request.
        :param files dict: key -> filename, value -> filepath,
            for `multipart/form-data`.
        :param collection_formats: dict of collection formats for path, query,
            header, and post parameters.
        :param _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: tuple of form (path, http_method, query_params, header_params,
            body, post_params, files)
        """

        config = self.configuration

        # header parameters
        header_params = header_params or {}
        header_params.update(self.default_headers)
        if self.cookie:
            header_params['Cookie'] = self.cookie
        if header_params:
            header_params = self.sanitize_for_serialization(header_params)
            header_params = dict(
                self.parameters_to_tuples(header_params,collection_formats)
            )

        # path parameters
        if path_params:
            path_params = self.sanitize_for_serialization(path_params)
            path_params = self.parameters_to_tuples(
                path_params,
                collection_formats
            )
            for k, v in path_params:
                # specified safe chars, encode everything
                resource_path = resource_path.replace(
                    '{%s}' % k,
                    quote(str(v), safe=config.safe_chars_for_path_param)
                )

        # post parameters
        if post_params or files:
            post_params = post_params if post_params else []
            post_params = self.sanitize_for_serialization(post_params)
            post_params = self.parameters_to_tuples(
                post_params,
                collection_formats
            )
            if files:
                post_params.extend(self.files_parameters(files))

        # auth setting
        self.update_params_for_auth(
            header_params,
            query_params,
            auth_settings,
            resource_path,
            method,
            body,
            request_auth=_request_auth
        )

        # body
        if body:
            body = self.sanitize_for_serialization(body)

        # request url
        if _host is None or self.configuration.ignore_operation_servers:
            url = self.configuration.host + resource_path
        else:
            # use server/host defined in path or operation instead
            url = _host + resource_path

        # query parameters
        if query_params:
            query_params = self.sanitize_for_serialization(query_params)
            url_query = self.parameters_to_url_query(
                query_params,
                collection_formats
            )
            url += "?" + url_query

        return method, url, header_params, body, post_params


    async def call_api(
        self,
        method,
        url,
        header_params=None,
        body=None,
        post_params=None,
        _request_timeout=None
    ) -> rest.RESTResponse:
        """Makes the HTTP request (synchronous)
        :param method: Method to call.
        :param url: Path to method endpoint.
        :param header_params: Header parameters to be
            placed in the request header.
        :param body: Request body.
        :param post_params dict: Request post form parameters,
            for `application/x-www-form-urlencoded`, `multipart/form-data`.
        :param _request_timeout: timeout setting for this request.
        :return: RESTResponse
        """

        try:
            # perform request and return response
            response_data = await self.rest_client.request(
                method, url,
                headers=header_params,
                body=body, post_params=post_params,
                _request_timeout=_request_timeout
            )

        except ApiException as e:
            raise e

        return response_data

    def response_deserialize(
        self,
        response_data: rest.RESTResponse,
        response_types_map: Optional[Dict[str, ApiResponseT]]=None
    ) -> ApiResponse[ApiResponseT]:
        """Deserializes response into an object.
        :param response_data: RESTResponse object to be deserialized.
        :param response_types_map: dict of response types.
        :return: ApiResponse
        """

        msg = "RESTResponse.read() must be called before passing it to response_deserialize()"
        assert response_data.data is not None, msg

        response_type = response_types_map.get(str(response_data.status), None)
        if not response_type and isinstance(response_data.status, int) and 100 <= response_data.status <= 599:
            # if not found, look for '1XX', '2XX', etc.
            response_type = response_types_map.get(str(response_data.status)[0] + "XX", None)

        # deserialize response data
        response_text = None
        return_data = None
        try:
            if response_type == "bytearray":
                return_data = response_data.data
            elif response_type == "file":
                return_data = self.__deserialize_file(response_data)
            elif response_type is not None:
                match = None
                content_type = response_data.getheader('content-type')
                if content_type is not None:
                    match = re.search(r"charset=([a-zA-Z\-\d]+)[\s;]?", content_type)
                encoding = match.group(1) if match else "utf-8"
                response_text = response_data.data.decode(encoding)
                return_data = self.deserialize(response_text, response_type, content_type)
        finally:
            if not 200 <= response_data.status <= 299:
                raise ApiException.from_response(
                    http_resp=response_data,
                    body=response_text,
                    data=return_data,
                )

        return ApiResponse(
            status_code = response_data.status,
            data = return_data,
            headers = response_data.getheaders(),
            raw_data = response_data.data
        )

    def sanitize_for_serialization(self, obj):
        """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.

        :param obj: The data to serialize.
        :return: The serialized form of data.
        """
        if obj is None:
            return None
        elif isinstance(obj, Enum):
            return obj.value
        elif isinstance(obj, SecretStr):
            return obj.get_secret_value()
        elif isinstance(obj, self.PRIMITIVE_TYPES):
            return obj
        elif isinstance(obj, list):
            return [
                self.sanitize_for_serialization(sub_obj) for sub_obj in obj
            ]
        elif isinstance(obj, tuple):
            return tuple(
                self.sanitize_for_serialization(sub_obj) for sub_obj in obj
            )
        elif isinstance(obj, (datetime.datetime, datetime.date)):
            return obj.isoformat()
        elif isinstance(obj, decimal.Decimal):
            return str(obj)

        elif isinstance(obj, dict):
            obj_dict = obj
        else:
            # Convert model obj to dict except
            # attributes `openapi_types`, `attribute_map`
            # and attributes which value is not None.
            # Convert attribute name to json key in
            # model definition for request.
            if hasattr(obj, 'to_dict') and callable(getattr(obj, 'to_dict')):
                obj_dict = obj.to_dict()
            else:
                obj_dict = obj.__dict__

        return {
            key: self.sanitize_for_serialization(val)
            for key, val in obj_dict.items()
        }

    def deserialize(self, response_text: str, response_type: str, content_type: Optional[str]):
        """Deserializes response into an object.

        :param response: RESTResponse object to be deserialized.
        :param response_type: class literal for
            deserialized object, or string of class name.
        :param content_type: content type of response.

        :return: deserialized object.
        """

        # fetch data from response object
        if content_type is None:
            try:
                data = json.loads(response_text)
            except ValueError:
                data = response_text
        elif re.match(r'^application/(json|[\w!#$&.+-^_]+\+json)\s*(;|$)', content_type, re.IGNORECASE):
            if response_text == "":
                data = ""
            else:
                data = json.loads(response_text)
        elif re.match(r'^text\/[a-z.+-]+\s*(;|$)', content_type, re.IGNORECASE):
            data = response_text
        else:
            raise ApiException(
                status=0,
                reason="Unsupported content type: {0}".format(content_type)
            )

        return self.__deserialize(data, response_type)

    def __deserialize(self, data, klass):
        """Deserializes dict, list, str into an object.

        :param data: dict, list or str.
        :param klass: class literal, or string of class name.

        :return: object.
        """
        if data is None:
            return None

        if isinstance(klass, str):
            if klass.startswith('List['):
                m = re.match(r'List\[(.*)]', klass)
                assert m is not None, "Malformed List type definition"
                sub_kls = m.group(1)
                return [self.__deserialize(sub_data, sub_kls)
                        for sub_data in data]

            if klass.startswith('Dict['):
                m = re.match(r'Dict\[([^,]*), (.*)]', klass)
                assert m is not None, "Malformed Dict type definition"
                sub_kls = m.group(2)
                return {k: self.__deserialize(v, sub_kls)
                        for k, v in data.items()}

            # convert str to class
            if klass in self.NATIVE_TYPES_MAPPING:
                klass = self.NATIVE_TYPES_MAPPING[klass]
            else:
                klass = getattr(agntcy_acp.acp_v0.models, klass)

        if klass in self.PRIMITIVE_TYPES:
            return self.__deserialize_primitive(data, klass)
        elif klass == object:
            return self.__deserialize_object(data)
        elif klass == datetime.date:
            return self.__deserialize_date(data)
        elif klass == datetime.datetime:
            return self.__deserialize_datetime(data)
        elif klass == decimal.Decimal:
            return decimal.Decimal(data)
        elif issubclass(klass, Enum):
            return self.__deserialize_enum(data, klass)
        else:
            return self.__deserialize_model(data, klass)

    def parameters_to_tuples(self, params, collection_formats):
        """Get parameters as list of tuples, formatting collections.

        :param params: Parameters as dict or list of two-tuples
        :param dict collection_formats: Parameter collection formats
        :return: Parameters as list of tuples, collections formatted
        """
        new_params: List[Tuple[str, str]] = []
        if collection_formats is None:
            collection_formats = {}
        for k, v in params.items() if isinstance(params, dict) else params:
            if k in collection_formats:
                collection_format = collection_formats[k]
                if collection_format == 'multi':
                    new_params.extend((k, value) for value in v)
                else:
                    if collection_format == 'ssv':
                        delimiter = ' '
                    elif collection_format == 'tsv':
                        delimiter = '\t'
                    elif collection_format == 'pipes':
                        delimiter = '|'
                    else:  # csv is the default
                        delimiter = ','
                    new_params.append(
                        (k, delimiter.join(str(value) for value in v)))
            else:
                new_params.append((k, v))
        return new_params

    def parameters_to_url_query(self, params, collection_formats):
        """Get parameters as list of tuples, formatting collections.

        :param params: Parameters as dict or list of two-tuples
        :param dict collection_formats: Parameter collection formats
        :return: URL query string (e.g. a=Hello%20World&b=123)
        """
        new_params: List[Tuple[str, str]] = []
        if collection_formats is None:
            collection_formats = {}
        for k, v in params.items() if isinstance(params, dict) else params:
            if isinstance(v, bool):
                v = str(v).lower()
            if isinstance(v, (int, float)):
                v = str(v)
            if isinstance(v, dict):
                v = json.dumps(v)

            if k in collection_formats:
                collection_format = collection_formats[k]
                if collection_format == 'multi':
                    new_params.extend((k, quote(str(value))) for value in v)
                else:
                    if collection_format == 'ssv':
                        delimiter = ' '
                    elif collection_format == 'tsv':
                        delimiter = '\t'
                    elif collection_format == 'pipes':
                        delimiter = '|'
                    else:  # csv is the default
                        delimiter = ','
                    new_params.append(
                        (k, delimiter.join(quote(str(value)) for value in v))
                    )
            else:
                new_params.append((k, quote(str(v))))

        return "&".join(["=".join(map(str, item)) for item in new_params])

    def files_parameters(
        self,
        files: Dict[str, Union[str, bytes, List[str], List[bytes], Tuple[str, bytes]]],
    ):
        """Builds form parameters.

        :param files: File parameters.
        :return: Form parameters with files.
        """
        params = []
        for k, v in files.items():
            if isinstance(v, str):
                with open(v, 'rb') as f:
                    filename = os.path.basename(f.name)
                    filedata = f.read()
            elif isinstance(v, bytes):
                filename = k
                filedata = v
            elif isinstance(v, tuple):
                filename, filedata = v
            elif isinstance(v, list):
                for file_param in v:
                    params.extend(self.files_parameters({k: file_param}))
                continue
            else:
                raise ValueError("Unsupported file value")
            mimetype = (
                mimetypes.guess_type(filename)[0]
                or 'application/octet-stream'
            )
            params.append(
                tuple([k, tuple([filename, filedata, mimetype])])
            )
        return params

    def select_header_accept(self, accepts: List[str]) -> Optional[str]:
        """Returns `Accept` based on an array of accepts provided.

        :param accepts: List of headers.
        :return: Accept (e.g. application/json).
        """
        if not accepts:
            return None

        for accept in accepts:
            if re.search('json', accept, re.IGNORECASE):
                return accept

        return accepts[0]

    def select_header_content_type(self, content_types):
        """Returns `Content-Type` based on an array of content_types provided.

        :param content_types: List of content-types.
        :return: Content-Type (e.g. application/json).
        """
        if not content_types:
            return None

        for content_type in content_types:
            if re.search('json', content_type, re.IGNORECASE):
                return content_type

        return content_types[0]

    def update_params_for_auth(
        self,
        headers,
        queries,
        auth_settings,
        resource_path,
        method,
        body,
        request_auth=None
    ) -> None:
        """Updates header and query params based on authentication setting.

        :param headers: Header parameters dict to be updated.
        :param queries: Query parameters tuple list to be updated.
        :param auth_settings: Authentication setting identifiers list.
        :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().
        :param request_auth: if set, the provided settings will
                             override the token in the configuration.
        """
        if not auth_settings:
            return

        if request_auth:
            self._apply_auth_params(
                headers,
                queries,
                resource_path,
                method,
                body,
                request_auth
            )
        else:
            for auth in auth_settings:
                auth_setting = self.configuration.auth_settings().get(auth)
                if auth_setting:
                    self._apply_auth_params(
                        headers,
                        queries,
                        resource_path,
                        method,
                        body,
                        auth_setting
                    )

    def _apply_auth_params(
        self,
        headers,
        queries,
        resource_path,
        method,
        body,
        auth_setting
    ) -> None:
        """Updates the request parameters based on a single auth_setting

        :param headers: Header parameters dict to be updated.
        :param queries: Query parameters tuple list to be updated.
        :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().
        :param auth_setting: auth settings for the endpoint
        """
        if auth_setting['in'] == 'cookie':
            headers['Cookie'] = auth_setting['value']
        elif auth_setting['in'] == 'header':
            if auth_setting['type'] != 'http-signature':
                headers[auth_setting['key']] = auth_setting['value']
        elif auth_setting['in'] == 'query':
            queries.append((auth_setting['key'], auth_setting['value']))
        else:
            raise ApiValueError(
                'Authentication token must be in `query` or `header`'
            )

    def __deserialize_file(self, response):
        """Deserializes body to file

        Saves response body into a file in a temporary folder,
        using the filename from the `Content-Disposition` header if provided.

        handle file downloading
        save response body into a tmp file and return the instance

        :param response:  RESTResponse.
        :return: file path.
        """
        fd, path = tempfile.mkstemp(dir=self.configuration.temp_folder_path)
        os.close(fd)
        os.remove(path)

        content_disposition = response.getheader("Content-Disposition")
        if content_disposition:
            m = re.search(
                r'filename=[\'"]?([^\'"\s]+)[\'"]?',
                content_disposition
            )
            assert m is not None, "Unexpected 'content-disposition' header value"
            filename = m.group(1)
            path = os.path.join(os.path.dirname(path), filename)

        with open(path, "wb") as f:
            f.write(response.data)

        return path

    def __deserialize_primitive(self, data, klass):
        """Deserializes string to primitive type.

        :param data: str.
        :param klass: class literal.

        :return: int, long, float, str, bool.
        """
        try:
            return klass(data)
        except UnicodeEncodeError:
            return str(data)
        except TypeError:
            return data

    def __deserialize_object(self, value):
        """Return an original value.

        :return: object.
        """
        return value

    def __deserialize_date(self, string):
        """Deserializes string to date.

        :param string: str.
        :return: date.
        """
        try:
            return parse(string).date()
        except ImportError:
            return string
        except ValueError:
            raise rest.ApiException(
                status=0,
                reason="Failed to parse `{0}` as date object".format(string)
            )

    def __deserialize_datetime(self, string):
        """Deserializes string to datetime.

        The string should be in iso8601 datetime format.

        :param string: str.
        :return: datetime.
        """
        try:
            return parse(string)
        except ImportError:
            return string
        except ValueError:
            raise rest.ApiException(
                status=0,
                reason=(
                    "Failed to parse `{0}` as datetime object"
                    .format(string)
                )
            )

    def __deserialize_enum(self, data, klass):
        """Deserializes primitive type to enum.

        :param data: primitive type.
        :param klass: class literal.
        :return: enum value.
        """
        try:
            return klass(data)
        except ValueError:
            raise rest.ApiException(
                status=0,
                reason=(
                    "Failed to parse `{0}` as `{1}`"
                    .format(data, klass)
                )
            )

    def __deserialize_model(self, data, klass):
        """Deserializes list or dict to model.

        :param data: dict, list.
        :param klass: class literal.
        :return: model object.
        """

        return klass.from_dict(data)

user_agent property writable

User agent for this API client

__deserialize(data, klass)

Deserializes dict, list, str into an object.

Parameters:

  • data

    dict, list or str.

  • klass

    class literal, or string of class name.

Returns:

  • object.

Source code in .venv/lib/python3.13/site-packages/agntcy_acp/acp_v0/async_client/api_client.py
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
def __deserialize(self, data, klass):
    """Deserializes dict, list, str into an object.

    :param data: dict, list or str.
    :param klass: class literal, or string of class name.

    :return: object.
    """
    if data is None:
        return None

    if isinstance(klass, str):
        if klass.startswith('List['):
            m = re.match(r'List\[(.*)]', klass)
            assert m is not None, "Malformed List type definition"
            sub_kls = m.group(1)
            return [self.__deserialize(sub_data, sub_kls)
                    for sub_data in data]

        if klass.startswith('Dict['):
            m = re.match(r'Dict\[([^,]*), (.*)]', klass)
            assert m is not None, "Malformed Dict type definition"
            sub_kls = m.group(2)
            return {k: self.__deserialize(v, sub_kls)
                    for k, v in data.items()}

        # convert str to class
        if klass in self.NATIVE_TYPES_MAPPING:
            klass = self.NATIVE_TYPES_MAPPING[klass]
        else:
            klass = getattr(agntcy_acp.acp_v0.models, klass)

    if klass in self.PRIMITIVE_TYPES:
        return self.__deserialize_primitive(data, klass)
    elif klass == object:
        return self.__deserialize_object(data)
    elif klass == datetime.date:
        return self.__deserialize_date(data)
    elif klass == datetime.datetime:
        return self.__deserialize_datetime(data)
    elif klass == decimal.Decimal:
        return decimal.Decimal(data)
    elif issubclass(klass, Enum):
        return self.__deserialize_enum(data, klass)
    else:
        return self.__deserialize_model(data, klass)

__deserialize_date(string)

Deserializes string to date.

Parameters:

  • string

    str.

Returns:

  • date.

Source code in .venv/lib/python3.13/site-packages/agntcy_acp/acp_v0/async_client/api_client.py
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
def __deserialize_date(self, string):
    """Deserializes string to date.

    :param string: str.
    :return: date.
    """
    try:
        return parse(string).date()
    except ImportError:
        return string
    except ValueError:
        raise rest.ApiException(
            status=0,
            reason="Failed to parse `{0}` as date object".format(string)
        )

__deserialize_datetime(string)

Deserializes string to datetime.

The string should be in iso8601 datetime format.

Parameters:

  • string

    str.

Returns:

  • datetime.

Source code in .venv/lib/python3.13/site-packages/agntcy_acp/acp_v0/async_client/api_client.py
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
def __deserialize_datetime(self, string):
    """Deserializes string to datetime.

    The string should be in iso8601 datetime format.

    :param string: str.
    :return: datetime.
    """
    try:
        return parse(string)
    except ImportError:
        return string
    except ValueError:
        raise rest.ApiException(
            status=0,
            reason=(
                "Failed to parse `{0}` as datetime object"
                .format(string)
            )
        )

__deserialize_enum(data, klass)

Deserializes primitive type to enum.

Parameters:

  • data

    primitive type.

  • klass

    class literal.

Returns:

  • enum value.

Source code in .venv/lib/python3.13/site-packages/agntcy_acp/acp_v0/async_client/api_client.py
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
def __deserialize_enum(self, data, klass):
    """Deserializes primitive type to enum.

    :param data: primitive type.
    :param klass: class literal.
    :return: enum value.
    """
    try:
        return klass(data)
    except ValueError:
        raise rest.ApiException(
            status=0,
            reason=(
                "Failed to parse `{0}` as `{1}`"
                .format(data, klass)
            )
        )

__deserialize_file(response)

Deserializes body to file

Saves response body into a file in a temporary folder, using the filename from the Content-Disposition header if provided.

handle file downloading save response body into a tmp file and return the instance

Parameters:

  • response

    RESTResponse.

Returns:

  • file path.

Source code in .venv/lib/python3.13/site-packages/agntcy_acp/acp_v0/async_client/api_client.py
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
def __deserialize_file(self, response):
    """Deserializes body to file

    Saves response body into a file in a temporary folder,
    using the filename from the `Content-Disposition` header if provided.

    handle file downloading
    save response body into a tmp file and return the instance

    :param response:  RESTResponse.
    :return: file path.
    """
    fd, path = tempfile.mkstemp(dir=self.configuration.temp_folder_path)
    os.close(fd)
    os.remove(path)

    content_disposition = response.getheader("Content-Disposition")
    if content_disposition:
        m = re.search(
            r'filename=[\'"]?([^\'"\s]+)[\'"]?',
            content_disposition
        )
        assert m is not None, "Unexpected 'content-disposition' header value"
        filename = m.group(1)
        path = os.path.join(os.path.dirname(path), filename)

    with open(path, "wb") as f:
        f.write(response.data)

    return path

__deserialize_model(data, klass)

Deserializes list or dict to model.

Parameters:

  • data

    dict, list.

  • klass

    class literal.

Returns:

  • model object.

Source code in .venv/lib/python3.13/site-packages/agntcy_acp/acp_v0/async_client/api_client.py
794
795
796
797
798
799
800
801
802
def __deserialize_model(self, data, klass):
    """Deserializes list or dict to model.

    :param data: dict, list.
    :param klass: class literal.
    :return: model object.
    """

    return klass.from_dict(data)

__deserialize_object(value)

Return an original value.

Returns:

  • object.

Source code in .venv/lib/python3.13/site-packages/agntcy_acp/acp_v0/async_client/api_client.py
732
733
734
735
736
737
def __deserialize_object(self, value):
    """Return an original value.

    :return: object.
    """
    return value

__deserialize_primitive(data, klass)

Deserializes string to primitive type.

Parameters:

  • data

    str.

  • klass

    class literal.

Returns:

  • int, long, float, str, bool.

Source code in .venv/lib/python3.13/site-packages/agntcy_acp/acp_v0/async_client/api_client.py
717
718
719
720
721
722
723
724
725
726
727
728
729
730
def __deserialize_primitive(self, data, klass):
    """Deserializes string to primitive type.

    :param data: str.
    :param klass: class literal.

    :return: int, long, float, str, bool.
    """
    try:
        return klass(data)
    except UnicodeEncodeError:
        return str(data)
    except TypeError:
        return data

call_api(method, url, header_params=None, body=None, post_params=None, _request_timeout=None) async

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.

Returns:

  • RESTResponse

    RESTResponse

Source code in .venv/lib/python3.13/site-packages/agntcy_acp/acp_v0/async_client/api_client.py
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
async def call_api(
    self,
    method,
    url,
    header_params=None,
    body=None,
    post_params=None,
    _request_timeout=None
) -> rest.RESTResponse:
    """Makes the HTTP request (synchronous)
    :param method: Method to call.
    :param url: Path to method endpoint.
    :param header_params: Header parameters to be
        placed in the request header.
    :param body: Request body.
    :param post_params dict: Request post form parameters,
        for `application/x-www-form-urlencoded`, `multipart/form-data`.
    :param _request_timeout: timeout setting for this request.
    :return: RESTResponse
    """

    try:
        # perform request and return response
        response_data = await self.rest_client.request(
            method, url,
            headers=header_params,
            body=body, post_params=post_params,
            _request_timeout=_request_timeout
        )

    except ApiException as e:
        raise e

    return response_data

deserialize(response_text, response_type, content_type)

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.

Source code in .venv/lib/python3.13/site-packages/agntcy_acp/acp_v0/async_client/api_client.py
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
def deserialize(self, response_text: str, response_type: str, content_type: Optional[str]):
    """Deserializes response into an object.

    :param response: RESTResponse object to be deserialized.
    :param response_type: class literal for
        deserialized object, or string of class name.
    :param content_type: content type of response.

    :return: deserialized object.
    """

    # fetch data from response object
    if content_type is None:
        try:
            data = json.loads(response_text)
        except ValueError:
            data = response_text
    elif re.match(r'^application/(json|[\w!#$&.+-^_]+\+json)\s*(;|$)', content_type, re.IGNORECASE):
        if response_text == "":
            data = ""
        else:
            data = json.loads(response_text)
    elif re.match(r'^text\/[a-z.+-]+\s*(;|$)', content_type, re.IGNORECASE):
        data = response_text
    else:
        raise ApiException(
            status=0,
            reason="Unsupported content type: {0}".format(content_type)
        )

    return self.__deserialize(data, response_type)

files_parameters(files)

Builds form parameters.

Parameters:

  • files (Dict[str, Union[str, bytes, List[str], List[bytes], Tuple[str, bytes]]]) –

    File parameters.

Returns:

  • Form parameters with files.

Source code in .venv/lib/python3.13/site-packages/agntcy_acp/acp_v0/async_client/api_client.py
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
def files_parameters(
    self,
    files: Dict[str, Union[str, bytes, List[str], List[bytes], Tuple[str, bytes]]],
):
    """Builds form parameters.

    :param files: File parameters.
    :return: Form parameters with files.
    """
    params = []
    for k, v in files.items():
        if isinstance(v, str):
            with open(v, 'rb') as f:
                filename = os.path.basename(f.name)
                filedata = f.read()
        elif isinstance(v, bytes):
            filename = k
            filedata = v
        elif isinstance(v, tuple):
            filename, filedata = v
        elif isinstance(v, list):
            for file_param in v:
                params.extend(self.files_parameters({k: file_param}))
            continue
        else:
            raise ValueError("Unsupported file value")
        mimetype = (
            mimetypes.guess_type(filename)[0]
            or 'application/octet-stream'
        )
        params.append(
            tuple([k, tuple([filename, filedata, mimetype])])
        )
    return params

get_default() classmethod

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.

Source code in .venv/lib/python3.13/site-packages/agntcy_acp/acp_v0/async_client/api_client.py
122
123
124
125
126
127
128
129
130
131
132
133
134
@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

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)

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 (post_params) –

    Request post form parameters, for application/x-www-form-urlencoded, multipart/form-data.

  • list (auth_settings) –

    Auth Settings names for the request.

  • 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.

Returns:

  • RequestSerialized

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

Source code in .venv/lib/python3.13/site-packages/agntcy_acp/acp_v0/async_client/api_client.py
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
def param_serialize(
    self,
    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
) -> RequestSerialized:

    """Builds the HTTP request params needed by the request.
    :param method: Method to call.
    :param resource_path: Path to method endpoint.
    :param path_params: Path parameters in the url.
    :param query_params: Query parameters in the url.
    :param header_params: Header parameters to be
        placed in the request header.
    :param body: Request body.
    :param post_params dict: Request post form parameters,
        for `application/x-www-form-urlencoded`, `multipart/form-data`.
    :param auth_settings list: Auth Settings names for the request.
    :param files dict: key -> filename, value -> filepath,
        for `multipart/form-data`.
    :param collection_formats: dict of collection formats for path, query,
        header, and post parameters.
    :param _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: tuple of form (path, http_method, query_params, header_params,
        body, post_params, files)
    """

    config = self.configuration

    # header parameters
    header_params = header_params or {}
    header_params.update(self.default_headers)
    if self.cookie:
        header_params['Cookie'] = self.cookie
    if header_params:
        header_params = self.sanitize_for_serialization(header_params)
        header_params = dict(
            self.parameters_to_tuples(header_params,collection_formats)
        )

    # path parameters
    if path_params:
        path_params = self.sanitize_for_serialization(path_params)
        path_params = self.parameters_to_tuples(
            path_params,
            collection_formats
        )
        for k, v in path_params:
            # specified safe chars, encode everything
            resource_path = resource_path.replace(
                '{%s}' % k,
                quote(str(v), safe=config.safe_chars_for_path_param)
            )

    # post parameters
    if post_params or files:
        post_params = post_params if post_params else []
        post_params = self.sanitize_for_serialization(post_params)
        post_params = self.parameters_to_tuples(
            post_params,
            collection_formats
        )
        if files:
            post_params.extend(self.files_parameters(files))

    # auth setting
    self.update_params_for_auth(
        header_params,
        query_params,
        auth_settings,
        resource_path,
        method,
        body,
        request_auth=_request_auth
    )

    # body
    if body:
        body = self.sanitize_for_serialization(body)

    # request url
    if _host is None or self.configuration.ignore_operation_servers:
        url = self.configuration.host + resource_path
    else:
        # use server/host defined in path or operation instead
        url = _host + resource_path

    # query parameters
    if query_params:
        query_params = self.sanitize_for_serialization(query_params)
        url_query = self.parameters_to_url_query(
            query_params,
            collection_formats
        )
        url += "?" + url_query

    return method, url, header_params, body, post_params

parameters_to_tuples(params, collection_formats)

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

Source code in .venv/lib/python3.13/site-packages/agntcy_acp/acp_v0/async_client/api_client.py
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
def parameters_to_tuples(self, params, collection_formats):
    """Get parameters as list of tuples, formatting collections.

    :param params: Parameters as dict or list of two-tuples
    :param dict collection_formats: Parameter collection formats
    :return: Parameters as list of tuples, collections formatted
    """
    new_params: List[Tuple[str, str]] = []
    if collection_formats is None:
        collection_formats = {}
    for k, v in params.items() if isinstance(params, dict) else params:
        if k in collection_formats:
            collection_format = collection_formats[k]
            if collection_format == 'multi':
                new_params.extend((k, value) for value in v)
            else:
                if collection_format == 'ssv':
                    delimiter = ' '
                elif collection_format == 'tsv':
                    delimiter = '\t'
                elif collection_format == 'pipes':
                    delimiter = '|'
                else:  # csv is the default
                    delimiter = ','
                new_params.append(
                    (k, delimiter.join(str(value) for value in v)))
        else:
            new_params.append((k, v))
    return new_params

parameters_to_url_query(params, collection_formats)

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)

Source code in .venv/lib/python3.13/site-packages/agntcy_acp/acp_v0/async_client/api_client.py
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
def parameters_to_url_query(self, params, collection_formats):
    """Get parameters as list of tuples, formatting collections.

    :param params: Parameters as dict or list of two-tuples
    :param dict collection_formats: Parameter collection formats
    :return: URL query string (e.g. a=Hello%20World&b=123)
    """
    new_params: List[Tuple[str, str]] = []
    if collection_formats is None:
        collection_formats = {}
    for k, v in params.items() if isinstance(params, dict) else params:
        if isinstance(v, bool):
            v = str(v).lower()
        if isinstance(v, (int, float)):
            v = str(v)
        if isinstance(v, dict):
            v = json.dumps(v)

        if k in collection_formats:
            collection_format = collection_formats[k]
            if collection_format == 'multi':
                new_params.extend((k, quote(str(value))) for value in v)
            else:
                if collection_format == 'ssv':
                    delimiter = ' '
                elif collection_format == 'tsv':
                    delimiter = '\t'
                elif collection_format == 'pipes':
                    delimiter = '|'
                else:  # csv is the default
                    delimiter = ','
                new_params.append(
                    (k, delimiter.join(quote(str(value)) for value in v))
                )
        else:
            new_params.append((k, quote(str(v))))

    return "&".join(["=".join(map(str, item)) for item in new_params])

response_deserialize(response_data, response_types_map=None)

Deserializes response into an object.

Parameters:

  • response_data (RESTResponse) –

    RESTResponse object to be deserialized.

  • response_types_map (Optional[Dict[str, T]], default: None ) –

    dict of response types.

Returns:

Source code in .venv/lib/python3.13/site-packages/agntcy_acp/acp_v0/async_client/api_client.py
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
def response_deserialize(
    self,
    response_data: rest.RESTResponse,
    response_types_map: Optional[Dict[str, ApiResponseT]]=None
) -> ApiResponse[ApiResponseT]:
    """Deserializes response into an object.
    :param response_data: RESTResponse object to be deserialized.
    :param response_types_map: dict of response types.
    :return: ApiResponse
    """

    msg = "RESTResponse.read() must be called before passing it to response_deserialize()"
    assert response_data.data is not None, msg

    response_type = response_types_map.get(str(response_data.status), None)
    if not response_type and isinstance(response_data.status, int) and 100 <= response_data.status <= 599:
        # if not found, look for '1XX', '2XX', etc.
        response_type = response_types_map.get(str(response_data.status)[0] + "XX", None)

    # deserialize response data
    response_text = None
    return_data = None
    try:
        if response_type == "bytearray":
            return_data = response_data.data
        elif response_type == "file":
            return_data = self.__deserialize_file(response_data)
        elif response_type is not None:
            match = None
            content_type = response_data.getheader('content-type')
            if content_type is not None:
                match = re.search(r"charset=([a-zA-Z\-\d]+)[\s;]?", content_type)
            encoding = match.group(1) if match else "utf-8"
            response_text = response_data.data.decode(encoding)
            return_data = self.deserialize(response_text, response_type, content_type)
    finally:
        if not 200 <= response_data.status <= 299:
            raise ApiException.from_response(
                http_resp=response_data,
                body=response_text,
                data=return_data,
            )

    return ApiResponse(
        status_code = response_data.status,
        data = return_data,
        headers = response_data.getheaders(),
        raw_data = response_data.data
    )

sanitize_for_serialization(obj)

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.

Source code in .venv/lib/python3.13/site-packages/agntcy_acp/acp_v0/async_client/api_client.py
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
def sanitize_for_serialization(self, obj):
    """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.

    :param obj: The data to serialize.
    :return: The serialized form of data.
    """
    if obj is None:
        return None
    elif isinstance(obj, Enum):
        return obj.value
    elif isinstance(obj, SecretStr):
        return obj.get_secret_value()
    elif isinstance(obj, self.PRIMITIVE_TYPES):
        return obj
    elif isinstance(obj, list):
        return [
            self.sanitize_for_serialization(sub_obj) for sub_obj in obj
        ]
    elif isinstance(obj, tuple):
        return tuple(
            self.sanitize_for_serialization(sub_obj) for sub_obj in obj
        )
    elif isinstance(obj, (datetime.datetime, datetime.date)):
        return obj.isoformat()
    elif isinstance(obj, decimal.Decimal):
        return str(obj)

    elif isinstance(obj, dict):
        obj_dict = obj
    else:
        # Convert model obj to dict except
        # attributes `openapi_types`, `attribute_map`
        # and attributes which value is not None.
        # Convert attribute name to json key in
        # model definition for request.
        if hasattr(obj, 'to_dict') and callable(getattr(obj, 'to_dict')):
            obj_dict = obj.to_dict()
        else:
            obj_dict = obj.__dict__

    return {
        key: self.sanitize_for_serialization(val)
        for key, val in obj_dict.items()
    }

select_header_accept(accepts)

Returns Accept based on an array of accepts provided.

Parameters:

  • accepts (List[str]) –

    List of headers.

Returns:

  • Optional[str]

    Accept (e.g. application/json).

Source code in .venv/lib/python3.13/site-packages/agntcy_acp/acp_v0/async_client/api_client.py
578
579
580
581
582
583
584
585
586
587
588
589
590
591
def select_header_accept(self, accepts: List[str]) -> Optional[str]:
    """Returns `Accept` based on an array of accepts provided.

    :param accepts: List of headers.
    :return: Accept (e.g. application/json).
    """
    if not accepts:
        return None

    for accept in accepts:
        if re.search('json', accept, re.IGNORECASE):
            return accept

    return accepts[0]

select_header_content_type(content_types)

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).

Source code in .venv/lib/python3.13/site-packages/agntcy_acp/acp_v0/async_client/api_client.py
593
594
595
596
597
598
599
600
601
602
603
604
605
606
def select_header_content_type(self, content_types):
    """Returns `Content-Type` based on an array of content_types provided.

    :param content_types: List of content-types.
    :return: Content-Type (e.g. application/json).
    """
    if not content_types:
        return None

    for content_type in content_types:
        if re.search('json', content_type, re.IGNORECASE):
            return content_type

    return content_types[0]

set_default(default) classmethod

Set default instance of ApiClient.

It stores default ApiClient.

Parameters:

  • default

    object of ApiClient.

Source code in .venv/lib/python3.13/site-packages/agntcy_acp/acp_v0/async_client/api_client.py
136
137
138
139
140
141
142
143
144
@classmethod
def set_default(cls, default):
    """Set default instance of ApiClient.

    It stores default ApiClient.

    :param default: object of ApiClient.
    """
    cls._default = default

update_params_for_auth(headers, queries, auth_settings, resource_path, method, body, request_auth=None)

Updates header and query params based on authentication setting.

: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().

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.

Source code in .venv/lib/python3.13/site-packages/agntcy_acp/acp_v0/async_client/api_client.py
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
def update_params_for_auth(
    self,
    headers,
    queries,
    auth_settings,
    resource_path,
    method,
    body,
    request_auth=None
) -> None:
    """Updates header and query params based on authentication setting.

    :param headers: Header parameters dict to be updated.
    :param queries: Query parameters tuple list to be updated.
    :param auth_settings: Authentication setting identifiers list.
    :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().
    :param request_auth: if set, the provided settings will
                         override the token in the configuration.
    """
    if not auth_settings:
        return

    if request_auth:
        self._apply_auth_params(
            headers,
            queries,
            resource_path,
            method,
            body,
            request_auth
        )
    else:
        for auth in auth_settings:
            auth_setting = self.configuration.auth_settings().get(auth)
            if auth_setting:
                self._apply_auth_params(
                    headers,
                    queries,
                    resource_path,
                    method,
                    body,
                    auth_setting
                )

ApiResponse

Bases: BaseModel, Generic[T]

API response object

Show JSON schema:
{
  "description": "API response object",
  "properties": {
    "status_code": {
      "description": "HTTP status code",
      "title": "Status Code",
      "type": "integer"
    },
    "headers": {
      "anyOf": [
        {
          "additionalProperties": {
            "type": "string"
          },
          "type": "object"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "HTTP headers",
      "title": "Headers"
    },
    "data": {
      "description": "Deserialized data given the data type",
      "title": "Data"
    },
    "raw_data": {
      "description": "Raw data (HTTP response body)",
      "format": "binary",
      "title": "Raw Data",
      "type": "string"
    }
  },
  "required": [
    "status_code",
    "data",
    "raw_data"
  ],
  "title": "ApiResponse",
  "type": "object"
}

Config:

  • default: {'arbitrary_types_allowed': True}

Fields:

Source code in .venv/lib/python3.13/site-packages/agntcy_acp/acp_v0/api_response.py
11
12
13
14
15
16
17
18
19
20
21
22
23
class ApiResponse(BaseModel, Generic[T]):
    """
    API response object
    """

    status_code: StrictInt = Field(description="HTTP status code")
    headers: Optional[Mapping[str, str]] = Field(None, description="HTTP headers")
    data: T = Field(description="Deserialized data given the data type")
    raw_data: StrictBytes = Field(description="Raw data (HTTP response body)")

    model_config = {
        "arbitrary_types_allowed": True
    }

data pydantic-field

Deserialized data given the data type

headers = None pydantic-field

HTTP headers

raw_data pydantic-field

Raw data (HTTP response body)

status_code pydantic-field

HTTP status code

LangGraph Bindings

ACPNode

This class represents a Langgraph Node that holds a remote connection to an ACP Agent It can be instantiated and added to any langgraph graph.

my_node = ACPNode(...) sg = StateGraph(GraphState) sg.add_node(my_node)

Source code in .venv/lib/python3.13/site-packages/agntcy_acp/langgraph/acp_node.py
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
class ACPNode:
    """This class represents a Langgraph Node that holds a remote connection to an ACP Agent
    It can be instantiated and added to any langgraph graph.

    my_node = ACPNode(...)
    sg = StateGraph(GraphState)
    sg.add_node(my_node)
    """

    def __init__(
        self,
        name: str,
        agent_id: str,
        client_config: ApiClientConfiguration,
        input_path: str,
        input_type,
        output_path: str,
        output_type,
        config_path: Optional[str] = None,
        config_type=None,
        auth_header: Optional[Dict] = None,
    ):
        """Instantiate a Langgraph node encapsulating a remote ACP agent

        :param name: Name of the langgraph node
        :param agent_id: Agent ID in the remote server
        :param client_config: Configuration of the ACP Client
        :param input_path: Dot-separated path of the ACP Agent input in the graph overall state
        :param input_type: Pydantic class defining the schema of the ACP Agent input
        :param output_path: Dot-separated path of the ACP Agent output in the graph overall state
        :param output_type: Pydantic class defining the schema of the ACP Agent output
        :param config_path: Dot-separated path of the ACP Agent config in the graph configurable
        :param config_type: Pydantic class defining the schema of the ACP Agent config
        :param auth_header: A dictionary containing auth details necessary to communicate with the node
        """

        self.__name__ = name
        self.agent_id = agent_id
        self.clientConfig = client_config
        self.inputPath = input_path
        self.inputType = input_type
        self.outputPath = output_path
        self.outputType = output_type
        self.configPath = config_path
        self.configType = config_type
        self.auth_header = auth_header

    def get_name(self):
        return self.__name__

    def _extract_input(self, state: Any) -> Any:
        if not state:
            return state

        try:
            if self.inputPath:
                state = _extract_element(state, self.inputPath)
        except Exception as e:
            raise Exception(
                f"ERROR in ACP Node {self.get_name()}. Unable to extract input: {e}"
            )

        return state

    def _extract_config(self, config: Any) -> Any:
        if not config:
            return config

        try:
            if not self.configPath:
                config = {}
            else:
                if "configurable" not in config:
                    logger.error(f"ACP Node {self.get_name()}. Unable to extract config: missing key \"configurable\" in RunnableConfig")
                    return None

                config = _extract_element(config["configurable"], self.configPath)
        except Exception as e:
            logger.info(f"ACP Node {self.get_name()}. Unable to extract config: {e}")
            return None

        if self.configType is not None:
            return self.configType.model_validate(config)
        else:
            return config

    def _set_output(self, state: Any, output: Optional[Dict[str, Any]]):
        output_parent = state
        output_state = self.outputType.model_validate(output)

        for el in self.outputPath.split(".")[:-1]:
            if isinstance(output_parent, MutableMapping):
                output_parent = output_parent[el]
            elif hasattr(output_parent, el):
                output_parent = getattr(output_parent, el)
            else:
                raise ValueError("object missing attribute: {el}")

        el = self.outputPath.split(".")[-1]
        if isinstance(output_parent, MutableMapping):
            output_parent[el] = output_state
        elif hasattr(output_parent, el):
            setattr(output_parent, el, output_state)
        else:
            raise ValueError("object missing attribute: {el}")

    def _prepare_run_create(self, state: Any, config: RunnableConfig) -> RunCreateStateless:
        agent_input = self._extract_input(state)
        if isinstance(agent_input, BaseModel):
            input_to_agent = agent_input.model_dump()
        elif isinstance(agent_input, MutableMapping):
            input_to_agent = agent_input
        else:
            input_to_agent = {}

        agent_config = self._extract_config(config)
        if isinstance(agent_config, BaseModel):
            config_to_agent = agent_config.model_dump()
        elif isinstance(agent_config, MutableMapping):
            config_to_agent = agent_config
        else:
            config_to_agent = {}

        return RunCreateStateless(
            agent_id=self.agent_id,
            input=input_to_agent,
            config=Config(configurable=config_to_agent),
        )

    def _handle_run_output(self, state: Any, run_output: RunOutput):
        if isinstance(run_output.actual_instance, RunResult):
            run_result: RunResult = run_output.actual_instance
            self._set_output(state, run_result.values)
        elif isinstance(run_output.actual_instance, RunError):
            run_error: RunError = run_output.actual_instance
            raise ACPRunException(f"Run Failed: {run_error}")
        elif isinstance(run_output.actual_instance, RunInterrupt):
            raise ACPRunException(f"ACP Server returned a unsupporteed interrupt response: {run_output}")
        else:
            raise ACPRunException(f"ACP Server returned a unsupporteed response: {run_output}")

        return state

    def invoke(self, state: Any, config: RunnableConfig) -> Any:
        run_create = self._prepare_run_create(state, config)
        with ApiClient(configuration=self.clientConfig) as api_client:
            acp_client = ACPClient(api_client=api_client)
            run_output = acp_client.create_and_wait_for_stateless_run_output(run_create)

        self._handle_run_output(state, run_output.output)
        return state

    async def ainvoke(self, state: Any, config: RunnableConfig) -> Any:
        run_create = self._prepare_run_create(state, config)
        async with AsyncApiClient(configuration=self.clientConfig) as api_client:
            acp_client = AsyncACPClient(api_client=api_client)
            run_output = await acp_client.create_and_wait_for_stateless_run_output(run_create)

        self._handle_run_output(state, run_output.output)
        return state

    def __call__(self, state, config):
        return RunnableCallable(self.invoke, self.ainvoke)

__init__(name, agent_id, client_config, input_path, input_type, output_path, output_type, config_path=None, config_type=None, auth_header=None)

Instantiate a Langgraph node encapsulating a remote ACP agent

Parameters:

  • name (str) –

    Name of the langgraph node

  • agent_id (str) –

    Agent ID in the remote server

  • client_config (ApiClientConfiguration) –

    Configuration of the ACP Client

  • input_path (str) –

    Dot-separated path of the ACP Agent input in the graph overall state

  • input_type

    Pydantic class defining the schema of the ACP Agent input

  • output_path (str) –

    Dot-separated path of the ACP Agent output in the graph overall state

  • output_type

    Pydantic class defining the schema of the ACP Agent output

  • config_path (Optional[str], default: None ) –

    Dot-separated path of the ACP Agent config in the graph configurable

  • config_type

    Pydantic class defining the schema of the ACP Agent config

  • auth_header (Optional[Dict], default: None ) –

    A dictionary containing auth details necessary to communicate with the node

Source code in .venv/lib/python3.13/site-packages/agntcy_acp/langgraph/acp_node.py
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
def __init__(
    self,
    name: str,
    agent_id: str,
    client_config: ApiClientConfiguration,
    input_path: str,
    input_type,
    output_path: str,
    output_type,
    config_path: Optional[str] = None,
    config_type=None,
    auth_header: Optional[Dict] = None,
):
    """Instantiate a Langgraph node encapsulating a remote ACP agent

    :param name: Name of the langgraph node
    :param agent_id: Agent ID in the remote server
    :param client_config: Configuration of the ACP Client
    :param input_path: Dot-separated path of the ACP Agent input in the graph overall state
    :param input_type: Pydantic class defining the schema of the ACP Agent input
    :param output_path: Dot-separated path of the ACP Agent output in the graph overall state
    :param output_type: Pydantic class defining the schema of the ACP Agent output
    :param config_path: Dot-separated path of the ACP Agent config in the graph configurable
    :param config_type: Pydantic class defining the schema of the ACP Agent config
    :param auth_header: A dictionary containing auth details necessary to communicate with the node
    """

    self.__name__ = name
    self.agent_id = agent_id
    self.clientConfig = client_config
    self.inputPath = input_path
    self.inputType = input_type
    self.outputPath = output_path
    self.outputType = output_type
    self.configPath = config_path
    self.configType = config_type
    self.auth_header = auth_header

APIBridgeAgentNode

Bases: ACPNode

An ACP node that enables using remotely the API bridge agent in a LangGraph multi agent software

Source code in .venv/lib/python3.13/site-packages/agntcy_acp/langgraph/api_bridge.py
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
class APIBridgeAgentNode(acp_node.ACPNode):
    """
    An ACP node that enables using remotely the API bridge agent in a LangGraph
    multi agent software
    """

    def __init__(
        self,
        name: str,
        hostname: str,
        service_name: str,
        input_path: str,
        output_path: str,
        service_api_key: str,
        input_type: Any = APIBridgeInput,
        output_type: Any = APIBridgeOutput,
        apikey: Optional[str] = None,
    ):
        self.__name__ = name
        self.hostname = hostname
        self.apikey = apikey
        self.service_name = service_name
        # API Bridge agent requires the endpoint to end with '/'
        if not self.service_name.endswith('/'):
            self.service_name += '/'
        self.inputType = input_type
        self.outputType = output_type
        self.inputPath = input_path
        self.outputPath = output_path
        self.service_api_key = service_api_key

    def invoke(self, state: Any, config: RunnableConfig) -> Any:
        api_bridge_input = self._extract_input(state)

        # TODO: Merge config with runnable config
        headers = {
            "Authorization": f"Bearer {self.service_api_key}",
            "Content-Type": "application/nlq",
        }
        r = requests.post(
            f"{self.hostname}/{self.service_name}",
            headers=headers,
            data=api_bridge_input.query,
        )
        r.raise_for_status()
        response = r.text
        if not response:
            response = f"Operation performed: {r.url} Result{r.status_code}"
        output = APIBridgeOutput(result=response)
        self._set_output(state, self.outputType.model_validate(output.model_dump()))

        return state

    async def ainvoke(self, state: Any, config: RunnableConfig) -> Any:
        # TODO: Add proper support for ainvoke.
        self.invoke(state, config)

        return state

APIBridgeInput

Bases: BaseModel

Show JSON schema:
{
  "properties": {
    "query": {
      "description": "Query for the API bridge agent in natural language",
      "title": "Query",
      "type": "string"
    }
  },
  "required": [
    "query"
  ],
  "title": "APIBridgeInput",
  "type": "object"
}

Fields:

Source code in .venv/lib/python3.13/site-packages/agntcy_acp/langgraph/api_bridge.py
12
13
14
15
class APIBridgeInput(BaseModel):
    query: str = Field(
        ..., description="Query for the API bridge agent in natural language"
    )

query pydantic-field

Query for the API bridge agent in natural language

APIBridgeOutput

Bases: BaseModel

Show JSON schema:
{
  "properties": {
    "result": {
      "description": "API response from API bridge agent",
      "title": "Result",
      "type": "string"
    }
  },
  "required": [
    "result"
  ],
  "title": "APIBridgeOutput",
  "type": "object"
}

Fields:

Source code in .venv/lib/python3.13/site-packages/agntcy_acp/langgraph/api_bridge.py
18
19
class APIBridgeOutput(BaseModel):
    result: str = Field(..., description="API response from API bridge agent")

result pydantic-field

API response from API bridge agent

add_io_mapped_edge

Adds an I/O-mapped edge to a LangGraph StateGraph.

Parameters: g: The LangGraph StateGraph to which the edge will be added. start: The starting node of the edge, which can be specified either as a string identifier or as an instance of an ACPNode. end: The ending node of the edge, which can be specified either as a string identifier or as an instance of an ACPNode. iomapper_config: A dictionary containing all the metadata necessary for the IO mapper agent to perform data translation. Defaults to an empty dictionary. llm: An instance of llm model

Returns: None: This function modifies the graph in place by adding the specified edge.

Source code in .venv/lib/python3.13/site-packages/agntcy_acp/langgraph/io_mapper.py
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
def add_io_mapped_edge(
    g: StateGraph,
    start: Union[str, acp_node.ACPNode],
    end: Union[str, acp_node.ACPNode],
    iomapper_config: IOMappingAgentMetadata,
    llm: BaseChatModel,
) -> IOMappingAgent:
    """
    Adds an I/O-mapped edge to a LangGraph StateGraph.

    Parameters:
        g: The LangGraph StateGraph to which the edge will be added.
        start: The starting node of the edge, which can be specified either as a string identifier or as an instance of an ACPNode.
        end: The ending node of the edge, which can be specified either as a string identifier or as an instance of an ACPNode.
        iomapper_config: A dictionary containing all the metadata necessary for the IO mapper agent to perform data translation. Defaults to an empty dictionary.
        llm: An instance of llm model

    Returns:
        None: This function modifies the graph in place by adding the specified edge.
    """
    if isinstance(start, str):
        start_key = start
    else:
        start_key = start.get_name()
        node: acp_node.ACPNode = start
        if "input_fields" not in iomapper_config:
            iomapper_config["input_fields"] = [node.outputPath]

    if isinstance(end, str):
        end_key = end
    else:
        end_key = end.get_name()
        node: acp_node.ACPNode = end
        if "output_fields" not in iomapper_config:
            iomapper_config["output_fields"] = [node.inputPath]

    mapping_agent = IOMappingAgent(metadata=iomapper_config, llm=llm)

    iom_name = f"{start_key}_{end_key}"
    g.add_node(iom_name, mapping_agent.langgraph_node)

    g.add_edge(start_key, iom_name)
    g.add_edge(iom_name, end_key)
    return mapping_agent

add_io_mapped_conditional_edge

Adds a conditional I/O-mapped edge to a LangGraph StateGraph.

Parameters: g: The LangGraph StateGraph to which the conditional edge will be added. start: The starting node of the edge, which can be specified either as a string identifier or as an instance of an ACPNode. path: The conditional path that determines the conditions under which the edge will be traversed. The type and structure of 'path' should be specified based on its use case. iomapper_config_map: A dictionary containing metadata that the IO mapper agent requires for data translation. This map is used to configure the agent based on different conditions. llm: An instance of llm model Returns: None: This function modifies the graph in place by adding the specified conditional edge.

Source code in .venv/lib/python3.13/site-packages/agntcy_acp/langgraph/io_mapper.py
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
def add_io_mapped_conditional_edge(
    g: StateGraph,
    start: Union[str, acp_node.ACPNode],
    path,
    iomapper_config_map: dict,
    llm: BaseChatModel,
) -> dict:
    """
    Adds a conditional I/O-mapped edge to a LangGraph StateGraph.

    Parameters:
        g: The LangGraph StateGraph to which the conditional edge will be added.
        start: The starting node of the edge, which can be specified either as a string identifier or as an instance of an ACPNode.
        path: The conditional path that determines the conditions under which the edge will be traversed. The type and structure of 'path' should be specified based on its use case.
        iomapper_config_map: A dictionary containing metadata that the IO mapper agent requires for data translation. This map is used to configure the agent based on different conditions.
        llm: An instance of llm model
    Returns:
        None: This function modifies the graph in place by adding the specified conditional edge.
    """
    start_node = None
    if isinstance(start, str):
        start_key = start
    else:
        start_key = start.get_name()
        start_node: acp_node.ACPNode = start

    condition_map = {}
    iom_map = {}
    for map_key, v in iomapper_config_map.items():
        end_node = None
        if isinstance(v["end"], str):
            end_key = v["end"]
        else:
            end_key = v["end"].get_name()
            end_node = v["end"]

        if v["metadata"] is None:
            # No IO Mapper is needed
            condition_map[map_key] = end_key
        else:
            if start_node and "input_fields" not in v["metadata"]:
                v["metadata"]["input_fields"] = [start_node.outputPath]
            if end_node and "output_fields" not in v["metadata"]:
                v["metadata"]["output_fields"] = [end_node.inputPath]

            mapping_agent = IOMappingAgent(metadata=v["metadata"], llm=llm)

            iom_name = f"{start_key}_{end_key}"
            g.add_node(iom_name, mapping_agent.langgraph_node)
            g.add_edge(iom_name, end_key)
            iom_map[end_key] = mapping_agent
            condition_map[map_key] = iom_name

    g.add_conditional_edges(start_key, path, condition_map)
    return iom_map

Exceptions

ACPDescriptorValidationException

Bases: Exception

Source code in .venv/lib/python3.13/site-packages/agntcy_acp/exceptions.py
5
6
class ACPDescriptorValidationException(Exception):
    pass

ACPRunException

Bases: Exception

Source code in .venv/lib/python3.13/site-packages/agntcy_acp/exceptions.py
8
9
class ACPRunException(Exception):
    pass

ApiTypeError

Bases: OpenApiException, TypeError

Source code in .venv/lib/python3.13/site-packages/agntcy_acp/acp_v0/exceptions.py
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
class ApiTypeError(OpenApiException, TypeError):
    def __init__(self, msg, path_to_item=None, valid_classes=None,
                 key_type=None) -> None:
        """ Raises an exception for TypeErrors

        Args:
            msg (str): the exception message

        Keyword Args:
            path_to_item (list): a list of keys an indices to get to the
                                 current_item
                                 None if unset
            valid_classes (tuple): the primitive classes that current item
                                   should be an instance of
                                   None if unset
            key_type (bool): False if our value is a value in a dict
                             True if it is a key in a dict
                             False if our item is an item in a list
                             None if unset
        """
        self.path_to_item = path_to_item
        self.valid_classes = valid_classes
        self.key_type = key_type
        full_msg = msg
        if path_to_item:
            full_msg = "{0} at {1}".format(msg, render_path(path_to_item))
        super(ApiTypeError, self).__init__(full_msg)

__init__(msg, path_to_item=None, valid_classes=None, key_type=None)

Raises an exception for TypeErrors

Args: msg (str): the exception message

Keyword Args: path_to_item (list): a list of keys an indices to get to the current_item None if unset valid_classes (tuple): the primitive classes that current item should be an instance of None if unset key_type (bool): False if our value is a value in a dict True if it is a key in a dict False if our item is an item in a list None if unset

Source code in .venv/lib/python3.13/site-packages/agntcy_acp/acp_v0/exceptions.py
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
def __init__(self, msg, path_to_item=None, valid_classes=None,
             key_type=None) -> None:
    """ Raises an exception for TypeErrors

    Args:
        msg (str): the exception message

    Keyword Args:
        path_to_item (list): a list of keys an indices to get to the
                             current_item
                             None if unset
        valid_classes (tuple): the primitive classes that current item
                               should be an instance of
                               None if unset
        key_type (bool): False if our value is a value in a dict
                         True if it is a key in a dict
                         False if our item is an item in a list
                         None if unset
    """
    self.path_to_item = path_to_item
    self.valid_classes = valid_classes
    self.key_type = key_type
    full_msg = msg
    if path_to_item:
        full_msg = "{0} at {1}".format(msg, render_path(path_to_item))
    super(ApiTypeError, self).__init__(full_msg)

ApiValueError

Bases: OpenApiException, ValueError

Source code in .venv/lib/python3.13/site-packages/agntcy_acp/acp_v0/exceptions.py
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
class ApiValueError(OpenApiException, ValueError):
    def __init__(self, msg, path_to_item=None) -> None:
        """
        Args:
            msg (str): the exception message

        Keyword Args:
            path_to_item (list) the path to the exception in the
                received_data dict. None if unset
        """

        self.path_to_item = path_to_item
        full_msg = msg
        if path_to_item:
            full_msg = "{0} at {1}".format(msg, render_path(path_to_item))
        super(ApiValueError, self).__init__(full_msg)

__init__(msg, path_to_item=None)

Args: msg (str): the exception message

Keyword Args: path_to_item (list) the path to the exception in the received_data dict. None if unset

Source code in .venv/lib/python3.13/site-packages/agntcy_acp/acp_v0/exceptions.py
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
def __init__(self, msg, path_to_item=None) -> None:
    """
    Args:
        msg (str): the exception message

    Keyword Args:
        path_to_item (list) the path to the exception in the
            received_data dict. None if unset
    """

    self.path_to_item = path_to_item
    full_msg = msg
    if path_to_item:
        full_msg = "{0} at {1}".format(msg, render_path(path_to_item))
    super(ApiValueError, self).__init__(full_msg)

ApiKeyError

Bases: OpenApiException, KeyError

Source code in .venv/lib/python3.13/site-packages/agntcy_acp/acp_v0/exceptions.py
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
class ApiKeyError(OpenApiException, KeyError):
    def __init__(self, msg, path_to_item=None) -> None:
        """
        Args:
            msg (str): the exception message

        Keyword Args:
            path_to_item (None/list) the path to the exception in the
                received_data dict
        """
        self.path_to_item = path_to_item
        full_msg = msg
        if path_to_item:
            full_msg = "{0} at {1}".format(msg, render_path(path_to_item))
        super(ApiKeyError, self).__init__(full_msg)

__init__(msg, path_to_item=None)

Args: msg (str): the exception message

Keyword Args: path_to_item (None/list) the path to the exception in the received_data dict

Source code in .venv/lib/python3.13/site-packages/agntcy_acp/acp_v0/exceptions.py
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
def __init__(self, msg, path_to_item=None) -> None:
    """
    Args:
        msg (str): the exception message

    Keyword Args:
        path_to_item (None/list) the path to the exception in the
            received_data dict
    """
    self.path_to_item = path_to_item
    full_msg = msg
    if path_to_item:
        full_msg = "{0} at {1}".format(msg, render_path(path_to_item))
    super(ApiKeyError, self).__init__(full_msg)

ApiAttributeError

Bases: OpenApiException, AttributeError

Source code in .venv/lib/python3.13/site-packages/agntcy_acp/acp_v0/exceptions.py
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
class ApiAttributeError(OpenApiException, AttributeError):
    def __init__(self, msg, path_to_item=None) -> None:
        """
        Raised when an attribute reference or assignment fails.

        Args:
            msg (str): the exception message

        Keyword Args:
            path_to_item (None/list) the path to the exception in the
                received_data dict
        """
        self.path_to_item = path_to_item
        full_msg = msg
        if path_to_item:
            full_msg = "{0} at {1}".format(msg, render_path(path_to_item))
        super(ApiAttributeError, self).__init__(full_msg)

__init__(msg, path_to_item=None)

Raised when an attribute reference or assignment fails.

Args: msg (str): the exception message

Keyword Args: path_to_item (None/list) the path to the exception in the received_data dict

Source code in .venv/lib/python3.13/site-packages/agntcy_acp/acp_v0/exceptions.py
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
def __init__(self, msg, path_to_item=None) -> None:
    """
    Raised when an attribute reference or assignment fails.

    Args:
        msg (str): the exception message

    Keyword Args:
        path_to_item (None/list) the path to the exception in the
            received_data dict
    """
    self.path_to_item = path_to_item
    full_msg = msg
    if path_to_item:
        full_msg = "{0} at {1}".format(msg, render_path(path_to_item))
    super(ApiAttributeError, self).__init__(full_msg)

ApiException

Bases: OpenApiException

Source code in .venv/lib/python3.13/site-packages/agntcy_acp/acp_v0/exceptions.py
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
class ApiException(OpenApiException):

    def __init__(
        self, 
        status=None, 
        reason=None, 
        http_resp=None,
        *,
        body: Optional[str] = None,
        data: Optional[Any] = None,
    ) -> None:
        self.status = status
        self.reason = reason
        self.body = body
        self.data = data
        self.headers = None

        if http_resp:
            if self.status is None:
                self.status = http_resp.status
            if self.reason is None:
                self.reason = http_resp.reason
            if self.body is None:
                try:
                    self.body = http_resp.data.decode('utf-8')
                except Exception:
                    pass
            self.headers = http_resp.getheaders()

    @classmethod
    def from_response(
        cls, 
        *, 
        http_resp, 
        body: Optional[str], 
        data: Optional[Any],
    ) -> Self:
        if http_resp.status == 400:
            raise BadRequestException(http_resp=http_resp, body=body, data=data)

        if http_resp.status == 401:
            raise UnauthorizedException(http_resp=http_resp, body=body, data=data)

        if http_resp.status == 403:
            raise ForbiddenException(http_resp=http_resp, body=body, data=data)

        if http_resp.status == 404:
            raise NotFoundException(http_resp=http_resp, body=body, data=data)

        # Added new conditions for 409 and 422
        if http_resp.status == 409:
            raise ConflictException(http_resp=http_resp, body=body, data=data)

        if http_resp.status == 422:
            raise UnprocessableEntityException(http_resp=http_resp, body=body, data=data)

        if 500 <= http_resp.status <= 599:
            raise ServiceException(http_resp=http_resp, body=body, data=data)
        raise ApiException(http_resp=http_resp, body=body, data=data)

    def __str__(self):
        """Custom error messages for exception"""
        error_message = "({0})\n"\
                        "Reason: {1}\n".format(self.status, self.reason)
        if self.headers:
            error_message += "HTTP response headers: {0}\n".format(
                self.headers)

        if self.data or self.body:
            error_message += "HTTP response body: {0}\n".format(self.data or self.body)

        return error_message

__str__()

Custom error messages for exception

Source code in .venv/lib/python3.13/site-packages/agntcy_acp/acp_v0/exceptions.py
166
167
168
169
170
171
172
173
174
175
176
177
def __str__(self):
    """Custom error messages for exception"""
    error_message = "({0})\n"\
                    "Reason: {1}\n".format(self.status, self.reason)
    if self.headers:
        error_message += "HTTP response headers: {0}\n".format(
            self.headers)

    if self.data or self.body:
        error_message += "HTTP response body: {0}\n".format(self.data or self.body)

    return error_message

BadRequestException

Bases: ApiException

Source code in .venv/lib/python3.13/site-packages/agntcy_acp/acp_v0/exceptions.py
180
181
class BadRequestException(ApiException):
    pass

NotFoundException

Bases: ApiException

Source code in .venv/lib/python3.13/site-packages/agntcy_acp/acp_v0/exceptions.py
184
185
class NotFoundException(ApiException):
    pass

UnauthorizedException

Bases: ApiException

Source code in .venv/lib/python3.13/site-packages/agntcy_acp/acp_v0/exceptions.py
188
189
class UnauthorizedException(ApiException):
    pass

ForbiddenException

Bases: ApiException

Source code in .venv/lib/python3.13/site-packages/agntcy_acp/acp_v0/exceptions.py
192
193
class ForbiddenException(ApiException):
    pass

ServiceException

Bases: ApiException

Source code in .venv/lib/python3.13/site-packages/agntcy_acp/acp_v0/exceptions.py
196
197
class ServiceException(ApiException):
    pass

ConflictException

Bases: ApiException

Exception for HTTP 409 Conflict.

Source code in .venv/lib/python3.13/site-packages/agntcy_acp/acp_v0/exceptions.py
200
201
202
class ConflictException(ApiException):
    """Exception for HTTP 409 Conflict."""
    pass

UnprocessableEntityException

Bases: ApiException

Exception for HTTP 422 Unprocessable Entity.

Source code in .venv/lib/python3.13/site-packages/agntcy_acp/acp_v0/exceptions.py
205
206
207
class UnprocessableEntityException(ApiException):
    """Exception for HTTP 422 Unprocessable Entity."""
    pass

OpenApiException

Bases: Exception

The base exception class for all OpenAPIExceptions

Source code in .venv/lib/python3.13/site-packages/agntcy_acp/acp_v0/exceptions.py
19
20
class OpenApiException(Exception):
    """The base exception class for all OpenAPIExceptions"""