Intermediate 25 min

🎉 Congratulations!

You’ve completed the “Build a Plan-and-Execute Agent with Tool Calling + an Approval Gate” tutorial!

What You Accomplished

Built a complete agent - Created a plan-and-execute agent from scratch

Implemented tool calling - Added 4 tools with proper schemas

Added safety controls - Approval gates, budgets, and dry-run mode

Mastered the agent loop - Understand how agents plan, act, and observe

Learned debugging - JSONL logging, replay, and troubleshooting

Production patterns - Controls that scale to real systems

Your Agent Can Now

You built an agent that can:

  • 📝 Plan multi-step tasks - Breaks down goals into actionable steps
  • 🔧 Call tools - Reads files, writes output, sends messages
  • Ask for approval - Human-in-the-loop for risky operations
  • 💰 Stay within budget - Limits tool calls to prevent runaway costs
  • 🧪 Run in dry-run mode - Test safely without side effects
  • 📊 Track everything - Logs all actions for debugging

Key Skills You Gained

  1. Agent Architecture - Plan-and-execute pattern
  2. Tool Calling - JSON schemas and function dispatch
  3. State Management - Conversation history across iterations
  4. Safety Controls - Budgets, approval gates, dry-run
  5. Debugging - Logging, tracing, and replay
  6. Production Thinking - Scaling patterns and best practices

What’s Next?

Extend Your Agent

Add More Tools:

  • search_notes(keyword) - Search for keywords in files
  • extract_todos(text) - Find TODO items
  • summarize_text(text, max_words) - Summarize content
  • send_email(to, subject, body) - Real email integration

Add Policy Engine:

  • Automated approval based on rules
  • Secret detection (API keys, passwords)
  • Rate limiting per user
  • Audit logging for compliance

Add Memory:

  • Store conversation history in database
  • Remember user preferences
  • Learn from past interactions
  • Vector database for semantic search

Multi-Agent Systems:

  • Specialized agents for different tasks
  • Agent delegation and handoffs
  • Consensus mechanisms
  • Parallel execution

Practice Projects

  1. Code Review Agent - Reads code, suggests improvements, creates PRs
  2. Data Analysis Agent - Reads CSVs, generates insights, creates charts
  3. DevOps Agent - Monitors logs, detects issues, suggests fixes
  4. Research Agent - Searches papers, summarizes findings, creates reports

Move to Production

Architecture:

  • Convert CLI to API service
  • Add authentication and authorization
  • Support multiple concurrent users
  • Use async/await for performance

Integrations:

  • Replace mocked tools with real APIs
  • Add Slack/Discord integration
  • Connect to databases
  • Integrate with CI/CD pipelines

Monitoring:

  • Track success/failure rates
  • Monitor costs per user/session
  • Alert on anomalies
  • Measure latency and throughput

Scaling:

  • Use message queues for async processing
  • Add load balancing
  • Implement circuit breakers
  • Cache model responses

Resources

OpenAI Documentation

Frameworks

  • LangChain - Agent framework with many integrations
  • LangGraph - Graph-based agent orchestration
  • AutoGPT - Autonomous agent examples
  • CrewAI - Multi-agent collaboration

Papers & Research

  • “ReAct: Synergizing Reasoning and Acting in Language Models”
  • “Toolformer: Language Models Can Teach Themselves to Use Tools”
  • “Chain-of-Thought Prompting Elicits Reasoning in Large Language Models”
  • “Reflexion: Language Agents with Verbal Reinforcement Learning”

Communities

Your Code Repository

The complete working code is available in the GitHub repository:

git clone https://github.com/appropri8/plan-execute-agent-tutorial.git
cd plan-execute-agent-tutorial

Or check it out in the githubRepo/plan-execute-agent-tool-calling/ directory.

Key Takeaways

Remember these core concepts:

  1. Agents are loops - They plan, act, observe, and repeat
  2. Tool calling is the foundation - Model proposes, code executes
  3. State matters - Conversation history enables informed decisions
  4. Safety is essential - Approval gates, budgets, and monitoring
  5. Plan-and-execute works - Having a plan makes agents reliable

Share Your Work

  • Build something with your agent
  • Share your project on GitHub
  • Write about what you learned
  • Help others get started with agents

Advanced Topics to Explore

Evaluation:

  • Automated testing of agent behavior
  • Benchmark suites for common tasks
  • A/B testing different prompts
  • Success metrics and KPIs

Optimization:

  • Reduce API calls with caching
  • Parallel tool execution
  • Tool chaining and composition
  • Dynamic tool generation

Reliability:

  • Retry logic with exponential backoff
  • Circuit breakers for external APIs
  • Graceful degradation
  • Error recovery strategies

Security:

  • Input validation and sanitization
  • Output filtering
  • Secrets management
  • Audit trails

Feedback

We’d love to hear about your experience:

  • What was most helpful?
  • What could be improved?
  • What would you like to learn next?
  • What did you build with your agent?

Your feedback helps us create better tutorials.

Thank You!

Thanks for completing this tutorial. You’ve learned the fundamentals of agentic AI—patterns that power production systems at companies building with AI.

The key insight: Agents are loops. They plan, act, observe, and repeat. Everything else is details.

Now go build something amazing! 🚀