acp-sdk 0.3.3__py3-none-any.whl → 0.4.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
acp_sdk/server/errors.py CHANGED
@@ -33,7 +33,7 @@ def status_code_to_error_code(status_code: int) -> ErrorCode:
33
33
  async def acp_error_handler(request: Request, exc: ACPError, *, status_code: int | None = None) -> JSONResponse:
34
34
  error = exc.error
35
35
  return JSONResponse(
36
- status_code=status_code or error_code_to_status_code(error.code), content=error.model_dump_json()
36
+ status_code=status_code or error_code_to_status_code(error.code), content=error.model_dump(mode="json")
37
37
  )
38
38
 
39
39
 
@@ -0,0 +1,63 @@
1
+ Metadata-Version: 2.4
2
+ Name: acp-sdk
3
+ Version: 0.4.0
4
+ Summary: Agent Communication Protocol SDK
5
+ Author: IBM Corp.
6
+ Maintainer-email: Tomas Pilar <thomas7pilar@gmail.com>
7
+ License-Expression: Apache-2.0
8
+ Requires-Python: <4.0,>=3.11
9
+ Requires-Dist: fastapi[standard]>=0.115.8
10
+ Requires-Dist: httpx-sse>=0.4.0
11
+ Requires-Dist: httpx>=0.28.1
12
+ Requires-Dist: janus>=2.0.0
13
+ Requires-Dist: opentelemetry-api>=1.31.1
14
+ Requires-Dist: opentelemetry-exporter-otlp-proto-http>=1.31.1
15
+ Requires-Dist: opentelemetry-instrumentation-fastapi>=0.52b1
16
+ Requires-Dist: opentelemetry-instrumentation-httpx>=0.52b1
17
+ Requires-Dist: opentelemetry-sdk>=1.31.1
18
+ Requires-Dist: pydantic>=2.11.1
19
+ Description-Content-Type: text/markdown
20
+
21
+ # Agent Communication Protocol SDK for Python
22
+
23
+ Agent Communication Protocol SDK for Python provides allows developers to serve and consume agents over the Agent Communication Protocol.
24
+
25
+ ## Prerequisites
26
+
27
+ ✅ Python >= 3.11
28
+
29
+ ## Installation
30
+
31
+ Install with:
32
+
33
+ ```shell
34
+ pip install acp-sdk
35
+ ```
36
+
37
+ ## Quickstart
38
+
39
+ Register an agent and run the server:
40
+
41
+ ```py
42
+ server = Server()
43
+
44
+ @server.agent()
45
+ async def echo(inputs: list[Message]):
46
+ """Echoes everything"""
47
+ for message in inputs:
48
+ yield message
49
+
50
+ server.run(port=8000)
51
+ ```
52
+
53
+ From another process, connect to the server and run the agent:
54
+
55
+ ```py
56
+ async with Client(base_url="http://localhost:8000") as client:
57
+ run = await client.run_sync(agent="echo", inputs=[Message(parts=[MessagePart(content="Howdy!")])])
58
+ print(run)
59
+
60
+ ```
61
+
62
+
63
+ ➡️ Explore more in our [examples library](/examples/python).
@@ -13,13 +13,13 @@ acp_sdk/server/agent.py,sha256=DhcPDPDL9jpDST40K_bInvDXfpF1cwxIhqXzu8z0blU,6203
13
13
  acp_sdk/server/app.py,sha256=3QJzGi05DKoIKyTeYYKKQhcYz4qorQKmVI94_guVkEY,6340
14
14
  acp_sdk/server/bundle.py,sha256=6LZnxsP1rawxic9CwDAQCsOV1v31qNI9meKXMty_yWg,6260
15
15
  acp_sdk/server/context.py,sha256=MgnLV6qcDIhc_0BjW7r4Jj1tHts4ZuwpdTGIBnz2Mgo,1036
16
- acp_sdk/server/errors.py,sha256=IGtpPpb2ChtYvCac8kf_P-RkcY71gBvX0yq97uZWa-w,2104
16
+ acp_sdk/server/errors.py,sha256=GSO8yYIqEeX8Y4Lz86ks35dMTHiQiXuOrLYYx0eXsbI,2110
17
17
  acp_sdk/server/logging.py,sha256=Oc8yZigCsuDnHHPsarRzu0RX3NKaLEgpELM2yovGKDI,411
18
18
  acp_sdk/server/server.py,sha256=-eT3fmnEsBUN44Spi2EP2eV0l4RAlKa8bzqxnhz16SM,5399
19
19
  acp_sdk/server/session.py,sha256=0cDr924HC5x2bBNbK9NSKVHAt5A_mi5dK8P4jP_ugq0,629
20
20
  acp_sdk/server/telemetry.py,sha256=1BUxNg-xL_Vqgs27PDWNc3HikrQW2lidAtT_FKlp_Qk,1833
21
21
  acp_sdk/server/types.py,sha256=E0_9xWwgGzyvJjxtbeBBmSbIPhbbTSXLpHFL5dZDzxI,182
22
22
  acp_sdk/server/utils.py,sha256=EfrF9VCyVk3AM_ao-BIB9EzGbfTrh4V2Bz-VFr6f6Sg,351
23
- acp_sdk-0.3.3.dist-info/METADATA,sha256=X4iVzszNG3pWp7eOLPHz6cxaGI4rmMN8MrtCx1ICTOI,3120
24
- acp_sdk-0.3.3.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
25
- acp_sdk-0.3.3.dist-info/RECORD,,
23
+ acp_sdk-0.4.0.dist-info/METADATA,sha256=mkVdNgaCzH9x76Farbq9WTFf0ZFVFfPTVdPDsTGCMao,1546
24
+ acp_sdk-0.4.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
25
+ acp_sdk-0.4.0.dist-info/RECORD,,
@@ -1,99 +0,0 @@
1
- Metadata-Version: 2.4
2
- Name: acp-sdk
3
- Version: 0.3.3
4
- Summary: Agent Communication Protocol SDK
5
- Author: IBM Corp.
6
- Maintainer-email: Tomas Pilar <thomas7pilar@gmail.com>
7
- License-Expression: Apache-2.0
8
- Requires-Python: <4.0,>=3.11
9
- Requires-Dist: fastapi[standard]>=0.115.8
10
- Requires-Dist: httpx-sse>=0.4.0
11
- Requires-Dist: httpx>=0.28.1
12
- Requires-Dist: janus>=2.0.0
13
- Requires-Dist: opentelemetry-api>=1.31.1
14
- Requires-Dist: opentelemetry-exporter-otlp-proto-http>=1.31.1
15
- Requires-Dist: opentelemetry-instrumentation-fastapi>=0.52b1
16
- Requires-Dist: opentelemetry-instrumentation-httpx>=0.52b1
17
- Requires-Dist: opentelemetry-sdk>=1.31.1
18
- Requires-Dist: pydantic>=2.11.1
19
- Description-Content-Type: text/markdown
20
-
21
- # Agent Communication Protocol SDK for Python
22
-
23
- Agent Communication Protocol SDK for Python provides allows developers to serve and consume agents over the Agent Communication Protocol.
24
-
25
- ## Prerequisites
26
-
27
- ✅ Python >= 3.11
28
-
29
- ## Installation
30
-
31
- Install with:
32
-
33
- ```shell
34
- pip install acp-sdk
35
- ```
36
-
37
- ## Overview
38
-
39
- ### Core
40
-
41
- The core of the SDK exposes [pydantic](https://docs.pydantic.dev/) data models corresponding to REST API requests, responses, resources, events and errors.
42
-
43
-
44
- ### Client
45
-
46
- The `client` submodule exposes [httpx](https://www.python-httpx.org/) based client with simple methods for communication over ACP.
47
-
48
- ```python
49
- async with Client(base_url="http://localhost:8000") as client:
50
- run = await client.run_sync(agent="echo", inputs=[Message(parts=[MessagePart(content="Howdy!")])])
51
- print(run)
52
-
53
- ```
54
-
55
- ### Server
56
-
57
- The `server` submodule exposes `Agent` class and `agent` decorator together with [fastapi](https://fastapi.tiangolo.com/) application factory, making it easy to expose agents over ACP. Additionaly, it exposes [uvicorn](https://www.uvicorn.org/) based server to serve agents with set up logging, [opentelemetry](https://opentelemetry.io/) and more.
58
-
59
- ```python
60
- server = Server()
61
-
62
- @server.agent()
63
- async def echo(inputs: list[Message], context: Context) -> AsyncGenerator[RunYield, RunYieldResume]:
64
- """Echoes everything"""
65
- for message in inputs:
66
- yield {"thought": "I should echo everything"}
67
- await asyncio.sleep(0.5)
68
- yield message
69
-
70
-
71
- server.run()
72
- ```
73
-
74
- ➡️ Explore more in our [examples library](/python/examples).
75
-
76
- ## Architecture
77
-
78
- The architecture of the SDK is outlined in the following segment. It focuses on central parts of the SDK without going into much detail.
79
-
80
- ### Models
81
-
82
- The core of the SDK contains pydantic models for requests, responses, resources, events and errors. Users of the SDK are meant to use these models directly or indirectly.
83
-
84
- ### Server
85
-
86
- The server module consists of 3 parts:
87
-
88
- 1. Agent interface
89
- 2. FastAPI application factory
90
- 3. Uvicorn based server
91
-
92
- Each part builds on top of the previous one. Not all parts need to be used, e.g. users are advised to bring their own ASGI server for production deployments.
93
-
94
- ### Client
95
-
96
- The client module consists of httpx based client with session support. The client is meant to be thin and mimic the REST API. Exception is session management which has been abstracted into a context manager.
97
-
98
-
99
-