Overview
This example demonstrates how Atlas SDK enables agents to learn efficient tool usage patterns. Using the Model Context Protocol (MCP) to provide filesystem tools to a LangGraph agent, the example shows measurable improvement across 25 progressive tasks: 30-40% fewer tool calls and 95%+ completion rates by task 25. What you’ll see:- MCP server with 5 file operation tools
- LangGraph agent integration
- Progressive learning (simple → complex tasks)
- Measurable efficiency gains
- Total cost: $0.10-0.20 for complete 25-run session
Architecture
read_file- Read file contentswrite_file- Write/create fileslist_files- List directory contentssearch_content- Regex search in filesrun_command- Safe shell commands (ls, grep, wc)
Quick Start
Prerequisites
Run Complete Learning Session
- Phase 1 (tasks 1-5): Basic file operations
- Phase 2 (tasks 6-10): Multi-step operations
- Phase 3 (tasks 11-15): Complex workflows
- Phase 4 (tasks 16-20): Advanced scenarios
- Phase 5 (tasks 21-25): Edge cases and error handling
Run Single Task
Learning Objectives
The agent learns to:- Minimize redundant operations - Cache file lists instead of listing repeatedly
- Optimize tool selection - Choose search vs read based on task requirements
- Handle errors gracefully - Recover from missing files and invalid operations
- Plan efficiently - Break complex tasks into minimal step sequences
- Build context awareness - Understand when list → read → write sequence is optimal
Measured Results
Early Runs (Tasks 1-5)
- Tool calls per task: 8-12 (trial and error)
- Reward scores: 0.6-0.7
- Occasional incorrect tool selection
Later Runs (Tasks 15-25)
- Tool calls per task: 4-6 (optimized)
- Reward scores: 0.8-0.9
- Consistent correct tool selection
- Proactive error handling
- Tool call reduction: 30-40%
- Completion rate: 95%+ by task 25
- Reward progression: +0.2-0.3 average increase
Configuration
The example uses a Python adapter to integrate the LangGraph agent:Viewing Learning Progress
Check Learning Playbook
- Tool usage patterns over time
- Reward progression
- Common failure modes
- Synthesized best practices
Export Session Traces
Query Database Directly
Customization
Add Domain-Specific Tools
Modifymcp_server.py to add tools for your use case:
Adjust Learning Tasks
EditLEARNING_TASKS in learning_harness.py:
Tune Reward Signals
Updatejudge_prompt in config.yaml to reward domain-specific behaviors:
Troubleshooting
| Issue | Solution |
|---|---|
| MCP server connection errors | Verify server_path in mcp_agent.py points to correct file |
| Async event loop errors | Run with python learning_harness.py (not python -i) |
| API rate limits | Increase sleep duration between tasks in learning_harness.py |
| High costs | Use GPT-4o-mini for both student and teacher; reduce task count |
| Postgres connection refused | Start Postgres with atlas init or verify DATABASE_URL in .env |
| No learning improvement seen | Ensure storage is enabled and check reward scores in database |
| Tool calls not reducing | Verify learning.enabled=true in config and check playbook entries |
Next Steps
Custom Adapters
Connect your own agent framework
Configuration Guide
Tune orchestration and learning parameters
Export Training Data
Use runtime traces for offline training
Learning System
Understand persistent memory and playbooks