基于 LangChain DeepAgents 的智能代理系统,集成 LangSmith 调试能力。
项目使用 uv 包管理器,依赖已配置完成:
# 依赖已安装,如需重新安装:
uv sync# 复制环境变量模板
cp .env.example .env
# 编辑 .env 文件,填入你的配置
nano .env # 或使用你喜欢的编辑器必需的配置:
# LangSmith (调试追踪)
LANGCHAIN_TRACING_V2=true
LANGCHAIN_API_KEY=lsv2_pt_your_key_here
LANGCHAIN_PROJECT=deepagents-project
# Anthropic (Claude API)
ANTHROPIC_API_KEY=sk-ant-your_key_here- 访问 https://smith.langchain.com/settings
- 点击 "Create API Key"
- 复制生成的 API Key 到
.env文件
详细配置说明请查看: docs/LANGSMITH_CONFIG.md
# 运行测试脚本
python examples/test_langsmith.py如果配置正确,你会看到成功消息,并可以在 LangSmith 面板中查看追踪记录。
# DeepAgents + LangSmith 调试示例
python examples/deepagent_with_langsmith.py你的 LangSmith 组织: https://smith.langchain.com/o/83b1bf76-e8af-486e-b7a3-a6f7fba6369f
LangSmith 提供:
- 📈 完整的执行流程可视化
- 🐛 每一步的输入输出追踪
- ⏱️ 性能和成本分析
- 🔍 错误调试和重放
DeepCodeAgent/
├── src/ # 源代码目录
│ ├── agents/ # 代理模块
│ ├── backends/ # 后端模块
│ ├── config/ # 配置模块
│ ├── prompts/ # 提示词模块
│ ├── tools/ # 工具模块
│ └── utils/ # 工具函数
├── examples/ # 示例代码
│ ├── test_langsmith.py # LangSmith 配置验证
│ └── deepagent_with_langsmith.py # DeepAgent 调试示例
├── docs/ # 文档
│ └── LANGSMITH_CONFIG.md # LangSmith 配置指南
├── tests/ # 测试目录
├── data/ # 数据目录
├── logs/ # 日志目录
├── .env.example # 环境变量模板
├── .gitignore # Git 忽略文件
└── pyproject.toml # 项目配置
deepagents- LangChain DeepAgents 框架langchain+langgraph- LangChain 核心
langchain-anthropic- Claude/Anthropiclangchain-openai- OpenAIlangchain-google-genai- Google Geminilangchain-cohere- Coherelangchain-huggingface- HuggingFace
chromadb- ChromaDBfaiss-cpu- FAISSpinecone- Pineconeqdrant-client- Qdrant
pymongo- MongoDBredis- Redispsycopg2-binary- PostgreSQL
langserve- LangChain 服务部署fastapi+uvicorn- Web 框架unstructured- 数据处理python-dotenv- 环境变量管理langsmith- LangSmith 客户端
- LangSmith 组织: https://smith.langchain.com/o/83b1bf76-e8af-486e-b7a3-a6f7fba6369f
- DeepAgents GitHub: https://github.com/langchain-ai/deepagents
- LangChain 文档: https://docs.langchain.com/
MIT