adcp 0.1.2__tar.gz → 1.0.2__tar.gz
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.
- {adcp-0.1.2/src/adcp.egg-info → adcp-1.0.2}/PKG-INFO +184 -8
- {adcp-0.1.2 → adcp-1.0.2}/README.md +183 -7
- {adcp-0.1.2 → adcp-1.0.2}/pyproject.toml +6 -1
- adcp-1.0.2/src/adcp/__init__.py +96 -0
- adcp-1.0.2/src/adcp/__main__.py +284 -0
- {adcp-0.1.2 → adcp-1.0.2}/src/adcp/client.py +290 -105
- adcp-1.0.2/src/adcp/config.py +82 -0
- adcp-1.0.2/src/adcp/exceptions.py +121 -0
- {adcp-0.1.2 → adcp-1.0.2}/src/adcp/protocols/__init__.py +2 -0
- adcp-1.0.2/src/adcp/protocols/a2a.py +273 -0
- {adcp-0.1.2 → adcp-1.0.2}/src/adcp/protocols/base.py +11 -0
- adcp-1.0.2/src/adcp/protocols/mcp.py +261 -0
- {adcp-0.1.2 → adcp-1.0.2}/src/adcp/types/__init__.py +4 -0
- adcp-1.0.2/src/adcp/types/core.py +174 -0
- adcp-1.0.2/src/adcp/types/generated.py +615 -0
- adcp-1.0.2/src/adcp/types/tasks.py +281 -0
- {adcp-0.1.2 → adcp-1.0.2}/src/adcp/utils/__init__.py +2 -0
- {adcp-0.1.2 → adcp-1.0.2}/src/adcp/utils/operation_id.py +2 -0
- {adcp-0.1.2 → adcp-1.0.2/src/adcp.egg-info}/PKG-INFO +184 -8
- {adcp-0.1.2 → adcp-1.0.2}/src/adcp.egg-info/SOURCES.txt +8 -0
- adcp-1.0.2/src/adcp.egg-info/entry_points.txt +2 -0
- adcp-1.0.2/tests/test_cli.py +283 -0
- {adcp-0.1.2 → adcp-1.0.2}/tests/test_client.py +86 -12
- adcp-1.0.2/tests/test_code_generation.py +421 -0
- {adcp-0.1.2 → adcp-1.0.2}/tests/test_protocols.py +79 -27
- adcp-0.1.2/src/adcp/__init__.py +0 -18
- adcp-0.1.2/src/adcp/protocols/a2a.py +0 -159
- adcp-0.1.2/src/adcp/protocols/mcp.py +0 -101
- adcp-0.1.2/src/adcp/types/core.py +0 -99
- {adcp-0.1.2 → adcp-1.0.2}/LICENSE +0 -0
- {adcp-0.1.2 → adcp-1.0.2}/setup.cfg +0 -0
- {adcp-0.1.2 → adcp-1.0.2}/src/adcp.egg-info/dependency_links.txt +0 -0
- {adcp-0.1.2 → adcp-1.0.2}/src/adcp.egg-info/requires.txt +0 -0
- {adcp-0.1.2 → adcp-1.0.2}/src/adcp.egg-info/top_level.txt +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: adcp
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 1.0.2
|
|
4
4
|
Summary: Official Python client for the Ad Context Protocol (AdCP)
|
|
5
5
|
Author-email: AdCP Community <maintainers@adcontextprotocol.org>
|
|
6
6
|
License: Apache-2.0
|
|
@@ -62,8 +62,7 @@ pip install adcp
|
|
|
62
62
|
## Quick Start: Distributed Operations
|
|
63
63
|
|
|
64
64
|
```python
|
|
65
|
-
from adcp import ADCPMultiAgentClient
|
|
66
|
-
from adcp.types import AgentConfig
|
|
65
|
+
from adcp import ADCPMultiAgentClient, AgentConfig, GetProductsRequest
|
|
67
66
|
|
|
68
67
|
# Configure agents and handlers
|
|
69
68
|
client = ADCPMultiAgentClient(
|
|
@@ -96,7 +95,8 @@ client = ADCPMultiAgentClient(
|
|
|
96
95
|
|
|
97
96
|
# Execute operation - library handles operation IDs, webhook URLs, context management
|
|
98
97
|
agent = client.agent("agent_x")
|
|
99
|
-
|
|
98
|
+
request = GetProductsRequest(brief="Coffee brands")
|
|
99
|
+
result = await agent.get_products(request)
|
|
100
100
|
|
|
101
101
|
# Check result
|
|
102
102
|
if result.status == "completed":
|
|
@@ -116,23 +116,30 @@ if result.status == "submitted":
|
|
|
116
116
|
- **Auto-detection**: Automatically detect which protocol an agent uses
|
|
117
117
|
|
|
118
118
|
### Type Safety
|
|
119
|
-
Full type hints with Pydantic validation:
|
|
119
|
+
Full type hints with Pydantic validation and auto-generated types from the AdCP spec:
|
|
120
120
|
|
|
121
121
|
```python
|
|
122
|
-
|
|
122
|
+
from adcp import GetProductsRequest
|
|
123
|
+
|
|
124
|
+
# All methods require typed request objects
|
|
125
|
+
request = GetProductsRequest(brief="Coffee brands", max_results=10)
|
|
126
|
+
result = await agent.get_products(request)
|
|
123
127
|
# result: TaskResult[GetProductsResponse]
|
|
124
128
|
|
|
125
129
|
if result.success:
|
|
126
130
|
for product in result.data.products:
|
|
127
|
-
print(product.name, product.
|
|
131
|
+
print(product.name, product.pricing_options) # Full IDE autocomplete!
|
|
128
132
|
```
|
|
129
133
|
|
|
130
134
|
### Multi-Agent Operations
|
|
131
135
|
Execute across multiple agents simultaneously:
|
|
132
136
|
|
|
133
137
|
```python
|
|
138
|
+
from adcp import GetProductsRequest
|
|
139
|
+
|
|
134
140
|
# Parallel execution across all agents
|
|
135
|
-
|
|
141
|
+
request = GetProductsRequest(brief="Coffee brands")
|
|
142
|
+
results = await client.get_products(request)
|
|
136
143
|
|
|
137
144
|
for result in results:
|
|
138
145
|
if result.status == "completed":
|
|
@@ -176,6 +183,69 @@ client = ADCPMultiAgentClient(
|
|
|
176
183
|
# Signatures verified automatically on handle_webhook()
|
|
177
184
|
```
|
|
178
185
|
|
|
186
|
+
### Debug Mode
|
|
187
|
+
|
|
188
|
+
Enable debug mode to see full request/response details:
|
|
189
|
+
|
|
190
|
+
```python
|
|
191
|
+
agent_config = AgentConfig(
|
|
192
|
+
id="agent_x",
|
|
193
|
+
agent_uri="https://agent-x.com",
|
|
194
|
+
protocol="mcp",
|
|
195
|
+
debug=True # Enable debug mode
|
|
196
|
+
)
|
|
197
|
+
|
|
198
|
+
result = await client.agent("agent_x").get_products(brief="Coffee brands")
|
|
199
|
+
|
|
200
|
+
# Access debug information
|
|
201
|
+
if result.debug_info:
|
|
202
|
+
print(f"Duration: {result.debug_info.duration_ms}ms")
|
|
203
|
+
print(f"Request: {result.debug_info.request}")
|
|
204
|
+
print(f"Response: {result.debug_info.response}")
|
|
205
|
+
```
|
|
206
|
+
|
|
207
|
+
Or use the CLI:
|
|
208
|
+
|
|
209
|
+
```bash
|
|
210
|
+
uvx adcp --debug myagent get_products '{"brief":"TV ads"}'
|
|
211
|
+
```
|
|
212
|
+
|
|
213
|
+
### Error Handling
|
|
214
|
+
|
|
215
|
+
The library provides a comprehensive exception hierarchy with helpful error messages:
|
|
216
|
+
|
|
217
|
+
```python
|
|
218
|
+
from adcp.exceptions import (
|
|
219
|
+
ADCPError, # Base exception
|
|
220
|
+
ADCPConnectionError, # Connection failed
|
|
221
|
+
ADCPAuthenticationError, # Auth failed (401, 403)
|
|
222
|
+
ADCPTimeoutError, # Request timed out
|
|
223
|
+
ADCPProtocolError, # Invalid response format
|
|
224
|
+
ADCPToolNotFoundError, # Tool not found
|
|
225
|
+
ADCPWebhookSignatureError # Invalid webhook signature
|
|
226
|
+
)
|
|
227
|
+
|
|
228
|
+
try:
|
|
229
|
+
result = await client.agent("agent_x").get_products(brief="Coffee")
|
|
230
|
+
except ADCPAuthenticationError as e:
|
|
231
|
+
# Exception includes agent context and helpful suggestions
|
|
232
|
+
print(f"Auth failed for {e.agent_id}: {e.message}")
|
|
233
|
+
print(f"Suggestion: {e.suggestion}")
|
|
234
|
+
except ADCPTimeoutError as e:
|
|
235
|
+
print(f"Request timed out after {e.timeout}s")
|
|
236
|
+
except ADCPConnectionError as e:
|
|
237
|
+
print(f"Connection failed: {e.message}")
|
|
238
|
+
print(f"Agent URI: {e.agent_uri}")
|
|
239
|
+
except ADCPError as e:
|
|
240
|
+
# Catch-all for other AdCP errors
|
|
241
|
+
print(f"AdCP error: {e.message}")
|
|
242
|
+
```
|
|
243
|
+
|
|
244
|
+
All exceptions include:
|
|
245
|
+
- **Contextual information**: agent ID, URI, and operation details
|
|
246
|
+
- **Actionable suggestions**: specific steps to fix common issues
|
|
247
|
+
- **Error classification**: proper HTTP status code handling
|
|
248
|
+
|
|
179
249
|
## Available Tools
|
|
180
250
|
|
|
181
251
|
All AdCP tools with full type safety:
|
|
@@ -221,6 +291,112 @@ auth = index.get_agent_authorizations("https://agent-x.com")
|
|
|
221
291
|
premium = index.find_agents_by_property_tags(["premium", "ctv"])
|
|
222
292
|
```
|
|
223
293
|
|
|
294
|
+
## CLI Tool
|
|
295
|
+
|
|
296
|
+
The `adcp` command-line tool provides easy interaction with AdCP agents without writing code.
|
|
297
|
+
|
|
298
|
+
### Installation
|
|
299
|
+
|
|
300
|
+
```bash
|
|
301
|
+
# Install globally
|
|
302
|
+
pip install adcp
|
|
303
|
+
|
|
304
|
+
# Or use uvx to run without installing
|
|
305
|
+
uvx adcp --help
|
|
306
|
+
```
|
|
307
|
+
|
|
308
|
+
### Quick Start
|
|
309
|
+
|
|
310
|
+
```bash
|
|
311
|
+
# Save agent configuration
|
|
312
|
+
uvx adcp --save-auth myagent https://agent.example.com mcp
|
|
313
|
+
|
|
314
|
+
# List tools available on agent
|
|
315
|
+
uvx adcp myagent list_tools
|
|
316
|
+
|
|
317
|
+
# Execute a tool
|
|
318
|
+
uvx adcp myagent get_products '{"brief":"TV ads"}'
|
|
319
|
+
|
|
320
|
+
# Use from stdin
|
|
321
|
+
echo '{"brief":"TV ads"}' | uvx adcp myagent get_products
|
|
322
|
+
|
|
323
|
+
# Use from file
|
|
324
|
+
uvx adcp myagent get_products @request.json
|
|
325
|
+
|
|
326
|
+
# Get JSON output
|
|
327
|
+
uvx adcp --json myagent get_products '{"brief":"TV ads"}'
|
|
328
|
+
|
|
329
|
+
# Enable debug mode
|
|
330
|
+
uvx adcp --debug myagent get_products '{"brief":"TV ads"}'
|
|
331
|
+
```
|
|
332
|
+
|
|
333
|
+
### Configuration Management
|
|
334
|
+
|
|
335
|
+
```bash
|
|
336
|
+
# Save agent with authentication
|
|
337
|
+
uvx adcp --save-auth myagent https://agent.example.com mcp
|
|
338
|
+
# Prompts for optional auth token
|
|
339
|
+
|
|
340
|
+
# List saved agents
|
|
341
|
+
uvx adcp --list-agents
|
|
342
|
+
|
|
343
|
+
# Remove saved agent
|
|
344
|
+
uvx adcp --remove-agent myagent
|
|
345
|
+
|
|
346
|
+
# Show config file location
|
|
347
|
+
uvx adcp --show-config
|
|
348
|
+
```
|
|
349
|
+
|
|
350
|
+
### Direct URL Access
|
|
351
|
+
|
|
352
|
+
```bash
|
|
353
|
+
# Use URL directly without saving
|
|
354
|
+
uvx adcp https://agent.example.com/mcp list_tools
|
|
355
|
+
|
|
356
|
+
# Override protocol
|
|
357
|
+
uvx adcp --protocol a2a https://agent.example.com list_tools
|
|
358
|
+
|
|
359
|
+
# Pass auth token
|
|
360
|
+
uvx adcp --auth YOUR_TOKEN https://agent.example.com list_tools
|
|
361
|
+
```
|
|
362
|
+
|
|
363
|
+
### Examples
|
|
364
|
+
|
|
365
|
+
```bash
|
|
366
|
+
# Get products from saved agent
|
|
367
|
+
uvx adcp myagent get_products '{"brief":"Coffee brands for digital video"}'
|
|
368
|
+
|
|
369
|
+
# Create media buy
|
|
370
|
+
uvx adcp myagent create_media_buy '{
|
|
371
|
+
"name": "Q4 Campaign",
|
|
372
|
+
"budget": 50000,
|
|
373
|
+
"start_date": "2024-01-01",
|
|
374
|
+
"end_date": "2024-03-31"
|
|
375
|
+
}'
|
|
376
|
+
|
|
377
|
+
# List creative formats with JSON output
|
|
378
|
+
uvx adcp --json myagent list_creative_formats | jq '.data'
|
|
379
|
+
|
|
380
|
+
# Debug connection issues
|
|
381
|
+
uvx adcp --debug myagent list_tools
|
|
382
|
+
```
|
|
383
|
+
|
|
384
|
+
### Configuration File
|
|
385
|
+
|
|
386
|
+
Agent configurations are stored in `~/.adcp/config.json`:
|
|
387
|
+
|
|
388
|
+
```json
|
|
389
|
+
{
|
|
390
|
+
"agents": {
|
|
391
|
+
"myagent": {
|
|
392
|
+
"agent_uri": "https://agent.example.com",
|
|
393
|
+
"protocol": "mcp",
|
|
394
|
+
"auth_token": "optional-token"
|
|
395
|
+
}
|
|
396
|
+
}
|
|
397
|
+
}
|
|
398
|
+
```
|
|
399
|
+
|
|
224
400
|
## Environment Configuration
|
|
225
401
|
|
|
226
402
|
```bash
|
|
@@ -25,8 +25,7 @@ pip install adcp
|
|
|
25
25
|
## Quick Start: Distributed Operations
|
|
26
26
|
|
|
27
27
|
```python
|
|
28
|
-
from adcp import ADCPMultiAgentClient
|
|
29
|
-
from adcp.types import AgentConfig
|
|
28
|
+
from adcp import ADCPMultiAgentClient, AgentConfig, GetProductsRequest
|
|
30
29
|
|
|
31
30
|
# Configure agents and handlers
|
|
32
31
|
client = ADCPMultiAgentClient(
|
|
@@ -59,7 +58,8 @@ client = ADCPMultiAgentClient(
|
|
|
59
58
|
|
|
60
59
|
# Execute operation - library handles operation IDs, webhook URLs, context management
|
|
61
60
|
agent = client.agent("agent_x")
|
|
62
|
-
|
|
61
|
+
request = GetProductsRequest(brief="Coffee brands")
|
|
62
|
+
result = await agent.get_products(request)
|
|
63
63
|
|
|
64
64
|
# Check result
|
|
65
65
|
if result.status == "completed":
|
|
@@ -79,23 +79,30 @@ if result.status == "submitted":
|
|
|
79
79
|
- **Auto-detection**: Automatically detect which protocol an agent uses
|
|
80
80
|
|
|
81
81
|
### Type Safety
|
|
82
|
-
Full type hints with Pydantic validation:
|
|
82
|
+
Full type hints with Pydantic validation and auto-generated types from the AdCP spec:
|
|
83
83
|
|
|
84
84
|
```python
|
|
85
|
-
|
|
85
|
+
from adcp import GetProductsRequest
|
|
86
|
+
|
|
87
|
+
# All methods require typed request objects
|
|
88
|
+
request = GetProductsRequest(brief="Coffee brands", max_results=10)
|
|
89
|
+
result = await agent.get_products(request)
|
|
86
90
|
# result: TaskResult[GetProductsResponse]
|
|
87
91
|
|
|
88
92
|
if result.success:
|
|
89
93
|
for product in result.data.products:
|
|
90
|
-
print(product.name, product.
|
|
94
|
+
print(product.name, product.pricing_options) # Full IDE autocomplete!
|
|
91
95
|
```
|
|
92
96
|
|
|
93
97
|
### Multi-Agent Operations
|
|
94
98
|
Execute across multiple agents simultaneously:
|
|
95
99
|
|
|
96
100
|
```python
|
|
101
|
+
from adcp import GetProductsRequest
|
|
102
|
+
|
|
97
103
|
# Parallel execution across all agents
|
|
98
|
-
|
|
104
|
+
request = GetProductsRequest(brief="Coffee brands")
|
|
105
|
+
results = await client.get_products(request)
|
|
99
106
|
|
|
100
107
|
for result in results:
|
|
101
108
|
if result.status == "completed":
|
|
@@ -139,6 +146,69 @@ client = ADCPMultiAgentClient(
|
|
|
139
146
|
# Signatures verified automatically on handle_webhook()
|
|
140
147
|
```
|
|
141
148
|
|
|
149
|
+
### Debug Mode
|
|
150
|
+
|
|
151
|
+
Enable debug mode to see full request/response details:
|
|
152
|
+
|
|
153
|
+
```python
|
|
154
|
+
agent_config = AgentConfig(
|
|
155
|
+
id="agent_x",
|
|
156
|
+
agent_uri="https://agent-x.com",
|
|
157
|
+
protocol="mcp",
|
|
158
|
+
debug=True # Enable debug mode
|
|
159
|
+
)
|
|
160
|
+
|
|
161
|
+
result = await client.agent("agent_x").get_products(brief="Coffee brands")
|
|
162
|
+
|
|
163
|
+
# Access debug information
|
|
164
|
+
if result.debug_info:
|
|
165
|
+
print(f"Duration: {result.debug_info.duration_ms}ms")
|
|
166
|
+
print(f"Request: {result.debug_info.request}")
|
|
167
|
+
print(f"Response: {result.debug_info.response}")
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
Or use the CLI:
|
|
171
|
+
|
|
172
|
+
```bash
|
|
173
|
+
uvx adcp --debug myagent get_products '{"brief":"TV ads"}'
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
### Error Handling
|
|
177
|
+
|
|
178
|
+
The library provides a comprehensive exception hierarchy with helpful error messages:
|
|
179
|
+
|
|
180
|
+
```python
|
|
181
|
+
from adcp.exceptions import (
|
|
182
|
+
ADCPError, # Base exception
|
|
183
|
+
ADCPConnectionError, # Connection failed
|
|
184
|
+
ADCPAuthenticationError, # Auth failed (401, 403)
|
|
185
|
+
ADCPTimeoutError, # Request timed out
|
|
186
|
+
ADCPProtocolError, # Invalid response format
|
|
187
|
+
ADCPToolNotFoundError, # Tool not found
|
|
188
|
+
ADCPWebhookSignatureError # Invalid webhook signature
|
|
189
|
+
)
|
|
190
|
+
|
|
191
|
+
try:
|
|
192
|
+
result = await client.agent("agent_x").get_products(brief="Coffee")
|
|
193
|
+
except ADCPAuthenticationError as e:
|
|
194
|
+
# Exception includes agent context and helpful suggestions
|
|
195
|
+
print(f"Auth failed for {e.agent_id}: {e.message}")
|
|
196
|
+
print(f"Suggestion: {e.suggestion}")
|
|
197
|
+
except ADCPTimeoutError as e:
|
|
198
|
+
print(f"Request timed out after {e.timeout}s")
|
|
199
|
+
except ADCPConnectionError as e:
|
|
200
|
+
print(f"Connection failed: {e.message}")
|
|
201
|
+
print(f"Agent URI: {e.agent_uri}")
|
|
202
|
+
except ADCPError as e:
|
|
203
|
+
# Catch-all for other AdCP errors
|
|
204
|
+
print(f"AdCP error: {e.message}")
|
|
205
|
+
```
|
|
206
|
+
|
|
207
|
+
All exceptions include:
|
|
208
|
+
- **Contextual information**: agent ID, URI, and operation details
|
|
209
|
+
- **Actionable suggestions**: specific steps to fix common issues
|
|
210
|
+
- **Error classification**: proper HTTP status code handling
|
|
211
|
+
|
|
142
212
|
## Available Tools
|
|
143
213
|
|
|
144
214
|
All AdCP tools with full type safety:
|
|
@@ -184,6 +254,112 @@ auth = index.get_agent_authorizations("https://agent-x.com")
|
|
|
184
254
|
premium = index.find_agents_by_property_tags(["premium", "ctv"])
|
|
185
255
|
```
|
|
186
256
|
|
|
257
|
+
## CLI Tool
|
|
258
|
+
|
|
259
|
+
The `adcp` command-line tool provides easy interaction with AdCP agents without writing code.
|
|
260
|
+
|
|
261
|
+
### Installation
|
|
262
|
+
|
|
263
|
+
```bash
|
|
264
|
+
# Install globally
|
|
265
|
+
pip install adcp
|
|
266
|
+
|
|
267
|
+
# Or use uvx to run without installing
|
|
268
|
+
uvx adcp --help
|
|
269
|
+
```
|
|
270
|
+
|
|
271
|
+
### Quick Start
|
|
272
|
+
|
|
273
|
+
```bash
|
|
274
|
+
# Save agent configuration
|
|
275
|
+
uvx adcp --save-auth myagent https://agent.example.com mcp
|
|
276
|
+
|
|
277
|
+
# List tools available on agent
|
|
278
|
+
uvx adcp myagent list_tools
|
|
279
|
+
|
|
280
|
+
# Execute a tool
|
|
281
|
+
uvx adcp myagent get_products '{"brief":"TV ads"}'
|
|
282
|
+
|
|
283
|
+
# Use from stdin
|
|
284
|
+
echo '{"brief":"TV ads"}' | uvx adcp myagent get_products
|
|
285
|
+
|
|
286
|
+
# Use from file
|
|
287
|
+
uvx adcp myagent get_products @request.json
|
|
288
|
+
|
|
289
|
+
# Get JSON output
|
|
290
|
+
uvx adcp --json myagent get_products '{"brief":"TV ads"}'
|
|
291
|
+
|
|
292
|
+
# Enable debug mode
|
|
293
|
+
uvx adcp --debug myagent get_products '{"brief":"TV ads"}'
|
|
294
|
+
```
|
|
295
|
+
|
|
296
|
+
### Configuration Management
|
|
297
|
+
|
|
298
|
+
```bash
|
|
299
|
+
# Save agent with authentication
|
|
300
|
+
uvx adcp --save-auth myagent https://agent.example.com mcp
|
|
301
|
+
# Prompts for optional auth token
|
|
302
|
+
|
|
303
|
+
# List saved agents
|
|
304
|
+
uvx adcp --list-agents
|
|
305
|
+
|
|
306
|
+
# Remove saved agent
|
|
307
|
+
uvx adcp --remove-agent myagent
|
|
308
|
+
|
|
309
|
+
# Show config file location
|
|
310
|
+
uvx adcp --show-config
|
|
311
|
+
```
|
|
312
|
+
|
|
313
|
+
### Direct URL Access
|
|
314
|
+
|
|
315
|
+
```bash
|
|
316
|
+
# Use URL directly without saving
|
|
317
|
+
uvx adcp https://agent.example.com/mcp list_tools
|
|
318
|
+
|
|
319
|
+
# Override protocol
|
|
320
|
+
uvx adcp --protocol a2a https://agent.example.com list_tools
|
|
321
|
+
|
|
322
|
+
# Pass auth token
|
|
323
|
+
uvx adcp --auth YOUR_TOKEN https://agent.example.com list_tools
|
|
324
|
+
```
|
|
325
|
+
|
|
326
|
+
### Examples
|
|
327
|
+
|
|
328
|
+
```bash
|
|
329
|
+
# Get products from saved agent
|
|
330
|
+
uvx adcp myagent get_products '{"brief":"Coffee brands for digital video"}'
|
|
331
|
+
|
|
332
|
+
# Create media buy
|
|
333
|
+
uvx adcp myagent create_media_buy '{
|
|
334
|
+
"name": "Q4 Campaign",
|
|
335
|
+
"budget": 50000,
|
|
336
|
+
"start_date": "2024-01-01",
|
|
337
|
+
"end_date": "2024-03-31"
|
|
338
|
+
}'
|
|
339
|
+
|
|
340
|
+
# List creative formats with JSON output
|
|
341
|
+
uvx adcp --json myagent list_creative_formats | jq '.data'
|
|
342
|
+
|
|
343
|
+
# Debug connection issues
|
|
344
|
+
uvx adcp --debug myagent list_tools
|
|
345
|
+
```
|
|
346
|
+
|
|
347
|
+
### Configuration File
|
|
348
|
+
|
|
349
|
+
Agent configurations are stored in `~/.adcp/config.json`:
|
|
350
|
+
|
|
351
|
+
```json
|
|
352
|
+
{
|
|
353
|
+
"agents": {
|
|
354
|
+
"myagent": {
|
|
355
|
+
"agent_uri": "https://agent.example.com",
|
|
356
|
+
"protocol": "mcp",
|
|
357
|
+
"auth_token": "optional-token"
|
|
358
|
+
}
|
|
359
|
+
}
|
|
360
|
+
}
|
|
361
|
+
```
|
|
362
|
+
|
|
187
363
|
## Environment Configuration
|
|
188
364
|
|
|
189
365
|
```bash
|
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "adcp"
|
|
7
|
-
version = "0.
|
|
7
|
+
version = "1.0.2"
|
|
8
8
|
description = "Official Python client for the Ad Context Protocol (AdCP)"
|
|
9
9
|
authors = [
|
|
10
10
|
{name = "AdCP Community", email = "maintainers@adcontextprotocol.org"}
|
|
@@ -33,6 +33,9 @@ dependencies = [
|
|
|
33
33
|
"mcp>=0.9.0",
|
|
34
34
|
]
|
|
35
35
|
|
|
36
|
+
[project.scripts]
|
|
37
|
+
adcp = "adcp.__main__:main"
|
|
38
|
+
|
|
36
39
|
[project.optional-dependencies]
|
|
37
40
|
dev = [
|
|
38
41
|
"pytest>=7.0.0",
|
|
@@ -59,9 +62,11 @@ target-version = ["py310", "py311", "py312"]
|
|
|
59
62
|
[tool.ruff]
|
|
60
63
|
line-length = 100
|
|
61
64
|
target-version = "py310"
|
|
65
|
+
extend-exclude = ["src/adcp/types/generated.py", "src/adcp/types/tasks.py"]
|
|
62
66
|
|
|
63
67
|
[tool.ruff.lint]
|
|
64
68
|
select = ["E", "F", "I", "N", "W", "UP"]
|
|
69
|
+
ignore = ["E402"] # Allow imports after module docstrings
|
|
65
70
|
|
|
66
71
|
[tool.mypy]
|
|
67
72
|
python_version = "3.10"
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
"""
|
|
4
|
+
AdCP Python Client Library
|
|
5
|
+
|
|
6
|
+
Official Python client for the Ad Context Protocol (AdCP).
|
|
7
|
+
Supports both A2A and MCP protocols with full type safety.
|
|
8
|
+
"""
|
|
9
|
+
|
|
10
|
+
from adcp.client import ADCPClient, ADCPMultiAgentClient
|
|
11
|
+
from adcp.exceptions import (
|
|
12
|
+
ADCPAuthenticationError,
|
|
13
|
+
ADCPConnectionError,
|
|
14
|
+
ADCPError,
|
|
15
|
+
ADCPProtocolError,
|
|
16
|
+
ADCPTimeoutError,
|
|
17
|
+
ADCPToolNotFoundError,
|
|
18
|
+
ADCPWebhookError,
|
|
19
|
+
ADCPWebhookSignatureError,
|
|
20
|
+
)
|
|
21
|
+
from adcp.types.core import AgentConfig, Protocol, TaskResult, TaskStatus, WebhookMetadata
|
|
22
|
+
from adcp.types.generated import (
|
|
23
|
+
ActivateSignalRequest,
|
|
24
|
+
ActivateSignalResponse,
|
|
25
|
+
CreateMediaBuyRequest,
|
|
26
|
+
CreateMediaBuyResponse,
|
|
27
|
+
GetMediaBuyDeliveryRequest,
|
|
28
|
+
GetMediaBuyDeliveryResponse,
|
|
29
|
+
GetProductsRequest,
|
|
30
|
+
GetProductsResponse,
|
|
31
|
+
GetSignalsRequest,
|
|
32
|
+
GetSignalsResponse,
|
|
33
|
+
ListAuthorizedPropertiesRequest,
|
|
34
|
+
ListAuthorizedPropertiesResponse,
|
|
35
|
+
ListCreativeFormatsRequest,
|
|
36
|
+
ListCreativeFormatsResponse,
|
|
37
|
+
ListCreativesRequest,
|
|
38
|
+
ListCreativesResponse,
|
|
39
|
+
MediaBuy,
|
|
40
|
+
Product,
|
|
41
|
+
ProvidePerformanceFeedbackRequest,
|
|
42
|
+
ProvidePerformanceFeedbackResponse,
|
|
43
|
+
SyncCreativesRequest,
|
|
44
|
+
SyncCreativesResponse,
|
|
45
|
+
UpdateMediaBuyRequest,
|
|
46
|
+
UpdateMediaBuyResponse,
|
|
47
|
+
)
|
|
48
|
+
|
|
49
|
+
__version__ = "1.0.2"
|
|
50
|
+
|
|
51
|
+
__all__ = [
|
|
52
|
+
# Client classes
|
|
53
|
+
"ADCPClient",
|
|
54
|
+
"ADCPMultiAgentClient",
|
|
55
|
+
# Core types
|
|
56
|
+
"AgentConfig",
|
|
57
|
+
"Protocol",
|
|
58
|
+
"TaskResult",
|
|
59
|
+
"TaskStatus",
|
|
60
|
+
"WebhookMetadata",
|
|
61
|
+
# Exceptions
|
|
62
|
+
"ADCPError",
|
|
63
|
+
"ADCPConnectionError",
|
|
64
|
+
"ADCPAuthenticationError",
|
|
65
|
+
"ADCPTimeoutError",
|
|
66
|
+
"ADCPProtocolError",
|
|
67
|
+
"ADCPToolNotFoundError",
|
|
68
|
+
"ADCPWebhookError",
|
|
69
|
+
"ADCPWebhookSignatureError",
|
|
70
|
+
# Generated request/response types
|
|
71
|
+
"GetProductsRequest",
|
|
72
|
+
"GetProductsResponse",
|
|
73
|
+
"CreateMediaBuyRequest",
|
|
74
|
+
"CreateMediaBuyResponse",
|
|
75
|
+
"UpdateMediaBuyRequest",
|
|
76
|
+
"UpdateMediaBuyResponse",
|
|
77
|
+
"SyncCreativesRequest",
|
|
78
|
+
"SyncCreativesResponse",
|
|
79
|
+
"ListCreativesRequest",
|
|
80
|
+
"ListCreativesResponse",
|
|
81
|
+
"ListCreativeFormatsRequest",
|
|
82
|
+
"ListCreativeFormatsResponse",
|
|
83
|
+
"GetMediaBuyDeliveryRequest",
|
|
84
|
+
"GetMediaBuyDeliveryResponse",
|
|
85
|
+
"ListAuthorizedPropertiesRequest",
|
|
86
|
+
"ListAuthorizedPropertiesResponse",
|
|
87
|
+
"GetSignalsRequest",
|
|
88
|
+
"GetSignalsResponse",
|
|
89
|
+
"ActivateSignalRequest",
|
|
90
|
+
"ActivateSignalResponse",
|
|
91
|
+
"ProvidePerformanceFeedbackRequest",
|
|
92
|
+
"ProvidePerformanceFeedbackResponse",
|
|
93
|
+
# Core domain types
|
|
94
|
+
"Product",
|
|
95
|
+
"MediaBuy",
|
|
96
|
+
]
|