Skip to content

LiuJrX/ai-agents-code

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ai-agents-code

A modular, hands-on collection of AI Agent implementations in Python, covering core concepts like ReAct, COT, memory, tools, self-reflection and agent loop.

目录结构

AI-Agents-Code/
├── .vscode/
│   ├── settings.json    # 项目配置
│   └── launch.json      # 调试配置
├── pyproject.toml       # 依赖清单
├── uv.lock              # 锁定版本(必提交)
├── .venv/               # uv 虚拟环境(Git 忽略)
├── .env                 # 环境变量(Git 忽略)
├── main.py
└── .gitignore(deleted)  # 主目录已存在,这里已删除

UV 项目依赖管理

# 1. 创建项目(推荐在空目录执行)
uv init                  # 会生成 pyproject.toml、main.py 等其他文件,不会创建 .venv

# 2. 添加依赖(写清单,加入 pyproject.toml 文件中)
uv add openai langchain langchain-openai python-dotenv

# 3. 同步虚拟环境(创建 .venv)
uv sync

# 4. 在项目根目录创建 env
touch .env

# 5. 如果需要加载 .env 文件(不用手动激活)
uv run --env-file .env main.py

# 或者设置全局让所有 uv run 都加载
export UV_ENV_FILE=.env
uv run main.py

.env 文件创建时机:

  • uv add ...(添加依赖时)
  • uv sync(同步依赖时,最推荐)
  • uv run ...(第一次运行脚本时,uv 会自动创建)

.env(环境变量文件):

  • uv init 从来不会创建 .env 文件
  • .env 是你自己手动创建的,用于存放敏感信息(如 API Key、数据库密码等)。
  • uv 只支持加载 .env(通过 --env-file .env),但不会帮你生成它。

About

A modular, hands-on collection of AI Agent implementations in Python, covering core concepts like ReAct, COT, memory, tools, self-reflection and agent loop.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages