Workflows Optimize Credits

作者 clay-run769514a3a236無授權條款130 個星標收錄於 2026年10月8日更新於 2026年10月8日儲存庫今天更新

Clay workflows — reduce a workflow's credit and LLM cost via the CLI (`clay workflows` commands). Identifies expensive patterns and suggests cheaper alternatives.

AI 產生的概覽

分析 Clay 工作流,找出點數與 LLM 成本來源,並建議更省錢的替代做法。

功能
此技能引導代理透過 Clay CLI 檢視 Clay 工作流,找出成本來源,例如 LLM 呼叫、Clay 動作點數、模型選擇、映射節點效率與條件路由,並依影響與風險列出最佳化機會。取得授權後,它也能修改工作流節點,並重新繪製更新後的圖,讓前後差異一目了然。產出為最佳化機會分析,以及獲授權時修改後的工作流節點。
適用情境
當某個 Clay 工作流耗用過多點數或 LLM 費用,且需要具體、依優先順序排列的縮減方案時使用。也適合用來檢視工作流的成本概況,或對現有工作流套用安全的成本最佳化。
執行需求
需要可用的 Clay CLI 與 clay workflows 指令(graph get、diagram、nodes update/create/delete、graph format、actions list),以及有效的 Clay 工作流 ID;未隨附任何指令碼。

Reducing workflow credit & LLM cost

Analyze the current workflow and suggest changes to reduce credit consumption and LLM costs without sacrificing quality.

Process

  1. Read the workflow using clay workflows graph get <workflowId> --mode full to get all node details
  2. Identify cost drivers — LLM calls, Clay action usage, model selection
  3. Present optimization opportunities with estimated impact, alongside a render of the current graph (clay workflows diagram <workflowId>) with the expensive nodes called out so the user can see where the cost lives
  4. Apply authorized changes — edit the workflow only when the user's request authorizes modifications, via clay workflows nodes update/create/delete. Once authorized, apply clearly safe optimizations as you go and ask before changes with a material quality or behavior trade-off
  5. Show the result — after applying, run clay workflows graph format <workflowId> and render the updated graph so the change is visible

Narrate throughout and prefer the diagram over raw node JSON — see the workflows skill's presenting.md.

Cost Drivers in Clay Workflows

LLM Calls (biggest cost driver)

Every regular (LLM) node makes at least one LLM call per execution. More capable models cost more.

Optimizations:

  • Replace with code nodes: If a node does deterministic work (data transformation, filtering, formatting), replace it with a code node — zero LLM cost
  • Use cheaper models: Simple tasks (parameter extraction, basic classification) can use smaller/faster models. Reserve powerful models for complex reasoning
  • Merge nodes: Two sequential LLM nodes doing related work can often be one node with a combined prompt — cuts LLM calls in half
  • Pre-map action parameters: When a node calls a Clay action, configure static or reference input mappings (inputMappingConfig, see the workflows skill's data-passing.md) for parameters that don't need LLM inference. If ALL parameters are pre-mapped, the LLM parameter mapping call is skipped entirely

Clay Action Credits

Each Clay action execution consumes credits based on the action's pricing tier.

Optimizations:

  • Avoid redundant enrichments: If the same data was already fetched in an earlier node, reference it via a pinned input (sourceNodeId/sourcePath) instead of calling the action again
  • Use conditional routing: Skip expensive enrichments for items that don't need them (e.g., skip company research for companies you already have data on)
  • Choose cheaper alternatives: Some actions have cheaper equivalents. Use clay workflows actions list (see /workflows-discover-actions) to compare options and their priority tier

Model Selection

Different models have different cost/capability profiles.

Optimizations:

  • Match model to task complexity:
    • Simple extraction/classification → use a smaller, faster model
    • Complex reasoning, multi-step analysis → use a more capable model
    • Creative writing, nuanced decisions → use the most capable model
  • Downgrade where safe: Review each regular node's prompt. If the task is straightforward, try a cheaper model

Map Node Efficiency

Map nodes multiply costs by the number of items processed.

Optimizations:

  • Code mode over agent mode: If map processing is deterministic, use code mode (zero LLM cost per item)
  • Filter before mapping: Add a code node before the map to filter out items that don't need processing
  • Reduce chunk size: Smaller chunks mean less wasted work if a chunk fails
  • Use reduce to aggregate: Instead of processing all items individually and collecting, use reduce to aggregate by key — fewer downstream processing steps

Conditional Routing

Use conditional nodes to skip expensive branches for items that don't need them.

Example:

Instead of:  [All items] → [Expensive enrichment] → [Process]Do this:     [All items] → [Conditional: has data?] → Yes → [Process]                                                    → No  → [Enrichment] → [Process]

Analysis Output Format

For each optimization opportunity, present:

  1. Node(s) affected — which nodes to change
  2. Current cost pattern — what's expensive and why
  3. Suggested change — specific modification
  4. Estimated impact — qualitative (high/medium/low) cost reduction
  5. Risk — any quality trade-offs

Prioritize suggestions by impact (highest savings first). Pair the list with the current-graph render, with the expensive nodes called out, so each is easy to locate.

For analysis or recommendation requests, present the opportunities without editing. If the user asks you to modify the workflow, apply clearly safe savings as you identify them and state your assumptions. Ask only when an optimization has a meaningful quality, cost, or behavior trade-off. Then validate with clay workflows graph format <workflowId> and show the updated graph so the user can see the before/after difference.

來源與署名

來源:clay-run/agent-plugins位於clay/skills/workflows-optimize-credits提交769514a

授權條款: 無授權條款

內容歸原作者所有。SourceWeft 從公開儲存庫中收錄這些內容。

檢舉或申請下架