Opt Speed¶
opt_speed — mvp.opt_speed
Cluster: Uncategorised | Type: component | MCP Tools: 7
Overview¶
Latency bottleneck detection and speed intervention recommendations. Analyzes workflow traces to identify slow steps and recommends parallelization, caching, context window reduction, and batching interventions.
Example:
from mvp.opt_speed import OptSpeedBlock, OptSpeedInput
block = OptSpeedBlock()
result = block.infer(OptSpeedInput(
op="analyze",
trace={
"trace_id": "trace-1",
"workflow_name": "demo_pipeline",
"timestamp": "2026-05-21T00:00:00Z",
"steps": [
{"step_index": 0, "component_name": "llm_router",
"operation": "infer", "confidence": 0.95, "latency_ms": 4200.0},
],
},
))
# result.value -> OptSpeedOutput with detected latency bottlenecks
Public API¶
OptSpeedInput(BaseModel)¶
| Field | Type | Default |
|---|---|---|
op | Literal['analyze', 'recommend', 'analyze_and_recommend', 'estimate_impact', 'list_patterns', 'capabilities', 'ops', 'help'] | 'analyze_and_recommend' |
trace | dict \| None | None |
bottlenecks | list[dict] \| None | None |
interventions | list[dict] \| None | None |
upstream_degraded | bool | False |
upstream_degradation_reason | str \| None | None |
request_id | str \| None | None |
task_id | str \| None | None |
run_id | str \| None | None |
OptSpeedOutput(BaseModel)¶
| Field | Type | Default |
|---|---|---|
op | str | required |
report | dict \| None | None |
estimated_impacts | list[dict] \| None | None |
success | bool | True |
error | str | '' |
degraded | bool | False |
degradation_reason | str \| None | None |
completion_state | Literal['verified', 'qualified-draft', 'blocked-escalated'] | 'qualified-draft' |
warning_card | dict[str, Any] \| None | None |
evidence | dict[str, Any] | Field(default_factory=dict) |
request_id | str \| None | None |
task_id | str \| None | None |
run_id | str \| None | None |
OptSpeedBlock(AIBlock[OptSpeedInput, OptSpeedOutput, dict])¶
Latency-focused optimisation block.
| Field | Type | Default |
|---|---|---|
name | str | 'opt_speed' |
resource_bounds | ResourceBounds \| None | None |
usage | ResourceUsage | field(default_factory=ResourceUsage) |
state | dict \| None | field(default_factory=dict) |
Methods:
infer(data: OptSpeedInput) -> Result[OptSpeedOutput]¶
MCP Tools¶
| Operation | Source |
|---|---|
ops | opt_speed_mcp |
help | opt_speed_mcp |
analyze_speed | opt_speed_mcp |
analyze_and_recommend_speed | opt_speed_mcp |
estimate_speed_impact | opt_speed_mcp |
list_speed_patterns | opt_speed_mcp |
speed_capabilities | opt_speed_mcp |
Production caveat¶
opt_speed is an analysis and recommendation component. It identifies likely latency bottlenecks and estimates the potential impact of proposed changes, but it does not apply changes by itself and does not guarantee that a workflow will become faster in production. Treat its output as optimisation guidance to validate with before/after measurements on the target workflow, especially before making customer-facing claims.
Operations¶
| Op | Description |
|---|---|
analyze | Detect latency bottlenecks in a workflow trace |
recommend | Generate speed interventions for given bottlenecks |
analyze_and_recommend | Combined analysis and recommendation in one call |
estimate_impact | Estimate latency impact of proposed interventions |
capabilities | Inspect analyzers, severity thresholds, dispatch rows, degradation conditions, and maturity |
help / ops | List supported operations |
MCP Tool Surface¶
Direct MCP access is available through opt_speed_mcp with read-only tools: analyze_speed, analyze_and_recommend_speed, estimate_speed_impact, list_speed_patterns, and speed_capabilities. The MCP wrapper preserves degraded state, canonical envelope fields, and caller IDs.
Gateway Tool¶
This component powers the speed axis of the optimization_report gateway tool (Premium tier). optimization_report is read-only and returns recommendations; use the broader optimisation flow plus validation evidence before applying or claiming real-world speedups.
See also¶
- opt_cost -- cost axis
- opt_quality -- quality axis
- opt_meta -- Pareto coordinator
- Self-Optimisation cluster