This freeCodeCamp course covers building AI agents - systems that can take actions, use tools, and maintain memory. The course uses AWS Bedrock but concepts apply broadly.
The Evolution of AI
Historical Context:
- 1956: Dartmouth Workshop - AI term coined
- 1997: IBM Deep Blue beats Gary Kasparov
- 2011: IBM Watson wins Jeopardy
- 2022: ChatGPT released
- 2025: Year of AI Agents
Software Evolution:
- Software 1.0: Traditional programming
- Software 2.0: Machine learning models
- Software 3.0: AI agents that can reason and act
What Are AI Agents?
An AI agent is more than a chatbot - it can:
- Take multiple actions autonomously
- Use external tools
- Maintain short and long-term memory
- Make decisions based on context
Andrew Ng’s Definition: Agentic systems are AI that can plan, reason, and take actions to achieve goals.
Agent Architecture
Core Components
- LLM (Brain): The reasoning engine
- Tools: External capabilities the agent can use
- Memory: Short-term (conversation) and long-term (persistent)
- Orchestration: The loop that coordinates everything
The Agent Loop
User Input → LLM Reasoning → Tool Selection → Tool Execution →
Response Generation → (Loop continues if needed)
Tools
Tools extend what an agent can do:
- Get current time/weather
- Execute code
- Query databases
- Call external APIs
- Send emails
Tool Definition:
- Name and description
- Input parameters
- Execution logic
AWS Bedrock Converse API:
- Standardizes tool calling across models
- Handles tool use responses
- Manages conversation flow
Memory Systems
Short-term Memory
- Current conversation context
- Recent interactions
- Limited by context window
Long-term Memory
- Persistent storage
- User preferences
- Historical interactions
- Requires external database
Multi-Agent Systems
Instead of one agent doing everything:
- Supervisor Agent: Coordinates other agents
- Specialist Agents: Handle specific tasks
- Communication: Agents pass information between each other
Example Architecture:
User → Supervisor → [Math Agent, Weather Agent, Email Agent] → Response
Practical Considerations
Choosing a Framework
When to use frameworks (LangChain, etc.):
- Rapid prototyping
- Complex orchestration needs
- Built-in integrations
When to build custom:
- Simple use cases
- Need full control
- Performance critical
Evaluation
How to evaluate agents:
- Task completion rate
- Response accuracy
- Tool usage efficiency
- Cost per interaction
Compliance & Privacy
- Data handling policies
- User consent
- Audit trails
- Access controls
Best Practices
- Use AI as a junior developer - Always review outputs
- Focus on the human element - AI augments, doesn’t replace
- Start simple - Add complexity only when needed
- Monitor everything - Track costs, latency, accuracy
- Handle failures gracefully - Fallback strategies
The Future
- More sophisticated reasoning
- Better tool integration (MCP standard)
- Multi-modal agents (text, image, audio)
- Autonomous task completion
Resources
- AWS Bedrock documentation
- LangChain, Anthropic, DeepLearning.AI academies
- Linux Foundation AI initiatives
这门freeCodeCamp课程涵盖构建AI代理——能够采取行动、使用工具和维护记忆的系统。课程使用AWS Bedrock,但概念广泛适用。
AI的演进
历史背景:
- 1956年:达特茅斯研讨会 - AI术语诞生
- 1997年:IBM深蓝击败加里·卡斯帕罗夫
- 2011年:IBM Watson赢得Jeopardy
- 2022年:ChatGPT发布
- 2025年:AI代理元年
软件演进:
- 软件1.0:传统编程
- 软件2.0:机器学习模型
- 软件3.0:能推理和行动的AI代理
什么是AI代理?
AI代理不仅仅是聊天机器人——它可以:
- 自主采取多个行动
- 使用外部工具
- 维护短期和长期记忆
- 基于上下文做决策
吴恩达的定义: 智能体系统是能够规划、推理并采取行动以实现目标的AI。
代理架构
核心组件
- LLM(大脑):推理引擎
- 工具:代理可使用的外部能力
- 记忆:短期(对话)和长期(持久)
- 编排:协调一切的循环
代理循环
用户输入 → LLM推理 → 工具选择 → 工具执行 →
响应生成 → (如需要继续循环)
工具
工具扩展代理的能力:
- 获取当前时间/天气
- 执行代码
- 查询数据库
- 调用外部API
- 发送邮件
工具定义:
- 名称和描述
- 输入参数
- 执行逻辑
AWS Bedrock Converse API:
- 标准化跨模型的工具调用
- 处理工具使用响应
- 管理对话流程
记忆系统
短期记忆
- 当前对话上下文
- 最近的交互
- 受上下文窗口限制
长期记忆
- 持久存储
- 用户偏好
- 历史交互
- 需要外部数据库
多代理系统
不是一个代理做所有事:
- 监督代理:协调其他代理
- 专家代理:处理特定任务
- 通信:代理之间传递信息
示例架构:
用户 → 监督者 → [数学代理, 天气代理, 邮件代理] → 响应
实践考虑
选择框架
何时使用框架(LangChain等):
- 快速原型开发
- 复杂编排需求
- 内置集成
何时自建:
- 简单用例
- 需要完全控制
- 性能关键
评估
如何评估代理:
- 任务完成率
- 响应准确性
- 工具使用效率
- 每次交互成本
合规与隐私
- 数据处理政策
- 用户同意
- 审计跟踪
- 访问控制
最佳实践
- 将AI作为初级开发者使用 - 始终审查输出
- 关注人的因素 - AI增强而非替代
- 从简单开始 - 仅在需要时增加复杂性
- 监控一切 - 跟踪成本、延迟、准确性
- 优雅处理失败 - 备用策略
未来展望
- 更复杂的推理
- 更好的工具集成(MCP标准)
- 多模态代理(文本、图像、音频)
- 自主任务完成
资源
- AWS Bedrock文档
- LangChain、Anthropic、DeepLearning.AI学院
- Linux基金会AI倡议