Skip to content

Commit 9c98f16

Browse files
bokelleyclaude
andcommitted
feat: add reference creative agent helper
Added pre-configured creative_agent for easy access to the reference creative agent at creative.adcontextprotocol.org/mcp. This provides instant access to creative preview functionality without authentication. Features: - creative_agent: Pre-configured ADCPClient for creative operations - CREATIVE_AGENT_CONFIG: Exported configuration constant - No authentication required - Perfect for testing preview_creative and list_creative_formats Added 3 new tests for creative agent functionality and updated README with creative agent examples. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 56297d8 commit 9c98f16

File tree

5 files changed

+91
-5
lines changed

5 files changed

+91
-5
lines changed

README.md

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ if result.success:
4747
Test helpers include:
4848
- **`test_agent`**: Pre-configured MCP test agent (ready to use)
4949
- **`test_agent_a2a`**: Pre-configured A2A test agent
50+
- **`creative_agent`**: Reference creative agent for preview functionality
5051
- **`test_agent_client`**: Multi-agent client with both protocols
5152
- **`create_test_agent()`**: Factory for custom test configurations
5253

@@ -112,8 +113,8 @@ async with ADCPMultiAgentClient(
112113
Pre-configured test agents for instant prototyping and testing:
113114

114115
```python
115-
from adcp.testing import test_agent, test_agent_a2a, test_agent_client, create_test_agent
116-
from adcp.types.generated import GetProductsRequest
116+
from adcp.testing import test_agent, test_agent_a2a, creative_agent, test_agent_client, create_test_agent
117+
from adcp.types.generated import GetProductsRequest, PreviewCreativeRequest
117118

118119
# 1. Single agent (MCP)
119120
result = await test_agent.get_products(
@@ -125,14 +126,21 @@ result = await test_agent_a2a.get_products(
125126
GetProductsRequest(brief="Coffee brands")
126127
)
127128

128-
# 3. Multi-agent (parallel execution)
129+
# 3. Creative agent (preview functionality)
130+
result = await creative_agent.preview_creative(
131+
PreviewCreativeRequest(
132+
manifest={"format_id": "banner_300x250", "assets": {...}}
133+
)
134+
)
135+
136+
# 4. Multi-agent (parallel execution)
129137
results = await test_agent_client.get_products(
130138
GetProductsRequest(brief="Coffee brands")
131139
)
132140

133-
# 4. Custom configuration
141+
# 5. Custom configuration
134142
from adcp.client import ADCPClient
135-
config = create_test_agent(id="my-test", name="My Test Agent")
143+
config = create_test_agent(id="my-test", timeout=60.0)
136144
client = ADCPClient(config)
137145
```
138146

src/adcp/__init__.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,12 @@
2121

2222
# Test helpers
2323
from adcp.testing import (
24+
CREATIVE_AGENT_CONFIG,
2425
TEST_AGENT_A2A_CONFIG,
2526
TEST_AGENT_MCP_CONFIG,
2627
TEST_AGENT_TOKEN,
2728
create_test_agent,
29+
creative_agent,
2830
test_agent,
2931
test_agent_a2a,
3032
test_agent_client,
@@ -159,11 +161,13 @@
159161
# Test helpers
160162
"test_agent",
161163
"test_agent_a2a",
164+
"creative_agent",
162165
"test_agent_client",
163166
"create_test_agent",
164167
"TEST_AGENT_TOKEN",
165168
"TEST_AGENT_MCP_CONFIG",
166169
"TEST_AGENT_A2A_CONFIG",
170+
"CREATIVE_AGENT_CONFIG",
167171
# Exceptions
168172
"ADCPError",
169173
"ADCPConnectionError",

src/adcp/testing/__init__.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,12 @@
66
from __future__ import annotations
77

88
from adcp.testing.test_helpers import (
9+
CREATIVE_AGENT_CONFIG,
910
TEST_AGENT_A2A_CONFIG,
1011
TEST_AGENT_MCP_CONFIG,
1112
TEST_AGENT_TOKEN,
1213
create_test_agent,
14+
creative_agent,
1315
test_agent,
1416
test_agent_a2a,
1517
test_agent_client,
@@ -18,9 +20,11 @@
1820
__all__ = [
1921
"test_agent",
2022
"test_agent_a2a",
23+
"creative_agent",
2124
"test_agent_client",
2225
"create_test_agent",
2326
"TEST_AGENT_TOKEN",
2427
"TEST_AGENT_MCP_CONFIG",
2528
"TEST_AGENT_A2A_CONFIG",
29+
"CREATIVE_AGENT_CONFIG",
2630
]

src/adcp/testing/test_helpers.py

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,14 @@
3030
auth_token=TEST_AGENT_TOKEN,
3131
)
3232

33+
# Reference creative agent configuration - MCP protocol
34+
# No authentication required for the reference creative agent
35+
CREATIVE_AGENT_CONFIG = AgentConfig(
36+
id="creative-agent",
37+
agent_uri="https://creative.adcontextprotocol.org/mcp",
38+
protocol=Protocol.MCP,
39+
)
40+
3341

3442
def _create_test_agent_client() -> ADCPClient:
3543
"""Create pre-configured test agent client using MCP protocol.
@@ -59,6 +67,19 @@ def _create_test_agent_a2a_client() -> ADCPClient:
5967
return ADCPClient(TEST_AGENT_A2A_CONFIG)
6068

6169

70+
def _create_creative_agent_client() -> ADCPClient:
71+
"""Create pre-configured creative agent client.
72+
73+
Returns:
74+
ADCPClient instance configured for the reference creative agent
75+
76+
Note:
77+
The reference creative agent is public and requires no authentication.
78+
It provides creative preview functionality for testing and examples.
79+
"""
80+
return ADCPClient(CREATIVE_AGENT_CONFIG)
81+
82+
6283
def _create_test_multi_agent_client() -> ADCPMultiAgentClient:
6384
"""Create multi-agent client with both test agents configured.
6485
@@ -118,6 +139,29 @@ def _create_test_multi_agent_client() -> ADCPMultiAgentClient:
118139
# DO NOT use in production applications.
119140
test_agent_a2a: ADCPClient = _create_test_agent_a2a_client()
120141

142+
# Pre-configured reference creative agent.
143+
# Provides creative preview functionality without authentication.
144+
#
145+
# Example:
146+
# ```python
147+
# from adcp.testing import creative_agent
148+
# from adcp.types.generated import PreviewCreativeRequest
149+
#
150+
# result = await creative_agent.preview_creative(
151+
# PreviewCreativeRequest(
152+
# manifest={
153+
# "format_id": "banner_300x250",
154+
# "assets": {...}
155+
# }
156+
# )
157+
# )
158+
# ```
159+
#
160+
# Note:
161+
# The reference creative agent is public and requires no authentication.
162+
# Perfect for testing creative rendering and preview functionality.
163+
creative_agent: ADCPClient = _create_creative_agent_client()
164+
121165
# Multi-agent client with both test agents configured.
122166
# Useful for testing multi-agent patterns and protocol comparisons.
123167
#

tests/test_helpers.py

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,12 @@
44

55
from adcp.client import ADCPClient, ADCPMultiAgentClient
66
from adcp.testing import (
7+
CREATIVE_AGENT_CONFIG,
78
TEST_AGENT_A2A_CONFIG,
89
TEST_AGENT_MCP_CONFIG,
910
TEST_AGENT_TOKEN,
1011
create_test_agent,
12+
creative_agent,
1113
test_agent,
1214
test_agent_a2a,
1315
test_agent_client,
@@ -151,3 +153,27 @@ def test_agent_ids_in_test_agent_client():
151153
agent_ids = test_agent_client.agent_ids
152154
assert "test-agent-mcp" in agent_ids
153155
assert "test-agent-a2a" in agent_ids
156+
157+
158+
def test_creative_agent_config_structure():
159+
"""Test CREATIVE_AGENT_CONFIG has correct structure."""
160+
assert CREATIVE_AGENT_CONFIG.id == "creative-agent"
161+
assert CREATIVE_AGENT_CONFIG.protocol == Protocol.MCP
162+
assert CREATIVE_AGENT_CONFIG.agent_uri == "https://creative.adcontextprotocol.org/mcp"
163+
# Creative agent requires no authentication
164+
assert CREATIVE_AGENT_CONFIG.auth_token is None
165+
166+
167+
def test_creative_agent_is_adcp_client():
168+
"""Test that creative_agent is an ADCPClient instance."""
169+
assert isinstance(creative_agent, ADCPClient)
170+
assert hasattr(creative_agent, "preview_creative")
171+
assert hasattr(creative_agent, "list_creative_formats")
172+
assert callable(creative_agent.preview_creative)
173+
assert callable(creative_agent.list_creative_formats)
174+
175+
176+
def test_creative_agent_config_match():
177+
"""Test that creative_agent uses CREATIVE_AGENT_CONFIG."""
178+
assert creative_agent.agent_config.id == CREATIVE_AGENT_CONFIG.id
179+
assert creative_agent.agent_config.protocol == CREATIVE_AGENT_CONFIG.protocol

0 commit comments

Comments
 (0)