pyagent-blueprint 0.1.0__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.
- pyagent_blueprint-0.1.0/.gitignore +18 -0
- pyagent_blueprint-0.1.0/PKG-INFO +288 -0
- pyagent_blueprint-0.1.0/README.md +255 -0
- pyagent_blueprint-0.1.0/pyproject.toml +46 -0
- pyagent_blueprint-0.1.0/src/pyagent_blueprint/__init__.py +49 -0
- pyagent_blueprint-0.1.0/src/pyagent_blueprint/cli.py +160 -0
- pyagent_blueprint-0.1.0/src/pyagent_blueprint/compiler.py +196 -0
- pyagent_blueprint-0.1.0/src/pyagent_blueprint/differ.py +142 -0
- pyagent_blueprint-0.1.0/src/pyagent_blueprint/generator.py +108 -0
- pyagent_blueprint-0.1.0/src/pyagent_blueprint/loader.py +71 -0
- pyagent_blueprint-0.1.0/src/pyagent_blueprint/py.typed +0 -0
- pyagent_blueprint-0.1.0/src/pyagent_blueprint/renderer.py +121 -0
- pyagent_blueprint-0.1.0/src/pyagent_blueprint/runtime.py +78 -0
- pyagent_blueprint-0.1.0/src/pyagent_blueprint/schema/__init__.py +37 -0
- pyagent_blueprint-0.1.0/src/pyagent_blueprint/schema/agents.py +15 -0
- pyagent_blueprint-0.1.0/src/pyagent_blueprint/schema/context.py +37 -0
- pyagent_blueprint-0.1.0/src/pyagent_blueprint/schema/contracts.py +23 -0
- pyagent_blueprint-0.1.0/src/pyagent_blueprint/schema/metadata.py +15 -0
- pyagent_blueprint-0.1.0/src/pyagent_blueprint/schema/observability.py +27 -0
- pyagent_blueprint-0.1.0/src/pyagent_blueprint/schema/providers.py +13 -0
- pyagent_blueprint-0.1.0/src/pyagent_blueprint/schema/spec.py +30 -0
- pyagent_blueprint-0.1.0/src/pyagent_blueprint/schema/workflows.py +25 -0
- pyagent_blueprint-0.1.0/src/pyagent_blueprint/tester.py +129 -0
- pyagent_blueprint-0.1.0/src/pyagent_blueprint/validator.py +155 -0
- pyagent_blueprint-0.1.0/tests/__init__.py +0 -0
- pyagent_blueprint-0.1.0/tests/fixtures/customer_support.yaml +59 -0
- pyagent_blueprint-0.1.0/tests/fixtures/invalid_blueprint.yaml +10 -0
- pyagent_blueprint-0.1.0/tests/fixtures/research_agent.yaml +24 -0
- pyagent_blueprint-0.1.0/tests/test_cli.py +70 -0
- pyagent_blueprint-0.1.0/tests/test_compiler.py +61 -0
- pyagent_blueprint-0.1.0/tests/test_differ.py +92 -0
- pyagent_blueprint-0.1.0/tests/test_loader.py +59 -0
- pyagent_blueprint-0.1.0/tests/test_renderer.py +54 -0
- pyagent_blueprint-0.1.0/tests/test_schema.py +63 -0
- pyagent_blueprint-0.1.0/tests/test_tester.py +60 -0
- pyagent_blueprint-0.1.0/tests/test_validator.py +81 -0
|
@@ -0,0 +1,288 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: pyagent-blueprint
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Declarative YAML specs for multi-agent LLM systems — validate, compile, test, diff, render
|
|
5
|
+
Project-URL: Homepage, https://pyagent.org
|
|
6
|
+
Project-URL: Repository, https://github.com/pyagent-core/pyagent
|
|
7
|
+
Project-URL: Documentation, https://pyagent.org
|
|
8
|
+
Author-email: PyAgent Team <team@pyagent.org>
|
|
9
|
+
License: MIT
|
|
10
|
+
Keywords: LLM,YAML,agents,blueprint,declarative,schema
|
|
11
|
+
Classifier: Development Status :: 3 - Alpha
|
|
12
|
+
Classifier: Intended Audience :: Developers
|
|
13
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
17
|
+
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
18
|
+
Classifier: Typing :: Typed
|
|
19
|
+
Requires-Python: >=3.11
|
|
20
|
+
Requires-Dist: click>=8.1
|
|
21
|
+
Requires-Dist: pyagent-context>=0.1.0
|
|
22
|
+
Requires-Dist: pyagent-patterns>=0.1.0
|
|
23
|
+
Requires-Dist: pyagent-providers>=0.1.0
|
|
24
|
+
Requires-Dist: pyagent-router>=0.1.0
|
|
25
|
+
Requires-Dist: pydantic>=2.7
|
|
26
|
+
Requires-Dist: pyyaml>=6.0
|
|
27
|
+
Provides-Extra: dev
|
|
28
|
+
Requires-Dist: mypy>=1.10; extra == 'dev'
|
|
29
|
+
Requires-Dist: pytest-asyncio>=0.23; extra == 'dev'
|
|
30
|
+
Requires-Dist: pytest>=8.0; extra == 'dev'
|
|
31
|
+
Requires-Dist: ruff>=0.5; extra == 'dev'
|
|
32
|
+
Description-Content-Type: text/markdown
|
|
33
|
+
|
|
34
|
+
# pyagent-blueprint
|
|
35
|
+
|
|
36
|
+
**Declarative YAML specs for multi-agent LLM systems** — validate, compile, test, diff, render, and generate agent system blueprints.
|
|
37
|
+
|
|
38
|
+
[](../../LICENSE)
|
|
39
|
+
[](https://www.python.org/downloads/)
|
|
40
|
+
|
|
41
|
+
## Install
|
|
42
|
+
|
|
43
|
+
```bash
|
|
44
|
+
pip install pyagent-blueprint
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
Depends on: `pyagent-patterns`, `pyagent-router`, `pyagent-providers`, `pyagent-context`, `pydantic`, `pyyaml`, `click`.
|
|
48
|
+
|
|
49
|
+
## Why Blueprints?
|
|
50
|
+
|
|
51
|
+
Without blueprints, agent systems are defined in code — hard to version, diff, review, or test without running them. With `pyagent-blueprint`, your agent system is a **YAML document** that is:
|
|
52
|
+
- **Versioned**: semantic version + git-diffable
|
|
53
|
+
- **Validated**: Pydantic schema + static analysis (dangling refs, security)
|
|
54
|
+
- **Compiled**: YAML → executable RuntimeGraph in one call
|
|
55
|
+
- **Testable**: contract conformance tests with MockLLM
|
|
56
|
+
- **Renderable**: Mermaid diagrams + Markdown docs auto-generated
|
|
57
|
+
|
|
58
|
+
## Blueprint YAML Schema
|
|
59
|
+
|
|
60
|
+
```yaml
|
|
61
|
+
api_version: pyagent/v1
|
|
62
|
+
metadata:
|
|
63
|
+
name: customer-support
|
|
64
|
+
version: 1.0.0
|
|
65
|
+
description: Support routing system
|
|
66
|
+
owner: platform-team
|
|
67
|
+
|
|
68
|
+
providers:
|
|
69
|
+
primary:
|
|
70
|
+
model: gpt-4.1-mini
|
|
71
|
+
fallback:
|
|
72
|
+
model: gpt-4.1-nano
|
|
73
|
+
|
|
74
|
+
context:
|
|
75
|
+
memory:
|
|
76
|
+
working_max_tokens: 128000
|
|
77
|
+
compression:
|
|
78
|
+
policy: semantic_lossless
|
|
79
|
+
target_ratio: 0.6
|
|
80
|
+
|
|
81
|
+
agents:
|
|
82
|
+
classifier:
|
|
83
|
+
prompt: "Classify into: billing, tech, general"
|
|
84
|
+
provider: primary
|
|
85
|
+
billing:
|
|
86
|
+
prompt: "Handle billing inquiries"
|
|
87
|
+
provider: primary
|
|
88
|
+
guardrails: [pii_redact]
|
|
89
|
+
tech:
|
|
90
|
+
prompt: "Handle technical support"
|
|
91
|
+
provider: primary
|
|
92
|
+
|
|
93
|
+
workflows:
|
|
94
|
+
support:
|
|
95
|
+
pattern: supervisor
|
|
96
|
+
agents:
|
|
97
|
+
classifier: classifier
|
|
98
|
+
routes:
|
|
99
|
+
billing: billing
|
|
100
|
+
tech: tech
|
|
101
|
+
recovery:
|
|
102
|
+
max_retries: 2
|
|
103
|
+
timeout_seconds: 30
|
|
104
|
+
|
|
105
|
+
contracts:
|
|
106
|
+
support:
|
|
107
|
+
input:
|
|
108
|
+
type: string
|
|
109
|
+
max_tokens: 2000
|
|
110
|
+
output:
|
|
111
|
+
type: string
|
|
112
|
+
sla:
|
|
113
|
+
latency_p95_ms: 5000
|
|
114
|
+
cost_max_usd: 0.05
|
|
115
|
+
|
|
116
|
+
observability:
|
|
117
|
+
tracing:
|
|
118
|
+
enabled: true
|
|
119
|
+
cost_budget:
|
|
120
|
+
daily_usd: 100.0
|
|
121
|
+
alert_threshold: 0.8
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
## Loader — Load and Validate
|
|
125
|
+
|
|
126
|
+
```python
|
|
127
|
+
from pyagent_blueprint import load_blueprint, load_blueprint_from_str
|
|
128
|
+
|
|
129
|
+
# From file
|
|
130
|
+
spec = load_blueprint("blueprint.yaml") # YAML or JSON
|
|
131
|
+
print(spec.metadata.name) # "customer-support"
|
|
132
|
+
print(spec.agents.keys()) # dict_keys(['classifier', 'billing', 'tech'])
|
|
133
|
+
|
|
134
|
+
# From string
|
|
135
|
+
spec = load_blueprint_from_str(yaml_text)
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
## Compiler — Spec → RuntimeGraph
|
|
139
|
+
|
|
140
|
+
```python
|
|
141
|
+
import asyncio
|
|
142
|
+
from pyagent_blueprint import BlueprintCompiler, load_blueprint
|
|
143
|
+
|
|
144
|
+
spec = load_blueprint("blueprint.yaml")
|
|
145
|
+
compiler = BlueprintCompiler()
|
|
146
|
+
graph = compiler.compile(spec)
|
|
147
|
+
|
|
148
|
+
# Run a workflow
|
|
149
|
+
result = asyncio.run(graph.run("support", "I can't see my invoice"))
|
|
150
|
+
print(result.output)
|
|
151
|
+
|
|
152
|
+
# Inspect
|
|
153
|
+
print(graph.describe())
|
|
154
|
+
# {"metadata": {...}, "workflows": {"support": {"pattern_type": "Supervisor"}}}
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
## Validator — Static Analysis
|
|
158
|
+
|
|
159
|
+
```python
|
|
160
|
+
from pyagent_blueprint import BlueprintValidator, load_blueprint
|
|
161
|
+
|
|
162
|
+
spec = load_blueprint("blueprint.yaml")
|
|
163
|
+
validator = BlueprintValidator()
|
|
164
|
+
issues = validator.validate(spec)
|
|
165
|
+
|
|
166
|
+
for issue in issues:
|
|
167
|
+
print(f"[{issue.severity}] {issue.path}: {issue.message}")
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
**Checks performed:**
|
|
171
|
+
- Dangling agent refs (workflow references undefined agent)
|
|
172
|
+
- Dangling provider refs (agent references undefined provider)
|
|
173
|
+
- Unknown pattern names (not in pattern registry)
|
|
174
|
+
- Contract → workflow ref mismatch
|
|
175
|
+
- Unrealistic SLA values
|
|
176
|
+
- Security: hardcoded API keys in prompts
|
|
177
|
+
|
|
178
|
+
## Renderer — Mermaid + Markdown
|
|
179
|
+
|
|
180
|
+
```python
|
|
181
|
+
from pyagent_blueprint import BlueprintRenderer, load_blueprint
|
|
182
|
+
|
|
183
|
+
spec = load_blueprint("blueprint.yaml")
|
|
184
|
+
renderer = BlueprintRenderer()
|
|
185
|
+
|
|
186
|
+
# Mermaid diagram
|
|
187
|
+
print(renderer.to_mermaid(spec))
|
|
188
|
+
# graph TD
|
|
189
|
+
# classifier[Routes customer requests]
|
|
190
|
+
# billing[Billing specialist]
|
|
191
|
+
# tech[Technical support agent]
|
|
192
|
+
# classifier -->|billing| billing
|
|
193
|
+
# classifier -->|tech| tech
|
|
194
|
+
|
|
195
|
+
# Full Markdown documentation
|
|
196
|
+
md = renderer.to_markdown(spec)
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
## Differ — Semantic Diff
|
|
200
|
+
|
|
201
|
+
```python
|
|
202
|
+
from pyagent_blueprint import BlueprintDiffer, load_blueprint
|
|
203
|
+
|
|
204
|
+
old = load_blueprint("v1.yaml")
|
|
205
|
+
new = load_blueprint("v2.yaml")
|
|
206
|
+
|
|
207
|
+
differ = BlueprintDiffer()
|
|
208
|
+
changes = differ.diff(old, new)
|
|
209
|
+
|
|
210
|
+
print(differ.summary(changes))
|
|
211
|
+
# BREAKING (1):
|
|
212
|
+
# [modified] workflows.support.pattern
|
|
213
|
+
# WARNING (2):
|
|
214
|
+
# [modified] agents.billing.prompt
|
|
215
|
+
# [removed] agents.legacy
|
|
216
|
+
```
|
|
217
|
+
|
|
218
|
+
Severity levels:
|
|
219
|
+
- **BREAKING**: pattern changes, API version changes
|
|
220
|
+
- **WARNING**: prompt changes, provider changes, removals
|
|
221
|
+
- **INFO**: metadata, descriptions, additions
|
|
222
|
+
|
|
223
|
+
## Tester — Contract Conformance
|
|
224
|
+
|
|
225
|
+
```python
|
|
226
|
+
import asyncio
|
|
227
|
+
from pyagent_blueprint import BlueprintTester, load_blueprint
|
|
228
|
+
|
|
229
|
+
spec = load_blueprint("blueprint.yaml")
|
|
230
|
+
tester = BlueprintTester()
|
|
231
|
+
|
|
232
|
+
results = asyncio.run(tester.test(spec))
|
|
233
|
+
print(tester.summary(results))
|
|
234
|
+
# Contract Tests: 1/1 passed
|
|
235
|
+
# ✓ PASS support
|
|
236
|
+
# ✓ output_non_empty
|
|
237
|
+
# ✓ output_is_string
|
|
238
|
+
# ✓ input_within_token_limit
|
|
239
|
+
```
|
|
240
|
+
|
|
241
|
+
## Generator — Scaffold from Pattern
|
|
242
|
+
|
|
243
|
+
```python
|
|
244
|
+
from pyagent_blueprint import BlueprintGenerator
|
|
245
|
+
|
|
246
|
+
generator = BlueprintGenerator()
|
|
247
|
+
yaml_str = generator.generate(
|
|
248
|
+
pattern="supervisor",
|
|
249
|
+
agents=["classifier", "billing", "tech"],
|
|
250
|
+
name="customer-support",
|
|
251
|
+
)
|
|
252
|
+
print(yaml_str)
|
|
253
|
+
```
|
|
254
|
+
|
|
255
|
+
## CLI Reference
|
|
256
|
+
|
|
257
|
+
```bash
|
|
258
|
+
# Validate
|
|
259
|
+
pyagent-blueprint validate blueprint.yaml
|
|
260
|
+
|
|
261
|
+
# Compile and inspect
|
|
262
|
+
pyagent-blueprint compile blueprint.yaml
|
|
263
|
+
|
|
264
|
+
# Render Mermaid diagram
|
|
265
|
+
pyagent-blueprint render blueprint.yaml
|
|
266
|
+
pyagent-blueprint render blueprint.yaml --format markdown -o docs.md
|
|
267
|
+
|
|
268
|
+
# Run contract tests
|
|
269
|
+
pyagent-blueprint test blueprint.yaml
|
|
270
|
+
|
|
271
|
+
# Semantic diff
|
|
272
|
+
pyagent-blueprint diff v1.yaml v2.yaml
|
|
273
|
+
|
|
274
|
+
# Generate scaffold
|
|
275
|
+
pyagent-blueprint generate --pattern supervisor --agents "classifier,billing,tech" --name my-system
|
|
276
|
+
```
|
|
277
|
+
|
|
278
|
+
## Integration
|
|
279
|
+
|
|
280
|
+
Blueprint uses all pyagent packages:
|
|
281
|
+
- **pyagent-patterns**: Pattern registry for workflow compilation (18 patterns)
|
|
282
|
+
- **pyagent-router**: CostEstimator, DifficultyScorer for routing strategies
|
|
283
|
+
- **pyagent-providers**: ProviderRegistry for real provider resolution
|
|
284
|
+
- **pyagent-context**: ContextConfigSpec drives memory + compression setup
|
|
285
|
+
|
|
286
|
+
## Full Documentation
|
|
287
|
+
|
|
288
|
+
See [pyagent.dev](https://pyagent.dev) for full API reference and integration guides.
|
|
@@ -0,0 +1,255 @@
|
|
|
1
|
+
# pyagent-blueprint
|
|
2
|
+
|
|
3
|
+
**Declarative YAML specs for multi-agent LLM systems** — validate, compile, test, diff, render, and generate agent system blueprints.
|
|
4
|
+
|
|
5
|
+
[](../../LICENSE)
|
|
6
|
+
[](https://www.python.org/downloads/)
|
|
7
|
+
|
|
8
|
+
## Install
|
|
9
|
+
|
|
10
|
+
```bash
|
|
11
|
+
pip install pyagent-blueprint
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
Depends on: `pyagent-patterns`, `pyagent-router`, `pyagent-providers`, `pyagent-context`, `pydantic`, `pyyaml`, `click`.
|
|
15
|
+
|
|
16
|
+
## Why Blueprints?
|
|
17
|
+
|
|
18
|
+
Without blueprints, agent systems are defined in code — hard to version, diff, review, or test without running them. With `pyagent-blueprint`, your agent system is a **YAML document** that is:
|
|
19
|
+
- **Versioned**: semantic version + git-diffable
|
|
20
|
+
- **Validated**: Pydantic schema + static analysis (dangling refs, security)
|
|
21
|
+
- **Compiled**: YAML → executable RuntimeGraph in one call
|
|
22
|
+
- **Testable**: contract conformance tests with MockLLM
|
|
23
|
+
- **Renderable**: Mermaid diagrams + Markdown docs auto-generated
|
|
24
|
+
|
|
25
|
+
## Blueprint YAML Schema
|
|
26
|
+
|
|
27
|
+
```yaml
|
|
28
|
+
api_version: pyagent/v1
|
|
29
|
+
metadata:
|
|
30
|
+
name: customer-support
|
|
31
|
+
version: 1.0.0
|
|
32
|
+
description: Support routing system
|
|
33
|
+
owner: platform-team
|
|
34
|
+
|
|
35
|
+
providers:
|
|
36
|
+
primary:
|
|
37
|
+
model: gpt-4.1-mini
|
|
38
|
+
fallback:
|
|
39
|
+
model: gpt-4.1-nano
|
|
40
|
+
|
|
41
|
+
context:
|
|
42
|
+
memory:
|
|
43
|
+
working_max_tokens: 128000
|
|
44
|
+
compression:
|
|
45
|
+
policy: semantic_lossless
|
|
46
|
+
target_ratio: 0.6
|
|
47
|
+
|
|
48
|
+
agents:
|
|
49
|
+
classifier:
|
|
50
|
+
prompt: "Classify into: billing, tech, general"
|
|
51
|
+
provider: primary
|
|
52
|
+
billing:
|
|
53
|
+
prompt: "Handle billing inquiries"
|
|
54
|
+
provider: primary
|
|
55
|
+
guardrails: [pii_redact]
|
|
56
|
+
tech:
|
|
57
|
+
prompt: "Handle technical support"
|
|
58
|
+
provider: primary
|
|
59
|
+
|
|
60
|
+
workflows:
|
|
61
|
+
support:
|
|
62
|
+
pattern: supervisor
|
|
63
|
+
agents:
|
|
64
|
+
classifier: classifier
|
|
65
|
+
routes:
|
|
66
|
+
billing: billing
|
|
67
|
+
tech: tech
|
|
68
|
+
recovery:
|
|
69
|
+
max_retries: 2
|
|
70
|
+
timeout_seconds: 30
|
|
71
|
+
|
|
72
|
+
contracts:
|
|
73
|
+
support:
|
|
74
|
+
input:
|
|
75
|
+
type: string
|
|
76
|
+
max_tokens: 2000
|
|
77
|
+
output:
|
|
78
|
+
type: string
|
|
79
|
+
sla:
|
|
80
|
+
latency_p95_ms: 5000
|
|
81
|
+
cost_max_usd: 0.05
|
|
82
|
+
|
|
83
|
+
observability:
|
|
84
|
+
tracing:
|
|
85
|
+
enabled: true
|
|
86
|
+
cost_budget:
|
|
87
|
+
daily_usd: 100.0
|
|
88
|
+
alert_threshold: 0.8
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
## Loader — Load and Validate
|
|
92
|
+
|
|
93
|
+
```python
|
|
94
|
+
from pyagent_blueprint import load_blueprint, load_blueprint_from_str
|
|
95
|
+
|
|
96
|
+
# From file
|
|
97
|
+
spec = load_blueprint("blueprint.yaml") # YAML or JSON
|
|
98
|
+
print(spec.metadata.name) # "customer-support"
|
|
99
|
+
print(spec.agents.keys()) # dict_keys(['classifier', 'billing', 'tech'])
|
|
100
|
+
|
|
101
|
+
# From string
|
|
102
|
+
spec = load_blueprint_from_str(yaml_text)
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
## Compiler — Spec → RuntimeGraph
|
|
106
|
+
|
|
107
|
+
```python
|
|
108
|
+
import asyncio
|
|
109
|
+
from pyagent_blueprint import BlueprintCompiler, load_blueprint
|
|
110
|
+
|
|
111
|
+
spec = load_blueprint("blueprint.yaml")
|
|
112
|
+
compiler = BlueprintCompiler()
|
|
113
|
+
graph = compiler.compile(spec)
|
|
114
|
+
|
|
115
|
+
# Run a workflow
|
|
116
|
+
result = asyncio.run(graph.run("support", "I can't see my invoice"))
|
|
117
|
+
print(result.output)
|
|
118
|
+
|
|
119
|
+
# Inspect
|
|
120
|
+
print(graph.describe())
|
|
121
|
+
# {"metadata": {...}, "workflows": {"support": {"pattern_type": "Supervisor"}}}
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
## Validator — Static Analysis
|
|
125
|
+
|
|
126
|
+
```python
|
|
127
|
+
from pyagent_blueprint import BlueprintValidator, load_blueprint
|
|
128
|
+
|
|
129
|
+
spec = load_blueprint("blueprint.yaml")
|
|
130
|
+
validator = BlueprintValidator()
|
|
131
|
+
issues = validator.validate(spec)
|
|
132
|
+
|
|
133
|
+
for issue in issues:
|
|
134
|
+
print(f"[{issue.severity}] {issue.path}: {issue.message}")
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
**Checks performed:**
|
|
138
|
+
- Dangling agent refs (workflow references undefined agent)
|
|
139
|
+
- Dangling provider refs (agent references undefined provider)
|
|
140
|
+
- Unknown pattern names (not in pattern registry)
|
|
141
|
+
- Contract → workflow ref mismatch
|
|
142
|
+
- Unrealistic SLA values
|
|
143
|
+
- Security: hardcoded API keys in prompts
|
|
144
|
+
|
|
145
|
+
## Renderer — Mermaid + Markdown
|
|
146
|
+
|
|
147
|
+
```python
|
|
148
|
+
from pyagent_blueprint import BlueprintRenderer, load_blueprint
|
|
149
|
+
|
|
150
|
+
spec = load_blueprint("blueprint.yaml")
|
|
151
|
+
renderer = BlueprintRenderer()
|
|
152
|
+
|
|
153
|
+
# Mermaid diagram
|
|
154
|
+
print(renderer.to_mermaid(spec))
|
|
155
|
+
# graph TD
|
|
156
|
+
# classifier[Routes customer requests]
|
|
157
|
+
# billing[Billing specialist]
|
|
158
|
+
# tech[Technical support agent]
|
|
159
|
+
# classifier -->|billing| billing
|
|
160
|
+
# classifier -->|tech| tech
|
|
161
|
+
|
|
162
|
+
# Full Markdown documentation
|
|
163
|
+
md = renderer.to_markdown(spec)
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
## Differ — Semantic Diff
|
|
167
|
+
|
|
168
|
+
```python
|
|
169
|
+
from pyagent_blueprint import BlueprintDiffer, load_blueprint
|
|
170
|
+
|
|
171
|
+
old = load_blueprint("v1.yaml")
|
|
172
|
+
new = load_blueprint("v2.yaml")
|
|
173
|
+
|
|
174
|
+
differ = BlueprintDiffer()
|
|
175
|
+
changes = differ.diff(old, new)
|
|
176
|
+
|
|
177
|
+
print(differ.summary(changes))
|
|
178
|
+
# BREAKING (1):
|
|
179
|
+
# [modified] workflows.support.pattern
|
|
180
|
+
# WARNING (2):
|
|
181
|
+
# [modified] agents.billing.prompt
|
|
182
|
+
# [removed] agents.legacy
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
Severity levels:
|
|
186
|
+
- **BREAKING**: pattern changes, API version changes
|
|
187
|
+
- **WARNING**: prompt changes, provider changes, removals
|
|
188
|
+
- **INFO**: metadata, descriptions, additions
|
|
189
|
+
|
|
190
|
+
## Tester — Contract Conformance
|
|
191
|
+
|
|
192
|
+
```python
|
|
193
|
+
import asyncio
|
|
194
|
+
from pyagent_blueprint import BlueprintTester, load_blueprint
|
|
195
|
+
|
|
196
|
+
spec = load_blueprint("blueprint.yaml")
|
|
197
|
+
tester = BlueprintTester()
|
|
198
|
+
|
|
199
|
+
results = asyncio.run(tester.test(spec))
|
|
200
|
+
print(tester.summary(results))
|
|
201
|
+
# Contract Tests: 1/1 passed
|
|
202
|
+
# ✓ PASS support
|
|
203
|
+
# ✓ output_non_empty
|
|
204
|
+
# ✓ output_is_string
|
|
205
|
+
# ✓ input_within_token_limit
|
|
206
|
+
```
|
|
207
|
+
|
|
208
|
+
## Generator — Scaffold from Pattern
|
|
209
|
+
|
|
210
|
+
```python
|
|
211
|
+
from pyagent_blueprint import BlueprintGenerator
|
|
212
|
+
|
|
213
|
+
generator = BlueprintGenerator()
|
|
214
|
+
yaml_str = generator.generate(
|
|
215
|
+
pattern="supervisor",
|
|
216
|
+
agents=["classifier", "billing", "tech"],
|
|
217
|
+
name="customer-support",
|
|
218
|
+
)
|
|
219
|
+
print(yaml_str)
|
|
220
|
+
```
|
|
221
|
+
|
|
222
|
+
## CLI Reference
|
|
223
|
+
|
|
224
|
+
```bash
|
|
225
|
+
# Validate
|
|
226
|
+
pyagent-blueprint validate blueprint.yaml
|
|
227
|
+
|
|
228
|
+
# Compile and inspect
|
|
229
|
+
pyagent-blueprint compile blueprint.yaml
|
|
230
|
+
|
|
231
|
+
# Render Mermaid diagram
|
|
232
|
+
pyagent-blueprint render blueprint.yaml
|
|
233
|
+
pyagent-blueprint render blueprint.yaml --format markdown -o docs.md
|
|
234
|
+
|
|
235
|
+
# Run contract tests
|
|
236
|
+
pyagent-blueprint test blueprint.yaml
|
|
237
|
+
|
|
238
|
+
# Semantic diff
|
|
239
|
+
pyagent-blueprint diff v1.yaml v2.yaml
|
|
240
|
+
|
|
241
|
+
# Generate scaffold
|
|
242
|
+
pyagent-blueprint generate --pattern supervisor --agents "classifier,billing,tech" --name my-system
|
|
243
|
+
```
|
|
244
|
+
|
|
245
|
+
## Integration
|
|
246
|
+
|
|
247
|
+
Blueprint uses all pyagent packages:
|
|
248
|
+
- **pyagent-patterns**: Pattern registry for workflow compilation (18 patterns)
|
|
249
|
+
- **pyagent-router**: CostEstimator, DifficultyScorer for routing strategies
|
|
250
|
+
- **pyagent-providers**: ProviderRegistry for real provider resolution
|
|
251
|
+
- **pyagent-context**: ContextConfigSpec drives memory + compression setup
|
|
252
|
+
|
|
253
|
+
## Full Documentation
|
|
254
|
+
|
|
255
|
+
See [pyagent.dev](https://pyagent.dev) for full API reference and integration guides.
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["hatchling"]
|
|
3
|
+
build-backend = "hatchling.build"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "pyagent-blueprint"
|
|
7
|
+
version = "0.1.0"
|
|
8
|
+
description = "Declarative YAML specs for multi-agent LLM systems — validate, compile, test, diff, render"
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
requires-python = ">=3.11"
|
|
11
|
+
license = {text = "MIT"}
|
|
12
|
+
authors = [{name = "PyAgent Team", email = "team@pyagent.org"}]
|
|
13
|
+
keywords = ["agents", "blueprint", "YAML", "LLM", "declarative", "schema"]
|
|
14
|
+
classifiers = [
|
|
15
|
+
"Development Status :: 3 - Alpha",
|
|
16
|
+
"Intended Audience :: Developers",
|
|
17
|
+
"License :: OSI Approved :: MIT License",
|
|
18
|
+
"Programming Language :: Python :: 3.11",
|
|
19
|
+
"Programming Language :: Python :: 3.12",
|
|
20
|
+
"Programming Language :: Python :: 3.13",
|
|
21
|
+
"Topic :: Scientific/Engineering :: Artificial Intelligence",
|
|
22
|
+
"Typing :: Typed",
|
|
23
|
+
]
|
|
24
|
+
dependencies = [
|
|
25
|
+
"pyagent-patterns>=0.1.0",
|
|
26
|
+
"pyagent-router>=0.1.0",
|
|
27
|
+
"pyagent-providers>=0.1.0",
|
|
28
|
+
"pyagent-context>=0.1.0",
|
|
29
|
+
"pydantic>=2.7",
|
|
30
|
+
"pyyaml>=6.0",
|
|
31
|
+
"click>=8.1",
|
|
32
|
+
]
|
|
33
|
+
|
|
34
|
+
[project.urls]
|
|
35
|
+
Homepage = "https://pyagent.org"
|
|
36
|
+
Repository = "https://github.com/pyagent-core/pyagent"
|
|
37
|
+
Documentation = "https://pyagent.org"
|
|
38
|
+
|
|
39
|
+
[project.optional-dependencies]
|
|
40
|
+
dev = ["pytest>=8.0", "pytest-asyncio>=0.23", "ruff>=0.5", "mypy>=1.10"]
|
|
41
|
+
|
|
42
|
+
[project.scripts]
|
|
43
|
+
pyagent-blueprint = "pyagent_blueprint.cli:cli"
|
|
44
|
+
|
|
45
|
+
[tool.hatch.build.targets.wheel]
|
|
46
|
+
packages = ["src/pyagent_blueprint"]
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"""PyAgent Blueprint — declarative YAML specs for multi-agent LLM systems."""
|
|
2
|
+
|
|
3
|
+
from pyagent_blueprint.compiler import BlueprintCompiler, CompilationError
|
|
4
|
+
from pyagent_blueprint.differ import BlueprintDiffer, Change, ChangeSeverity, ChangeType
|
|
5
|
+
from pyagent_blueprint.generator import BlueprintGenerator
|
|
6
|
+
from pyagent_blueprint.loader import BlueprintLoadError, load_blueprint, load_blueprint_from_str
|
|
7
|
+
from pyagent_blueprint.renderer import BlueprintRenderer
|
|
8
|
+
from pyagent_blueprint.runtime import RuntimeGraph
|
|
9
|
+
from pyagent_blueprint.schema import (
|
|
10
|
+
AgentSpec,
|
|
11
|
+
BlueprintSpec,
|
|
12
|
+
ContractSpec,
|
|
13
|
+
ContextConfigSpec,
|
|
14
|
+
MetadataSpec,
|
|
15
|
+
ObservabilitySpec,
|
|
16
|
+
ProviderBindingSpec,
|
|
17
|
+
WorkflowSpec,
|
|
18
|
+
)
|
|
19
|
+
from pyagent_blueprint.tester import BlueprintTester, TestResult
|
|
20
|
+
from pyagent_blueprint.validator import BlueprintValidator, IssueSeverity, ValidationIssue
|
|
21
|
+
|
|
22
|
+
__all__ = [
|
|
23
|
+
"AgentSpec",
|
|
24
|
+
"BlueprintCompiler",
|
|
25
|
+
"BlueprintDiffer",
|
|
26
|
+
"BlueprintGenerator",
|
|
27
|
+
"BlueprintLoadError",
|
|
28
|
+
"BlueprintRenderer",
|
|
29
|
+
"BlueprintSpec",
|
|
30
|
+
"BlueprintTester",
|
|
31
|
+
"BlueprintValidator",
|
|
32
|
+
"Change",
|
|
33
|
+
"ChangeSeverity",
|
|
34
|
+
"ChangeType",
|
|
35
|
+
"CompilationError",
|
|
36
|
+
"ContractSpec",
|
|
37
|
+
"ContextConfigSpec",
|
|
38
|
+
"IssueSeverity",
|
|
39
|
+
"MetadataSpec",
|
|
40
|
+
"ObservabilitySpec",
|
|
41
|
+
"ProviderBindingSpec",
|
|
42
|
+
"RuntimeGraph",
|
|
43
|
+
"TestResult",
|
|
44
|
+
"ValidationIssue",
|
|
45
|
+
"WorkflowSpec",
|
|
46
|
+
"load_blueprint",
|
|
47
|
+
"load_blueprint_from_str",
|
|
48
|
+
]
|
|
49
|
+
__version__ = "0.1.0"
|