Module 7: Tools & APIs•Lesson 2 of 5
The Rule of Thumb
The Rule of Thumb
Needs precision → Use a tool Needs thinking → Use the agent
This simple rule will save you endless debugging.
When to Use Tools
✅ Precise Data Retrieval
- Current time/date
- Weather
- Stock prices
- API responses
Tools give exact answers. Agents might hallucinate.
✅ Deterministic Operations
- File read/write
- Command execution
- HTTP requests
- Database queries
Same input → Same output. No reasoning needed.
✅ Real-World Actions
- Sending messages
- Creating files
- Deploying code
- Controlling devices
The agent can't wish things into existence. Tools do the doing.
When to Use the Agent
✅ Interpretation
- Understanding user intent
- Parsing ambiguous requests
- Context-dependent decisions
✅ Synthesis
- Combining multiple pieces of information
- Writing summaries
- Making recommendations
✅ Creativity
- Generating content
- Brainstorming
- Problem-solving
Common Mistakes
❌ Asking the agent for current data
Bad: "What's the current Bitcoin price?"
Agent: "As of my last update, Bitcoin is around $40,000..."
(Likely wrong!)
Good: Use web_search or API tool
Tool returns: "$95,432.17"
Agent: "Bitcoin is currently $95,432.17"❌ Using tools for opinions
Bad: web_search("should I use React or Vue")
(Gets random opinions, not useful)
Good: Let agent reason
Agent: "Based on your use case (X), I'd recommend Y because..."❌ Chaining unnecessary tools
Bad:
1. web_search("what is Python")
2. web_search("Python syntax")
3. web_search("Python examples")
Good:
Agent already knows Python. Just ask.Decision Framework
| Question | Yes → | No → |
|---|---|---|
| Need current/real data? | Tool | Agent |
| Need exact precision? | Tool | Agent |
| Affects real world? | Tool | Agent |
| Needs reasoning? | Agent | Tool |
| Needs creativity? | Agent | Tool |
| Needs interpretation? | Agent | Tool |
The Hybrid Approach
Often you need both:
- Tool gets the data
- Agent interprets it
- Tool takes action
- Agent confirms
Example:
1. web_search("competitor pricing") → Raw data
2. Agent analyzes and compares → Insights
3. write("analysis.md", content) → Saves result
4. Agent summarizes for human → Final output