optimize_flow
Analyze a flow for performance and cost optimization opportunities. Returns rule-based suggestions such as moving upscale nodes to the end of the flow, avoiding resolution overflow, removing redundant processing, and choosing better-performing models. Each suggestion carries a structured patch (move_node, insert_node, replace_model) describing the change. Apply them with edit_flow on the same flow — replace_model maps to its replace_model op, insert_node to add_node plus the connect/disconnect that splice it in. move_node is layout only and needs no edit. Applying a suggestion never requires creating a new flow. update_flow changes node parameters only. Use this before running a flow or while iterating on its design. Set include_llm_analysis=true to also ask Haiku for complex-pattern refinements.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"flow_id": "<flow_id>"
},
"name": "optimize_flow"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| flow_id | Yes | The unique identifier of the flow to analyze. | |
| language | No | Response language: 'en' (default) or 'ko'. | |
| include_llm_analysis | No | If true, supplement rule-engine findings with Haiku LLM analysis. Defaults to false (rule-engine only, ~50ms). Adds ~0.5–1s latency when enabled. |