acp-easy 0.1.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.
@@ -0,0 +1,150 @@
1
+ Metadata-Version: 2.4
2
+ Name: acp-easy
3
+ Version: 0.1.0
4
+ Summary: A dead-simple , LangChain-style client for ACP server.
5
+ Requires-Python: >=3.12
6
+ Description-Content-Type: text/markdown
7
+ Requires-Dist: httpx
8
+ Requires-Dist: httpx-sse
9
+ Requires-Dist: acp-sdk==1.0.3
10
+ Requires-Dist: uvicorn[standard]==0.35.0
11
+
12
+ # acp-easy
13
+
14
+ A lightweight, LangChain-style Python wrapper around the [ACP SDK](https://pypi.org/project/acp-sdk/) that makes it easy to talk to ACP-compliant agent servers — with auto agent-discovery, sync and async support, and clear error messages.
15
+
16
+ ## Install
17
+
18
+ ```bash
19
+ pip install acp-easy
20
+ ```
21
+
22
+ ## Quick start
23
+
24
+ ```python
25
+ from acp_easy import AcpClient
26
+
27
+ client = AcpClient(base_url="http://localhost:8000", agent="my-agent")
28
+
29
+ reply = client.chat(
30
+ messages=[
31
+ {"role": "user", "content": "Hello!"},
32
+ ],
33
+ model="gpt-4o-mini",
34
+ )
35
+
36
+ print(reply)
37
+ ```
38
+
39
+ Each message must be a dict with `role` and `content` keys, e.g. `{"role": "user", "content": "..."}`.
40
+
41
+ ## Finding your agent name
42
+
43
+ If you don't know what agents your ACP server exposes, list them first:
44
+
45
+ ```python
46
+ from acp_easy import AcpClient
47
+
48
+ client = AcpClient(base_url="http://localhost:8000")
49
+
50
+ agents = client.list_agents()
51
+ print(agents)
52
+ # [{'name': 'my-agent', 'description': 'No description provided.'}]
53
+ ```
54
+
55
+ Each entry gives you the `name` to pass as `agent=...`.
56
+
57
+ - If you don't pass `agent` at all **and** the server has exactly one agent, `acp-easy` auto-resolves it for you.
58
+ - If the server has multiple agents and you don't specify one, you'll get a clear `AcpAgentResolutionError` listing all available agents so you can pick one.
59
+
60
+ You can set a default agent once at client creation instead of passing it on every call:
61
+
62
+ ```python
63
+ client = AcpClient(base_url="http://localhost:8000", agent="my-agent")
64
+ ```
65
+
66
+ ## Available models
67
+
68
+ Pass any of these keys as the `model` argument to `chat()`:
69
+
70
+ | Key | Model |
71
+ |---|---|
72
+ | `GLM-5.2` | `huggingface/zai-org/GLM-5.2` |
73
+ | `gpt-4o-mini` | `openai/gpt-4o-mini` |
74
+ | `Qwen3-Coder-Next` | `huggingface/Qwen/Qwen3-Coder-Next` |
75
+ | `MiniMAX-M3` | `huggingface/MiniMaxAI/MiniMax-M3` |
76
+ | `DeepSeek-V4-Pro` | `huggingface/deepseek-ai/DeepSeek-V4-Pro` |
77
+
78
+ ## Sync vs Async
79
+
80
+ `acp-easy` gives you both sync and async versions of every network call. Use sync in plain scripts, and async inside code that already runs an event loop (FastAPI, Jupyter, asyncio apps).
81
+
82
+ | Task | Sync | Async |
83
+ |---|---|---|
84
+ | List agents | `client.list_agents()` | `await client.list_agents_async()` |
85
+ | Chat | `client.chat(...)` | `await client.chat_async(...)` |
86
+
87
+ ```python
88
+ # Inside a FastAPI route / Jupyter notebook / any async function:
89
+ agents = await client.list_agents_async()
90
+ reply = await client.chat_async(
91
+ messages=[{"role": "user", "content": "Hello!"}],
92
+ model="gpt-4o-mini",
93
+ )
94
+ ```
95
+
96
+ > ⚠️ Calling the sync methods (`chat`, `list_agents`) from inside a running event loop will raise a clear `RuntimeError` telling you to use the `_async` version instead — this avoids the confusing `asyncio.run() cannot be called from a running event loop` crash.
97
+
98
+ ## Multi-turn conversations
99
+
100
+ Pass the full message history as a list — `acp-easy` doesn't manage conversation memory for you:
101
+
102
+ ```python
103
+ reply = client.chat(
104
+ messages=[
105
+ {"role": "user", "content": "My name is Ganaik."},
106
+ {"role": "assistant", "content": "Nice to meet you, Ganaik!"},
107
+ {"role": "user", "content": "What's my name?"},
108
+ ],
109
+ model="gpt-4o-mini",
110
+ )
111
+ ```
112
+
113
+ ## Error handling
114
+
115
+ `acp-easy` raises `AcpAgentResolutionError` for:
116
+ - No agents found on the server
117
+ - Multiple agents found with none specified
118
+ - Malformed messages (missing `role`/`content`, wrong types)
119
+
120
+ ```python
121
+ from acp_easy import AcpClient, AcpAgentResolutionError
122
+
123
+ client = AcpClient(base_url="http://localhost:8000")
124
+
125
+ try:
126
+ reply = client.chat(
127
+ messages=[{"role": "user", "content": "Hi"}],
128
+ model="gpt-4o-mini",
129
+ )
130
+ except AcpAgentResolutionError as e:
131
+ print(f"Couldn't resolve agent: {e}")
132
+ ```
133
+
134
+ ## API reference
135
+
136
+ ### `AcpClient(base_url, agent=None, timeout=60.0)`
137
+ - `base_url` — URL of your ACP server (e.g. `"http://localhost:8000"`)
138
+ - `agent` — optional default agent name; skips auto-discovery if set
139
+ - `timeout` — request timeout in seconds (default `60.0`)
140
+
141
+ ### `client.list_agents()` / `await client.list_agents_async()`
142
+ Returns a list of `{"name": ..., "description": ...}` dicts for all agents on the server.
143
+
144
+ ### `client.chat(messages, model, agent=None)` / `await client.chat_async(messages, model, agent=None)`
145
+ Sends a message history to the resolved agent and returns the agent's text reply.
146
+ - `messages` — list of `{"role": ..., "content": ...}` dicts
147
+ - `model` — model key from the [Available models](#available-models) table
148
+ - `agent` — optional agent name; overrides the client's default for this call only
149
+
150
+ ```
@@ -0,0 +1,4 @@
1
+ acp_easy-0.1.0.dist-info/METADATA,sha256=FpFuLdD_b0Vk3zz_cxcR9YI7mDiHceGoJbMiUVDyshM,4985
2
+ acp_easy-0.1.0.dist-info/WHEEL,sha256=K260EYznzXsJYBQGqmI8VTxEdiZYNvDZwW9cBh9-_MA,91
3
+ acp_easy-0.1.0.dist-info/top_level.txt,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
4
+ acp_easy-0.1.0.dist-info/RECORD,,
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: setuptools (83.0.0)
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
5
+
@@ -0,0 +1 @@
1
+