Agent Parameters
Configure temperature, tokens, and other model parameters to fine-tune your AI agent's behavior.
Overview
Agent parameters control how your AI model generates responses. Understanding these settings helps you balance creativity, accuracy, and cost for your specific use case.
Core Parameters
Temperature
Temperature controls the randomness of the model's output.
| Value | Behavior | Best For |
|---|---|---|
| 0.0 | Deterministic, consistent | Factual Q&A, code generation, data extraction |
| 0.3-0.5 | Balanced, some variation | Customer support, general assistance |
| 0.7-0.9 | Creative, diverse | Brainstorming, creative writing |
| 1.0+ | Highly random | Experimental, very creative tasks |
Example Configuration:
json{ "temperature": 0.3, "use_case": "customer_support" }
Max Tokens
Maximum tokens limits the response length. One token is approximately 4 characters or 0.75 words.
| Setting | Tokens | Approximate Words |
|---|---|---|
| Short | 256 | ~190 words |
| Medium | 512 | ~380 words |
| Long | 1024 | ~770 words |
| Extended | 2048 | ~1,500 words |
| Maximum | 4096+ | ~3,000+ words |
Considerations:
- Higher limits increase response time and cost
- Set based on expected response needs
- Leave headroom for complete answers
Top P (Nucleus Sampling)
Top P controls diversity by limiting token selection to a probability mass.
| Value | Effect |
|---|---|
| 0.1 | Very focused, uses only most likely tokens |
| 0.5 | Moderate diversity |
| 0.9 | High diversity, considers more options |
| 1.0 | No filtering, all tokens considered |
Best Practice: Use either temperature OR top_p, not both. If using top_p, set temperature to 1.0.
Frequency Penalty
Reduces repetition by penalizing tokens based on how often they appear.
| Value | Effect |
|---|---|
| 0.0 | No penalty (default) |
| 0.5 | Moderate reduction in repetition |
| 1.0 | Strong reduction in repetition |
| 2.0 | Maximum penalty |
Presence Penalty
Encourages discussing new topics by penalizing tokens that have appeared at all.
| Value | Effect |
|---|---|
| 0.0 | No penalty (default) |
| 0.5 | Encourages new topics |
| 1.0 | Strongly encourages new topics |
| 2.0 | Maximum diversity |
Model-Specific Parameters
OpenAI (GPT-4, GPT-3.5)
json{ "model": "gpt-4-turbo", "temperature": 0.7, "max_tokens": 1024, "top_p": 1.0, "frequency_penalty": 0.0, "presence_penalty": 0.0, "stop": ["\n\n", "END"] }
Anthropic (Claude)
json{ "model": "claude-3-5-sonnet", "temperature": 0.7, "max_tokens": 1024, "top_p": 0.9, "top_k": 40 }
Claude-specific:
top_k: Limits to top K most likely tokens (default: 40)
Google (Gemini)
json{ "model": "gemini-pro", "temperature": 0.7, "max_output_tokens": 1024, "top_p": 0.9, "top_k": 40 }
Local Models (Ollama)
json{ "model": "llama3:70b", "temperature": 0.7, "num_predict": 1024, "top_p": 0.9, "top_k": 40, "repeat_penalty": 1.1 }
Ollama-specific:
num_predict: Equivalent to max_tokensrepeat_penalty: Controls repetition (default: 1.1)
Parameter Presets
Arcanflows provides presets for common use cases:
Precise (Factual/Code)
json{ "temperature": 0.1, "max_tokens": 2048, "top_p": 0.95, "frequency_penalty": 0.0, "presence_penalty": 0.0 }
Balanced (General)
json{ "temperature": 0.5, "max_tokens": 1024, "top_p": 1.0, "frequency_penalty": 0.3, "presence_penalty": 0.3 }
Creative (Writing/Brainstorming)
json{ "temperature": 0.9, "max_tokens": 2048, "top_p": 0.95, "frequency_penalty": 0.5, "presence_penalty": 0.5 }
Use Case Recommendations
| Use Case | Temp | Max Tokens | Top P | Notes |
|---|---|---|---|---|
| Customer Support | 0.3 | 512 | 1.0 | Consistent, helpful |
| Code Generation | 0.1 | 2048 | 0.95 | Deterministic |
| Creative Writing | 0.9 | 2048 | 0.95 | High variety |
| Data Extraction | 0.0 | 512 | 1.0 | Exact results |
| Research Summary | 0.5 | 1024 | 1.0 | Balanced |
| Brainstorming | 1.0 | 1024 | 0.9 | Maximum creativity |
Configuring Parameters in Arcanflows
Via UI
- Go to Agents → Select your agent
- Click Settings → Model Configuration
- Adjust parameters using sliders or input fields
- Click Save
Via API
bashcurl -X PATCH "https://api.arcanflows.com/api/v1/agents/{agent_id}" \ -H "X-API-Key: your_api_key" \ -H "Content-Type: application/json" \ -d '{ "model_config": { "temperature": 0.5, "max_tokens": 1024, "top_p": 1.0 } }'
Testing Parameters
A/B Testing
Compare different parameter configurations:
- Create agent variants with different settings
- Route traffic to each variant
- Measure response quality and user satisfaction
- Select optimal configuration
Evaluation Metrics
- Response quality: Manual review or automated scoring
- Response time: Latency measurements
- Cost: Token usage tracking
- User satisfaction: Feedback and ratings
Best Practices
- Start conservative: Begin with low temperature (0.3-0.5), adjust up if needed
- Match use case: Factual tasks need low temperature, creative tasks need higher
- Monitor costs: Higher max_tokens increases API costs
- Test thoroughly: Different prompts may need different settings
- Document choices: Record why specific settings were chosen
- Review regularly: Revisit settings as use cases evolve
Troubleshooting
Responses too repetitive
- Increase
frequency_penalty(0.3-0.7) - Increase
presence_penalty(0.3-0.7) - Slightly increase
temperature
Responses too random/off-topic
- Decrease
temperature(0.1-0.3) - Decrease
top_p(0.8-0.95) - Improve system prompt with constraints
Responses cut off
- Increase
max_tokens - Instruct model to be concise in system prompt
Slow responses
- Decrease
max_tokens - Use faster model variant
- Optimize system prompt length