
1. What Are AI Agents?
Key Content:
- Components of an AI agent:
- Large Language Model (LLM): Understands user requests, creates task plans, and executes them.
- Memory:
- Short-term memory: Conversation context between user and agent.
- Long-term memory: Accumulates data to continuously improve task performance.
- Tools: Performs tasks through APIs, data services, functions, etc.
Notable Quote:
"A simple daily example is brushing your teeth. You use tools like a toothbrush and toothpaste, remember your current state, and over the long term remember your preferred toothpaste flavor."
Code Example:
- Build a simple travel planning agent using Microsoft's Semantic Kernel and Agentic Framework.
- When a user requests "plan me a day trip," it recommends a random city, and if the user doesn't like it, suggests another.
2. What Is an Agentic Framework?
Key Content:
- An Agentic Framework is a tool that helps manage AI agent tasks and collaboration more effectively.
- Key features:
- Task management.
- Context understanding.
- Agent-to-agent collaboration.
- Performance observation and evaluation.
Notable Quote:
"Azure AI Agent Service is suitable for single-agent tasks, while Semantic Kernel and Autogen are suitable for multi-agent tasks."
Code Examples:
- Semantic Kernel: Uses a travel destination recommendation plugin to return random destinations.
- Autogen: Uses JSON output format to create customized travel plans for user requests.
- Azure AI Agent Service: Generates Python code to visualize bar charts.
3. Principles for Building Good AI Agents
Key Content:
- Space: The environment where the agent works. Users should be able to easily discover agents and switch between them as needed.
- Time: Agents continuously improve through user interaction.
- Core: Embrace uncertainty and provide users with transparency and control.
Notable Quote:
"Designing the UI so users can see past prompts and interactions shows how the agent operates based on long-term context."
Code Example:
- Use Semantic Kernel to clearly explain the agent's capabilities and limitations to users.
- Create travel plans based on user requests and suggest alternatives based on conversation context.
4. Tool Use Design Pattern
Key Content:
- The tool use design pattern allows LLMs to interact with external tools (e.g., calculators, APIs, databases).
- Use cases:
- Database query generation.
- Integration with CRM systems to provide customer booking information.
- Email analysis and automated workflow execution.
Notable Quote:
"AI agents can interpret natural language, call appropriate tools, and perform tasks."
Code Example:
- Use Semantic Kernel to check travel destinations and booking availability.
- Design the LLM to recommend destinations outside of Europe.
5. Agentic RAG (Retrieval-Augmented Generation)
Key Content:
- Basic RAG: Supplements user queries with information retrieved from databases.
- Agentic RAG: Analyzes queries, breaks them into subtasks, and uses necessary tools and data to generate answers.
Notable Quote:
"Agentic RAG goes beyond simply retrieving information; it goes through multiple steps to solve complex questions."
Code Example:
- Use Azure Search and Semantic Kernel to search travel documents and supplement with weather information via plugins.
6. Building Trustworthy AI Agents
Key Content:
- System message framework:
- Clearly defines the agent's role, responsibilities, and interaction methods.
- Improves prompts in a repeatable manner.
- Human-in-the-Loop:
- Requires human approval or intervention for specific tasks.
Notable Quote:
"Writing a perfect prompt from scratch is rare. The system message framework helps you iteratively improve it."
Code Example:
- Generate more specific and detailed prompts based on simple system messages.
7. Planning Design Pattern
Key Content:
- The planning design pattern breaks complex tasks into subtasks and delegates them to other agents or processes.
- Supports structured output so other systems can process the information.
Notable Quote:
"A 3-day warm vacation plan can be broken down into flight booking, hotel booking, transportation, and personal activities."
Code Example:
- Use Pydantic to define the data structure of a travel plan and distribute tasks based on it.
8. Multi-Agent Design Pattern
Key Content:
- Multi-agent collaboration:
- Group chat: All agents share messages.
- Handoff: Tasks are passed step-by-step to different agents.
- Collaborative filtering: Each agent specializes in specific tasks.
Notable Quote:
"The concierge agent recommends local experiences, and the front desk agent refines suggestions based on them."
Code Example:
- Concierge and front desk agents collaborate to improve travel recommendations.
9. Metacognition
Key Content:
- Metacognition allows agents to analyze and improve their own plans and responses.
- Incorporates user feedback and preferences for continuous learning.
Notable Quote:
"Metacognition allows the agent to transparently explain why it made certain decisions."
Code Example:
- Store user flight time preferences and improve future recommendations based on them.
10. Production Deployment of AI Agents
Key Content:
- Setting evaluation checkpoints:
- Initial requests, tool calls, response times, user feedback, etc.
- Error handling:
- Use backup tools when external services are down.
Notable Quote:
"When a tool the agent uses goes down, it should be able to continue operating through a backup tool."
Code Example:
- Call backup tools when an HTTP 404 error occurs to continue operations.
Conclusion
These 10 lessons comprehensively cover everything from basic AI agent concepts to code implementation, design patterns, and production deployment. Each lesson comes with hands-on code, making it easy for beginners to follow along. Start your journey into the world of AI agents