pyagent-studio API Reference¶
pyagent_studio
¶
PyAgent Studio — Kubernetes Dashboard for Agent Systems.
BlueprintService
¶
Headless service for loading, validating, and compiling blueprints.
Wraps pyagent-blueprint for use by TUI screens and tests.
Source code in packages/pyagent-studio/src/pyagent_studio/services/blueprint_service.py
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 | |
load(path)
¶
Load a blueprint from file.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
str | Path
|
Path to YAML/JSON blueprint. |
required |
Returns:
| Type | Description |
|---|---|
BlueprintSpec
|
Validated |
Raises:
| Type | Description |
|---|---|
BlueprintLoadError
|
On load/validation failure. |
Source code in packages/pyagent-studio/src/pyagent_studio/services/blueprint_service.py
validate()
¶
Run static validation on the loaded spec.
Returns:
| Type | Description |
|---|---|
list[ValidationIssue]
|
List of validation issues. |
Raises:
| Type | Description |
|---|---|
RuntimeError
|
If no spec loaded. |
Source code in packages/pyagent-studio/src/pyagent_studio/services/blueprint_service.py
compile()
¶
Compile the loaded spec into a RuntimeGraph.
Returns:
| Type | Description |
|---|---|
RuntimeGraph
|
Executable |
Raises:
| Type | Description |
|---|---|
RuntimeError
|
If no spec loaded. |
Source code in packages/pyagent-studio/src/pyagent_studio/services/blueprint_service.py
discover_blueprints(directory='.')
¶
Find all YAML/JSON blueprint files in a directory.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
directory
|
str | Path
|
Root directory to search. |
'.'
|
Returns:
| Type | Description |
|---|---|
list[Path]
|
List of file paths. |
Source code in packages/pyagent-studio/src/pyagent_studio/services/blueprint_service.py
summary()
¶
Quick summary of loaded blueprint.
Source code in packages/pyagent-studio/src/pyagent_studio/services/blueprint_service.py
GovernanceService
¶
Run governance checks on blueprints.
Combines validation, compliance scoring, and diffing.
Source code in packages/pyagent-studio/src/pyagent_studio/services/governance_service.py
check_compliance(spec)
¶
Run all validation checks and compute compliance score.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
spec
|
BlueprintSpec
|
Blueprint to check. |
required |
Returns:
| Type | Description |
|---|---|
ComplianceReport
|
|
Source code in packages/pyagent-studio/src/pyagent_studio/services/governance_service.py
diff(old, new)
¶
Compute semantic diff between two specs.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
old
|
BlueprintSpec
|
Previous version. |
required |
new
|
BlueprintSpec
|
Updated version. |
required |
Returns:
| Type | Description |
|---|---|
list[Change]
|
List of |
Source code in packages/pyagent-studio/src/pyagent_studio/services/governance_service.py
diff_summary(old, new)
¶
Human-readable diff summary.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
old
|
BlueprintSpec
|
Previous version. |
required |
new
|
BlueprintSpec
|
Updated version. |
required |
Returns:
| Type | Description |
|---|---|
str
|
Summary string. |
Source code in packages/pyagent-studio/src/pyagent_studio/services/governance_service.py
format_report(report)
¶
Format a compliance report as text.
Source code in packages/pyagent-studio/src/pyagent_studio/services/governance_service.py
SimulationService
¶
Run simulations against compiled blueprints.
Uses MockLLM by default so no API keys are needed.
Source code in packages/pyagent-studio/src/pyagent_studio/services/simulation_service.py
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 | |
run(spec, workflow, task, use_live=None)
async
¶
Run a single simulation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
spec
|
BlueprintSpec
|
Blueprint spec. |
required |
workflow
|
str
|
Workflow name to run. |
required |
task
|
str
|
Input task string. |
required |
Returns:
| Type | Description |
|---|---|
SimulationResult
|
|
Source code in packages/pyagent-studio/src/pyagent_studio/services/simulation_service.py
run_all(spec, tasks, use_live=None)
async
¶
Run simulations for multiple workflows.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
spec
|
BlueprintSpec
|
Blueprint spec. |
required |
tasks
|
dict[str, str]
|
Mapping of workflow name → task string. |
required |
Returns:
| Type | Description |
|---|---|
list[SimulationResult]
|
List of simulation results. |
Source code in packages/pyagent-studio/src/pyagent_studio/services/simulation_service.py
TraceService
¶
Load and query trace JSONL files from pyagent-trace Recorder.
Each line in a JSONL file is a JSON object representing a trace event.
Source code in packages/pyagent-studio/src/pyagent_studio/services/trace_service.py
load(path)
¶
Load spans from a JSONL file.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
str | Path
|
Path to |
required |
Returns:
| Type | Description |
|---|---|
list[TraceSpan]
|
List of parsed |
Raises:
| Type | Description |
|---|---|
FileNotFoundError
|
If file doesn't exist. |
Source code in packages/pyagent-studio/src/pyagent_studio/services/trace_service.py
query(event_type=None, agent_name=None)
¶
Filter loaded spans.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
event_type
|
str | None
|
Filter by event type. |
None
|
agent_name
|
str | None
|
Filter by agent name. |
None
|
Returns:
| Type | Description |
|---|---|
list[TraceSpan]
|
Filtered list of spans. |
Source code in packages/pyagent-studio/src/pyagent_studio/services/trace_service.py
summary()
¶
Summary statistics for loaded traces.