# Decision Points in AI Agent Development
# Temperature
🎯 The Hook
Are you using the same temperature for every task in your agent? Temperature isn't just a "creativity knob." In agent systems, structured outputs, tool calls, and user-facing responses each need fundamentally different temperature settings. Using one value for everything is leaving performance on the table.
📋 Overview
Temperature controls how "peaked" or "flat" the probability distribution is when an LLM selects its next token. Near 0, the highest-probability token wins almost every time, producing deterministic and stable output. Higher values flatten the distribution, allowing lower-probability tokens through, increasing diversity and creativity.
In AI agent systems, the optimal temperature varies dramatically across contexts: generating structured output, assembling tool call arguments, and producing free-form text each call for different settings. Temperature should be treated as a dynamic variable that shifts with task type, not a single fixed constant.
🔍 Decision Points
Temperature is primarily driven by task_variability -- how routine vs. creative the task is. The decision flow is straightforward 🧭
1. Structured output (JSON / function calling)? → 0.0-0.3
2. Accuracy-first (fact extraction, classification, summarization)? → 0.2-0.5
3. Dialogue, explanation, communication? → 0.5-0.7
4. Creative writing, brainstorming, candidate generation? → 0.7-1.0
Additionally, higher failure_cost pushes the temperature ceiling down, and high cost_sensitivity environments should account for retry cost increases from higher temperatures.
💡 Key Details
Reference values by task type 📊
- Structured output (JSON / function calling): 0.0-0.3. Minimizing schema violations is the priority
- Classification, extraction, data transformation: 0.0-0.2. Accuracy and reproducibility are paramount
- Summarization, explanation, customer support: 0.5-0.7. Balance naturalness with accuracy
- Creative writing, brainstorming, candidate generation: 0.7-1.0. Diversity is the source of value
- Tool argument generation: 0.0-0.2. Precise function and argument names are non-negotiable
- Planning and reasoning: 0.3-0.6. Some exploration helps, but maintain logical consistency
Start structured output temperature at 0. If schema violations occur at 0, the problem is your prompt or schema -- never rely on higher temperature to "accidentally" produce correct output 🚫
⚖️ Trade-offs
Too low and conversations become robotic 🤖 The model returns identical answers to identical questions, giving users a "template response" impression. Best-of-N sampling also breaks down -- candidates become near-identical, costing N times more for essentially N=1 results.
Too high and structured outputs start breaking 💥 JSON field names drift, types mismatch, hallucinations increase -- especially dangerous for proper nouns, numbers, and dates. Tool call instability and loss of reproducibility compound the problem.
Monitor the retry cost impact of temperature changes. If schema violation rates exceed roughly 5%, consider lowering the temperature.
🛠️ Use Cases
Vary temperature by pathway within a single agent 🔀 Planning steps at 0.3-0.5, tool argument generation at 0.0-0.2, user-facing responses at 0.5-0.7. When switching models, adjust temperature simultaneously for a natural fit.
Using Best-of-N? You need to raise the temperature. Generating N=5 candidates at temperature 0 produces 5 near-identical outputs. For N>1, set temperature to 0.5-0.8 and let a Judge select the best from diverse candidates.
Be careful combining temperature with top_p ⚠️ Adjusting both simultaneously creates multiplicative effects with unpredictable behavior. As a rule, tune one and leave the other at its default.
#
AIAgents# #
SoftwareArchitecture#