# codingAgent **Repository Path**: cocamanz/coding-agent ## Basic Information - **Project Name**: codingAgent - **Description**: No description available - **Primary Language**: Python - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2026-07-26 - **Last Updated**: 2026-07-29 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # Coding Agent 一个最小化的编程 Agent 演示:基于 DeepSeek 的 tool-calling 循环,让模型通过读文件、写文件、执行 shell 命令来完成编程任务。 ## 原理 `agent.py` 定义 3 个工具(`read_file` / `write_file` / `run_bash`)及其 JSON Schema,通过「调用模型 → 执行工具 → 回填结果」的循环不断迭代,直到模型认为任务完成。 ## 环境配置 1. 安装依赖: ```bash pip install -r requirements.txt ``` 2. 在项目根目录创建 `.env` 文件: ``` DEEPSEEK_API_KEY=sk-你的密钥 DEEPSEEK_BASE_URL=https://api.deepseek.com ``` ## 使用 ```bash python agent.py "你的任务描述" ``` 默认任务(不传参数时):在当前目录创建 `hello.py`,打印 `hello from agent`,然后运行它。 ## 测试 ```bash python -m pytest test_hello.py -v ``` ## 注意事项 - `run_bash` 直接执行 shell 命令且输出截断为 4000 字符 - `write_file` 为覆盖写入,无确认 - 切勿提交 `.env` 或 API 密钥