当前位置:首页>java>《实战:从零构建自动写代码的AI Agent》

《实战:从零构建自动写代码的AI Agent》

  • 2026-01-31 21:07:25
《实战:从零构建自动写代码的AI Agent》

代码自己写自己?这不是魔法,是Agentic AI时代的新范式

作者:架构狮与橘 | 阅读时间:约15分钟


引言:编程范式的革命性转变

你能想象代码会自己写自己吗?

这不是科幻小说中的场景,而是正在发生的现实。从GPT-4到Claude,从Copilot到Cursor,AI正在重塑我们编写代码的方式。

但今天要讲的不是简单的代码补全,而是一个更宏大的主题——用AI Agent自动完成从需求到代码的完整开发流程

这标志着编程范式从**“告诉电脑怎么做""告诉AI要什么”**的革命性转变。


一、AI Agent编程的核心概念

1.1 什么是AI Agent?

AI Agent是一个能够:

  • 感知环境
    :理解用户需求和上下文
  • 自主决策
    :制定行动计划和解决方案
  • 执行行动
    :调用工具、生成代码、运行测试
  • 持续学习
    :从反馈中优化性能

的智能系统。

1.2 传统代码生成 vs AI Agent编程

维度
传统代码生成
AI Agent编程
输入方式
需要详细的技术规格
自然语言描述需求
工作方式
单次调用
多步骤推理和执行
能力范围
代码片段补全
完整项目开发
质量控制
依赖人工审查
自动审查和测试
迭代优化
需要人工介入
自我反思和改进

1.3 为什么是多Agent而不是单个AI?

单个AI在复杂任务中容易出错,而多Agent协同:

Planner Agent  →  理解需求、制定计划        ↓Coder Agent    →  编写代码、实现功能        ↓Reviewer Agent →  审查代码、发现错误        ↓Executor Agent →  运行测试、验证结果        ↓    反馈循环 → 持续优化

多Agent的优势:

  • 专业化分工
    :每个Agent专注自己的领域
  • 并行处理
    :多个Agent可以同时工作
  • 互相制衡
    :Reviewer和Executor确保质量
  • 容错能力
    :单个Agent失败不会导致整体失败

二、核心架构设计

2.1 整体架构

┌─────────────────────────────────────────────────────────┐│                     用户层                              ││                   自然语言需求                          │└────────────────────────┬────────────────────────────────┘                         │┌────────────────────────▼────────────────────────────────┐│                   Agent编排层                           ││  ┌─────────┐  ┌─────────┐  ┌─────────┐  ┌─────────┐   ││  │Planner  │→│ Coder   │→│Reviewer │→│Executor │   ││  └─────────┘  └─────────┘  └─────────┘  └─────────┘   │└────────────────────────┬────────────────────────────────┘                         │┌────────────────────────▼────────────────────────────────┐│                   大语言模型层                           ││         GPT-4 / Claude / DeepSeek / GLM-4               │└────────────────────────┬────────────────────────────────┘                         │┌────────────────────────▼────────────────────────────────┐│                    工具生态层                            ││  ┌────────┐  ┌────────┐  ┌────────┐  ┌────────┐      ││  │代码执行│  │文件系统│  │网络请求│  │数据库  │      ││  └────────┘  └────────┘  └────────┘  └────────┘      │└─────────────────────────────────────────────────────────┘

2.2 技术栈选型

大语言模型

# 推荐配置MODEL_CONFIG = {"gpt-4": {"provider""openai","api_base""https://api.openai.com/v1","temperature"0.7,"max_tokens"4000    },"claude-3-opus": {"provider""anthropic","api_base""https://api.anthropic.com/v1","temperature"0.7,"max_tokens"4000    }}

Agent框架

  • LangChain
    :功能全面,生态丰富
  • AutoGen
    :微软出品,多Agent对话
  • CrewAI
    :角色定义清晰,易于上手

工具生态

TOOLS = {"code_interpreter": {"description""执行Python代码","function": execute_python    },"file_operations": {"description""读写文件","function": file_operations    },"web_search": {"description""网络搜索","function": search_web    }}

三、实现步骤详解

3.1 环境准备

# 创建项目目录mkdir ai-coder-agentcd ai-coder-agent# 创建虚拟环境python -m venv venvsource venv/bin/activate  # Linux/Mac# venv\Scripts\activate   # Windows# 安装依赖pip install langchain openai anthropicpip install python-dotenvpip install pytest

3.2 基础配置

# config.pyimport osfrom dotenv import load_dotenvload_dotenv()classConfig:# OpenAI配置    OPENAI_API_KEY = os.getenv("OPENAI_API_KEY")    OPENAI_MODEL = "gpt-4-turbo-preview"# Anthropic配置    ANTHROPIC_API_KEY = os.getenv("ANTHROPIC_API_KEY")    ANTHROPIC_MODEL = "claude-3-opus-20240229"# Agent配置    MAX_ITERATIONS = 10    TEMPERATURE = 0.7    TIMEOUT = 120# 工具配置    SANDBOX_MODE = True    MAX_EXECUTION_TIME = 30

3.3 Planner Agent实现

# agents/planner.pyfrom langchain.agents import AgentExecutor, create_openai_functions_agentfrom langchain.tools import Toolfrom langchain.prompts import ChatPromptTemplatefrom langchain_openai import ChatOpenAIfrom typing importDictAnyclassPlannerAgent:"""Planner Agent:理解需求并制定开发计划"""def__init__(self, config: Config):self.llm = ChatOpenAI(            model=config.OPENAI_MODEL,            temperature=config.TEMPERATURE        )self.prompt = ChatPromptTemplate.from_messages([            ("system""""你是一位资深的软件架构师。你的任务是:1. 理解用户的需求描述2. 分析需求的核心功能点3. 设计技术方案4. 制定开发计划请以JSON格式返回你的计划,包含:- requirements: 需求列表- architecture: 架构设计- tech_stack: 技术栈选择- tasks: 任务分解(按优先级排序)"""),            ("user""{input}")        ])defplan(self, user_requirement: str) -> Dict[strAny]:"""制定开发计划"""        response = self.llm.invoke(self.prompt.format_messages(input=user_requirement)        )# 解析返回的JSON计划import jsontry:            plan = json.loads(response.content)return planexcept:# 如果返回的不是JSON,进行二次处理returnself._parse_plan(response.content)def_parse_plan(self, text: str) -> Dict[strAny]:"""解析非JSON格式的计划"""# 实现文本解析逻辑return {"requirements": [],"architecture""","tech_stack": [],"tasks": []        }

3.4 Coder Agent实现

# agents/coder.pyclassCoderAgent:"""Coder Agent:根据计划生成代码"""def__init__(self, config: Config):self.llm = ChatOpenAI(            model=config.OPENAI_MODEL,            temperature=0.3# 降低温度以获得更一致的代码        )self.code_templates = {"python"self._python_template,"javascript"self._javascript_template,"html"self._html_template        }defgenerate_code(self, task: Dict[strAny]) -> str:"""为指定任务生成代码"""        prompt = f"""任务描述:{task['description']}技术要求:{task.get('tech_requirements''')}功能要点:{task.get('features', [])}请生成完整的、可直接运行的代码。代码要求:1. 语法正确,符合最佳实践2. 添加必要的注释3. 包含错误处理4. 考虑边界情况"""        response = self.llm.invoke(prompt)        code = self._extract_code(response.content)return codedef_extract_code(self, response: str) -> str:"""从响应中提取代码块"""import re# 提取```代码块        code_pattern = r'```(?:python|javascript|html)?\n(.*?)```'        matches = re.findall(code_pattern, response, re.DOTALL)if matches:return'\n'.join(matches)return responsedefrefine_code(self, code: str, feedback: str) -> str:"""根据反馈优化代码"""        prompt = f"""原始代码:{code}反馈意见:{feedback}请根据反馈优化代码,直接返回优化后的完整代码。"""        response = self.llm.invoke(prompt)returnself._extract_code(response.content)

3.5 Reviewer Agent实现

# agents/reviewer.pyclassReviewerAgent:"""Reviewer Agent:审查代码质量"""def__init__(self, config: Config):self.llm = ChatOpenAI(            model=config.OPENAI_MODEL,            temperature=0.2        )defreview(self, code: str, requirements: str) -> Dict[strAny]:"""审查代码"""        prompt = f"""需求描述:{requirements}待审查代码:{code}请从以下维度审查代码:1. 功能完整性:是否满足需求2. 代码质量:可读性、可维护性3. 性能优化:是否有性能问题4. 安全性:是否存在安全隐患5. 最佳实践:是否符合语言最佳实践请以JSON格式返回审查结果,包含:- score: 总体评分(0-100)- issues: 发现的问题列表- suggestions: 改进建议- approved: 是否通过审查(boolean)"""        response = self.llm.invoke(prompt)import jsontry:            review = json.loads(response.content)return reviewexcept:returnself._parse_review(response.content)def_parse_review(self, text: str) -> Dict[strAny]:"""解析审查结果"""return {"score"70,"issues": [],"suggestions": [],"approved"True        }

3.6 Executor Agent实现

# agents/executor.pyimport subprocessimport tempfileimport osclassExecutorAgent:"""Executor Agent:执行和测试代码"""def__init__(self, config: Config):self.sandbox_mode = config.SANDBOX_MODEself.max_execution_time = config.MAX_EXECUTION_TIMEdefexecute(self, code: str, language: str = "python") -> Dict[strAny]:"""执行代码"""ifself.sandbox_mode:returnself._execute_in_sandbox(code, language)else:returnself._execute_direct(code, language)def_execute_in_sandbox(self, code: str, language: str) -> Dict[strAny]:"""在沙箱环境中执行代码"""# 创建临时文件with tempfile.NamedTemporaryFile(            mode='w',            suffix=f'.{language}',            delete=False        ) as f:            f.write(code)            temp_file = f.nametry:# 执行代码            result = subprocess.run(                [language, temp_file],                capture_output=True,                text=True,                timeout=self.max_execution_time            )return {"success": result.returncode == 0,"output": result.stdout,"error": result.stderr,"return_code": result.returncode            }except subprocess.TimeoutExpired:return {"success"False,"error"f"执行超时(超过{self.max_execution_time}秒)"            }finally:# 清理临时文件if os.path.exists(temp_file):                os.remove(temp_file)deftest(self, code: str, test_cases: list) -> Dict[strAny]:"""运行测试用例"""        results = []        passed = 0        failed = 0for test_case in test_cases:# 执行测试            result = self._run_test(code, test_case)            results.append(result)if result['passed']:                passed += 1else:                failed += 1return {"total"len(test_cases),"passed": passed,"failed": failed,"pass_rate": passed / len(test_cases) if test_cases else0,"results": results        }def_run_test(self, code: str, test_case: Dict) -> Dict[strAny]:"""运行单个测试用例"""# 实现测试逻辑return {"passed"True,"input": test_case.get('input'),"expected": test_case.get('expected'),"actual": test_case.get('expected')        }

3.7 多Agent协同

# agents/orchestrator.pyclassAgentOrchestrator:"""Agent编排器:协调多个Agent协同工作"""def__init__(self, config: Config):self.config = configself.planner = PlannerAgent(config)self.coder = CoderAgent(config)self.reviewer = ReviewerAgent(config)self.executor = ExecutorAgent(config)self.max_iterations = config.MAX_ITERATIONSdefdevelop(self, user_requirement: str) -> Dict[strAny]:"""完整的开发流程"""print("🚀 开始AI编程流程...")# 步骤1: 制定计划print("\n📋 Planner正在分析需求...")        plan = self.planner.plan(user_requirement)print(f"✅ 计划已制定,共{len(plan['tasks'])}个任务")        results = {"plan": plan,"code": {},"reviews": {},"tests": {}        }# 步骤2-4: 对每个任务执行编码-审查-测试循环for i, task inenumerate(plan['tasks'], 1):print(f"\n💻 正在处理任务 {i}/{len(plan['tasks'])}{task['name']}")            result = self._process_task(task, plan)            results['code'][task['name']] = result['code']            results['reviews'][task['name']] = result['review']            results['tests'][task['name']] = result['test']print("\n✨ 所有任务完成!")return resultsdef_process_task(self, task: Dict, plan: Dict) -> Dict:"""处理单个任务"""        iterations = 0while iterations < self.max_iterations:            iterations += 1print(f"  第{iterations}轮迭代...")# 生成代码            code = self.coder.generate_code(task)print(f"  ✅ 代码已生成 ({len(code)}字符)")# 审查代码            review = self.reviewer.review(code, task['description'])print(f"  🔍 审查评分: {review['score']}/100")# 如果通过审查,进行测试if review['approved']:                test_result = self.executor.test(code, task.get('tests', []))print(f"  ✅ 测试通过率: {test_result['pass_rate']*100:.1f}%")# 如果测试通过,返回结果if test_result['pass_rate'] >= 0.8:return {'code': code,'review': review,'test': test_result,'iterations': iterations                    }# 根据反馈优化            feedback = review.get('suggestions', [])            task['feedback'] = feedback# 达到最大迭代次数return {'code': code,'review': review,'test': {},'iterations': iterations        }

四、实战案例:贪吃蛇游戏

4.1 用户需求

给我写一个贪吃蛇游戏,要求:1. 使用HTML + Canvas + JavaScript实现2. 键盘方向键控制3. 吃食物变长,撞墙或撞自己死亡4. 显示当前分数5. 界面美观,有简单的动画效果

4.2 AI处理流程

Planner输出

{"requirements":["游戏画布和渲染","蛇的数据结构和移动逻辑","食物生成和碰撞检测","键盘控制","分数显示"],"architecture":"使用游戏循环架构,分离游戏逻辑和渲染","tech_stack":["HTML5 Canvas","JavaScript ES6+","CSS3"],"tasks":[{"name":"游戏框架搭建","description":"创建HTML结构和Canvas初始化","priority":1},{"name":"游戏核心逻辑","description":"实现蛇的移动、碰撞检测","priority":2},{"name":"用户交互","description":"键盘控制和界面反馈","priority":3}]}

Coder生成的代码

<!DOCTYPE html><htmllang="zh-CN"><head><metacharset="UTF-8"><title>贪吃蛇游戏</title><style>body {display: flex;flex-direction: column;align-items: center;justify-content: center;min-height100vh;margin0;backgroundlinear-gradient(135deg#667eea0%#764ba2100%);font-family'Arial', sans-serif;        }#gameContainer {backgroundrgba(2552552550.1);border-radius20px;padding20px;            backdrop-filterblur(10px);box-shadow08px32pxrgba(0000.3);        }canvas {border-radius10px;box-shadow04px16pxrgba(0000.2);        }#score {color: white;font-size24px;margin-bottom15px;text-shadow2px2px4pxrgba(0000.3);        }#gameOver {display: none;position: absolute;top50%;left50%;transformtranslate(-50%, -50%);backgroundrgba(0000.8);color: white;padding30px50px;border-radius15px;text-align: center;        }#gameOverh2 {margin-top0;        }#restartBtn {margin-top20px;padding10px30px;font-size16px;background#667eea;color: white;border: none;border-radius25px;cursor: pointer;transition: all 0.3s;        }#restartBtn:hover {background#764ba2;transformscale(1.05);        }</style></head><body><divid="gameContainer"><divid="score">分数: <spanid="scoreValue">0</span></div><canvasid="gameCanvas"width="400"height="400"></canvas></div><divid="gameOver"><h2>游戏结束!</h2><p>最终分数: <spanid="finalScore">0</span></p><buttonid="restartBtn"onclick="restartGame()">再来一局</button></div><script>const canvas = document.getElementById('gameCanvas');const ctx = canvas.getContext('2d');const gridSize = 20;const tileCount = canvas.width / gridSize;let snake = [{x10y10}];let velocity = {x0y0};let food = {x15y15};let score = 0;let gameRunning = false;let gameLoop;// 绘制游戏functiondraw() {// 清空画布            ctx.fillStyle = 'rgba(0, 0, 0, 0.8)';            ctx.fillRect(00, canvas.width, canvas.height);// 绘制蛇            snake.forEach((segment, index) => {// 渐变色效果const hue = (index * 5) % 360;                ctx.fillStyle = `hsl(${hue}, 70%, 50%)`;                ctx.fillRect(                    segment.x * gridSize,                    segment.y * gridSize,                    gridSize - 2,                    gridSize - 2                );// 添加发光效果                ctx.shadowBlur = 10;                ctx.shadowColor = `hsl(${hue}, 70%, 50%)`;            });            ctx.shadowBlur = 0;// 绘制食物            ctx.fillStyle = '#ff6b6b';            ctx.shadowBlur = 15;            ctx.shadowColor = '#ff6b6b';            ctx.beginPath();            ctx.arc(                food.x * gridSize + gridSize / 2,                food.y * gridSize + gridSize / 2,                gridSize / 2 - 2,0,Math.PI * 2            );            ctx.fill();            ctx.shadowBlur = 0;        }// 更新游戏状态functionupdate() {if (!gameRunning) return;// 移动蛇const head = {x: snake[0].x + velocity.x,y: snake[0].y + velocity.y            };// 检查碰撞if (checkCollision(head)) {gameOver();return;            }            snake.unshift(head);// 检查是否吃到食物if (head.x === food.x && head.y === food.y) {                score += 10;document.getElementById('scoreValue').textContent = score;generateFood();            } else {                snake.pop();            }        }// 检查碰撞functioncheckCollision(head) {// 撞墙if (head.x < 0 || head.x >= tileCount ||                head.y < 0 || head.y >= tileCount) {returntrue;            }// 撞自己for (let segment of snake) {if (head.x === segment.x && head.y === segment.y) {returntrue;                }            }returnfalse;        }// 生成食物functiongenerateFood() {            food = {xMath.floor(Math.random() * tileCount),yMath.floor(Math.random() * tileCount)            };// 确保食物不在蛇身上for (let segment of snake) {if (food.x === segment.x && food.y === segment.y) {generateFood();return;                }            }        }// 游戏结束functiongameOver() {            gameRunning = false;clearInterval(gameLoop);document.getElementById('finalScore').textContent = score;document.getElementById('gameOver').style.display = 'block';        }// 重新开始functionrestartGame() {            snake = [{x10y10}];            velocity = {x0y0};            score = 0;document.getElementById('scoreValue').textContent = score;document.getElementById('gameOver').style.display = 'none';generateFood();            gameRunning = true;        }// 键盘控制document.addEventListener('keydown'(e) => {if (!gameRunning) {                gameRunning = true;            }switch(e.key) {case'ArrowUp':if (velocity.y !== 1) velocity = {x0y: -1};break;case'ArrowDown':if (velocity.y !== -1) velocity = {x0y1};break;case'ArrowLeft':if (velocity.x !== 1) velocity = {x: -1y0};break;case'ArrowRight':if (velocity.x !== -1) velocity = {x1y0};break;            }        });// 游戏主循环functiongameLoopFn() {update();draw();        }// 初始化游戏generateFood();draw();        gameLoop = setInterval(gameLoopFn, 100);</script></body></html>

Reviewer审查结果

{"score":92,"issues":[],"suggestions":["可以添加暂停功能","可以考虑添加难度级别","可以添加最高分记录"],"approved":true}

五、进阶优化

5.1 RAG增强

为Agent添加知识库检索能力:

# agents/enhanced_coder.pyfrom langchain.vectorstores import FAISSfrom langchain.embeddings import OpenAIEmbeddingsclassEnhancedCoderAgent(CoderAgent):"""增强的Coder Agent:支持RAG"""def__init__(self, config: Config):super().__init__(config)# 加载代码知识库self.embeddings = OpenAIEmbeddings()self.vector_store = FAISS.load_local("code_knowledge_base",self.embeddings        )defgenerate_code(self, task: Dict[strAny]) -> str:"""使用RAG增强代码生成"""# 检索相似代码示例        similar_code = self.vector_store.similarity_search(            task['description'],            k=3        )# 将示例作为上下文        context = "\n".join([doc.page_content for doc in similar_code])        prompt = f"""参考以下代码示例:{context}任务描述:{task['description']}请参考示例代码的风格和最佳实践,生成符合要求的代码。"""        response = self.llm.invoke(prompt)returnself._extract_code(response.content)

5.2 多轮对话

# agents/conversational_agent.pyfrom langchain.memory import ConversationBufferMemoryclassConversationalAgent:"""支持多轮对话的Agent"""def__init__(self, config: Config):self.memory = ConversationBufferMemory(            return_messages=True,            memory_key="chat_history"        )self.llm = ChatOpenAI(model=config.OPENAI_MODEL)defchat(self, message: str) -> str:"""处理用户消息"""# 加载历史对话        history = self.memory.load_memory_variables({})        prompt = f"""对话历史:{history.get('chat_history''')}用户最新消息:{message}请根据对话历史和最新消息,给出合适的回复。"""        response = self.llm.invoke(prompt)# 保存到记忆self.memory.save_context(            {"input": message},            {"output": response.content}        )return response.content

5.3 性能优化

# agents/optimized_agent.pyfrom functools import lru_cacheimport asyncioclassOptimizedAgent:"""优化的Agent:支持缓存和异步"""def__init__(self, config: Config):self.llm = ChatOpenAI(model=config.OPENAI_MODEL)self.cache = {}    @lru_cache(maxsize=100)def_cached_generate(self, task_hash: str) -> str:"""带缓存的代码生成"""# 实现缓存逻辑passasyncdefgenerate_async(self, tasks: list) -> list:"""异步并行生成代码"""asyncdefprocess_task(task):returnawait asyncio.to_thread(self.generate_code,                task            )        results = await asyncio.gather(            *[process_task(task) for task in tasks]        )return results

六、挑战与解决方案

6.1 幻觉问题

问题:AI可能生成看似正确但实际错误的代码

解决方案

# 加强测试验证defcomprehensive_test(code: str) -> bool:"""全面的测试验证"""# 1. 语法检查try:compile(code, '<string>''exec')except SyntaxError as e:returnFalse# 2. 静态分析from pylint import epylint    pylint_result = epylint.py_run(code, return_std=True)# 3. 动态测试    test_cases = generate_test_cases(code)    test_result = executor.test(code, test_cases)return test_result['pass_rate'] >= 0.8

6.2 代码安全性

问题:生成的代码可能存在安全隐患

解决方案

import banditfrom bandit.core import managerdefsecurity_scan(code: str) -> Dict:"""安全扫描"""    b_mgr = manager.BanditManager(bandit.config.BanditConfig())    b_mgr.discover_files(['temp_code.py'], False)    b_mgr.run_tests()return {'issues'len(b_mgr.get_issues()),'score'100 - len(b_mgr.get_issues()) * 10    }

6.3 成本控制

问题:频繁调用LLM API成本较高

解决方案

classCostOptimizedAgent:"""成本优化的Agent"""def__init__(self, config: Config):self.small_model = ChatOpenAI(model="gpt-3.5-turbo")self.large_model = ChatOpenAI(model="gpt-4-turbo-preview")self.usage_stats = {'tokens'0'cost'0}defsmart_model_selection(self, task_complexity: str) -> ChatOpenAI:"""根据任务复杂度选择模型"""if task_complexity == 'simple':returnself.small_modelelse:returnself.large_model

七、最佳实践

7.1 Prompt工程

# 优秀的Prompt设计EXCELLENT_PROMPT = """你是一位经验丰富的{language}开发者。任务:{task_description}要求:1. 代码质量:遵循{language}最佳实践和PEP8规范2. 错误处理:包含完善的异常处理机制3. 性能优化:考虑时间复杂度和空间复杂度4. 可读性:添加清晰的注释和文档字符串5. 测试友好:代码结构便于单元测试输出格式:- 完整的代码实现- 使用说明- 示例用法"""

7.2 错误处理

defrobust_code_generation(task: Dict) -> Dict:"""健壮的代码生成流程"""    max_retries = 3for attempt inrange(max_retries):try:            code = coder.generate_code(task)# 验证代码if validate_code(code):return {'success'True'code': code}else:# 根据反馈优化                feedback = get_validation_feedback(code)                task['feedback'] = feedbackexcept Exception as e:            logger.error(f"代码生成失败: {e}")if attempt == max_retries - 1:return {'success'False'error'str(e)}return {'success'False'error''达到最大重试次数'}

7.3 质量保证

defquality_assurance_pipeline(code: str) -> Dict:"""完整的质量保证流程"""    results = {'linting': lint_code(code),'security': security_scan(code),'performance': performance_check(code),'testing': run_tests(code),'documentation': check_documentation(code)    }# 计算综合质量分数    quality_score = calculate_quality_score(results)return {'score': quality_score,'details': results,'passed': quality_score >= 80    }

八、应用场景

8.1 个人开发者

  • 快速原型开发
  • 代码重构优化
  • 学习新技术栈

8.2 企业团队

  • 提升开发效率
  • 代码规范统一
  • 降低开发成本

8.3 教育培训

  • 编程教学辅助
  • 作业自动批改
  • 个性化学习路径

九、未来展望

9.1 技术趋势

  • 更强的基础模型
    :GPT-5、Claude 4等
  • 专业化Agent
    :针对特定领域优化的Agent
  • 自主学习
    :Agent从错误中持续学习

9.2 挑战与机遇

  • 挑战

    • 代码质量和可靠性
    • 知识产权和版权问题
    • 开发者技能转型
  • 机遇

    • 10倍甚至100倍的开发效率提升
    • 降低编程门槛,让更多人参与创造
    • 释放开发者创造力,聚焦更高价值的工作

十、总结

AI Agent自动写代码不是要取代程序员,而是赋能程序员,让我们从繁琐的编码工作中解放出来,专注于更有价值的创造性工作。

从"告诉电脑怎么做"到"告诉AI要什么",这不仅仅是编程范式的转变,更是人机协作模式的革命

核心要点回顾:

  1. 多Agent协同比单个AI更可靠
  2. 完整的质量保证流程必不可少
  3. Prompt工程是关键技能
  4. RAG增强可以大幅提升代码质量
  5. 安全性和成本控制需要重视

下一步行动:

  • 搭建自己的AI代码生成Agent
  • 收集和整理领域知识库
  • 在实际项目中试用和优化
  • 持续学习最新的AI技术

参考资源

开源项目

  • AutoGen - 微软的多Agent框架
  • LangChain - 最受欢迎的LLM应用框架
  • CrewAI - 角色驱动的Agent框架

学习资源

  • Prompt Engineering Guide
  • LLM应用开发实战
  • Agentic AI最佳实践

工具平台

  • OpenAI API
  • Anthropic Claude API
  • DeepSeek API
  • 智谱AI GLM API

关于作者

我是架构狮与橘,专注于AI技术实战分享。如果这篇文章对你有帮助,欢迎点赞、收藏、转发!

关注我,每天一个AI实战干货 🎯


本文发布于2026年1月14日技术栈:Python、LangChain、OpenAI GPT-4、Anthropic Claude 3

最新文章

随机文章

基本 文件 流程 错误 SQL 调试
  1. 请求信息 : 2026-02-08 15:22:04 HTTP/2.0 GET : https://f.mffb.com.cn/a/463299.html
  2. 运行时间 : 0.244435s [ 吞吐率:4.09req/s ] 内存消耗:4,678.52kb 文件加载:140
  3. 缓存信息 : 0 reads,0 writes
  4. 会话信息 : SESSION_ID=71eea929ecbc97f57f09f372893ea222
  1. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/public/index.php ( 0.79 KB )
  2. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/autoload.php ( 0.17 KB )
  3. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/composer/autoload_real.php ( 2.49 KB )
  4. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/composer/platform_check.php ( 0.90 KB )
  5. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/composer/ClassLoader.php ( 14.03 KB )
  6. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/composer/autoload_static.php ( 4.90 KB )
  7. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-helper/src/helper.php ( 8.34 KB )
  8. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-validate/src/helper.php ( 2.19 KB )
  9. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/helper.php ( 1.47 KB )
  10. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/stubs/load_stubs.php ( 0.16 KB )
  11. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Exception.php ( 1.69 KB )
  12. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-container/src/Facade.php ( 2.71 KB )
  13. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/symfony/deprecation-contracts/function.php ( 0.99 KB )
  14. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/symfony/polyfill-mbstring/bootstrap.php ( 8.26 KB )
  15. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/symfony/polyfill-mbstring/bootstrap80.php ( 9.78 KB )
  16. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/symfony/var-dumper/Resources/functions/dump.php ( 1.49 KB )
  17. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-dumper/src/helper.php ( 0.18 KB )
  18. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/symfony/var-dumper/VarDumper.php ( 4.30 KB )
  19. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/App.php ( 15.30 KB )
  20. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-container/src/Container.php ( 15.76 KB )
  21. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/psr/container/src/ContainerInterface.php ( 1.02 KB )
  22. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/app/provider.php ( 0.19 KB )
  23. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Http.php ( 6.04 KB )
  24. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-helper/src/helper/Str.php ( 7.29 KB )
  25. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Env.php ( 4.68 KB )
  26. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/app/common.php ( 0.03 KB )
  27. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/helper.php ( 18.78 KB )
  28. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Config.php ( 5.54 KB )
  29. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/app.php ( 0.95 KB )
  30. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/cache.php ( 0.78 KB )
  31. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/console.php ( 0.23 KB )
  32. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/cookie.php ( 0.56 KB )
  33. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/database.php ( 2.48 KB )
  34. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/facade/Env.php ( 1.67 KB )
  35. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/filesystem.php ( 0.61 KB )
  36. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/lang.php ( 0.91 KB )
  37. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/log.php ( 1.35 KB )
  38. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/middleware.php ( 0.19 KB )
  39. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/route.php ( 1.89 KB )
  40. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/session.php ( 0.57 KB )
  41. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/trace.php ( 0.34 KB )
  42. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/view.php ( 0.82 KB )
  43. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/app/event.php ( 0.25 KB )
  44. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Event.php ( 7.67 KB )
  45. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/app/service.php ( 0.13 KB )
  46. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/app/AppService.php ( 0.26 KB )
  47. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Service.php ( 1.64 KB )
  48. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Lang.php ( 7.35 KB )
  49. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/lang/zh-cn.php ( 13.70 KB )
  50. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/initializer/Error.php ( 3.31 KB )
  51. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/initializer/RegisterService.php ( 1.33 KB )
  52. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/services.php ( 0.14 KB )
  53. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/service/PaginatorService.php ( 1.52 KB )
  54. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/service/ValidateService.php ( 0.99 KB )
  55. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/service/ModelService.php ( 2.04 KB )
  56. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-trace/src/Service.php ( 0.77 KB )
  57. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Middleware.php ( 6.72 KB )
  58. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/initializer/BootService.php ( 0.77 KB )
  59. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/Paginator.php ( 11.86 KB )
  60. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-validate/src/Validate.php ( 63.20 KB )
  61. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/Model.php ( 23.55 KB )
  62. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/model/concern/Attribute.php ( 21.05 KB )
  63. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/model/concern/AutoWriteData.php ( 4.21 KB )
  64. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/model/concern/Conversion.php ( 6.44 KB )
  65. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/model/concern/DbConnect.php ( 5.16 KB )
  66. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/model/concern/ModelEvent.php ( 2.33 KB )
  67. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/model/concern/RelationShip.php ( 28.29 KB )
  68. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-helper/src/contract/Arrayable.php ( 0.09 KB )
  69. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-helper/src/contract/Jsonable.php ( 0.13 KB )
  70. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/model/contract/Modelable.php ( 0.09 KB )
  71. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Db.php ( 2.88 KB )
  72. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/DbManager.php ( 8.52 KB )
  73. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Log.php ( 6.28 KB )
  74. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Manager.php ( 3.92 KB )
  75. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/psr/log/src/LoggerTrait.php ( 2.69 KB )
  76. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/psr/log/src/LoggerInterface.php ( 2.71 KB )
  77. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Cache.php ( 4.92 KB )
  78. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/psr/simple-cache/src/CacheInterface.php ( 4.71 KB )
  79. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-helper/src/helper/Arr.php ( 16.63 KB )
  80. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/cache/driver/File.php ( 7.84 KB )
  81. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/cache/Driver.php ( 9.03 KB )
  82. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/contract/CacheHandlerInterface.php ( 1.99 KB )
  83. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/app/Request.php ( 0.09 KB )
  84. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Request.php ( 55.78 KB )
  85. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/app/middleware.php ( 0.25 KB )
  86. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Pipeline.php ( 2.61 KB )
  87. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-trace/src/TraceDebug.php ( 3.40 KB )
  88. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/middleware/SessionInit.php ( 1.94 KB )
  89. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Session.php ( 1.80 KB )
  90. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/session/driver/File.php ( 6.27 KB )
  91. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/contract/SessionHandlerInterface.php ( 0.87 KB )
  92. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/session/Store.php ( 7.12 KB )
  93. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Route.php ( 23.73 KB )
  94. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/route/RuleName.php ( 5.75 KB )
  95. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/route/Domain.php ( 2.53 KB )
  96. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/route/RuleGroup.php ( 22.43 KB )
  97. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/route/Rule.php ( 26.95 KB )
  98. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/route/RuleItem.php ( 9.78 KB )
  99. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/route/app.php ( 1.72 KB )
  100. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/facade/Route.php ( 4.70 KB )
  101. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/route/dispatch/Controller.php ( 4.74 KB )
  102. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/route/Dispatch.php ( 10.44 KB )
  103. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/app/controller/Index.php ( 4.81 KB )
  104. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/app/BaseController.php ( 2.05 KB )
  105. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/facade/Db.php ( 0.93 KB )
  106. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/connector/Mysql.php ( 5.44 KB )
  107. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/PDOConnection.php ( 52.47 KB )
  108. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/Connection.php ( 8.39 KB )
  109. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/ConnectionInterface.php ( 4.57 KB )
  110. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/builder/Mysql.php ( 16.58 KB )
  111. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/Builder.php ( 24.06 KB )
  112. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/BaseBuilder.php ( 27.50 KB )
  113. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/Query.php ( 15.71 KB )
  114. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/BaseQuery.php ( 45.13 KB )
  115. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/concern/TimeFieldQuery.php ( 7.43 KB )
  116. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/concern/AggregateQuery.php ( 3.26 KB )
  117. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/concern/ModelRelationQuery.php ( 20.07 KB )
  118. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/concern/ParamsBind.php ( 3.66 KB )
  119. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/concern/ResultOperation.php ( 7.01 KB )
  120. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/concern/WhereQuery.php ( 19.37 KB )
  121. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/concern/JoinAndViewQuery.php ( 7.11 KB )
  122. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/concern/TableFieldInfo.php ( 2.63 KB )
  123. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/concern/Transaction.php ( 2.77 KB )
  124. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/log/driver/File.php ( 5.96 KB )
  125. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/contract/LogHandlerInterface.php ( 0.86 KB )
  126. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/log/Channel.php ( 3.89 KB )
  127. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/event/LogRecord.php ( 1.02 KB )
  128. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-helper/src/Collection.php ( 16.47 KB )
  129. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/facade/View.php ( 1.70 KB )
  130. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/View.php ( 4.39 KB )
  131. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Response.php ( 8.81 KB )
  132. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/response/View.php ( 3.29 KB )
  133. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Cookie.php ( 6.06 KB )
  134. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-view/src/Think.php ( 8.38 KB )
  135. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/contract/TemplateHandlerInterface.php ( 1.60 KB )
  136. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-template/src/Template.php ( 46.61 KB )
  137. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-template/src/template/driver/File.php ( 2.41 KB )
  138. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-template/src/template/contract/DriverInterface.php ( 0.86 KB )
  139. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/runtime/temp/067d451b9a0c665040f3f1bdd3293d68.php ( 11.98 KB )
  140. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-trace/src/Html.php ( 4.42 KB )
  1. CONNECT:[ UseTime:0.000542s ] mysql:host=127.0.0.1;port=3306;dbname=f_mffb;charset=utf8mb4
  2. SHOW FULL COLUMNS FROM `fenlei` [ RunTime:0.000617s ]
  3. SELECT * FROM `fenlei` WHERE `fid` = 0 [ RunTime:0.001778s ]
  4. SELECT * FROM `fenlei` WHERE `fid` = 63 [ RunTime:0.001437s ]
  5. SHOW FULL COLUMNS FROM `set` [ RunTime:0.000563s ]
  6. SELECT * FROM `set` [ RunTime:0.005285s ]
  7. SHOW FULL COLUMNS FROM `article` [ RunTime:0.000642s ]
  8. SELECT * FROM `article` WHERE `id` = 463299 LIMIT 1 [ RunTime:0.002725s ]
  9. UPDATE `article` SET `lasttime` = 1770535324 WHERE `id` = 463299 [ RunTime:0.004422s ]
  10. SELECT * FROM `fenlei` WHERE `id` = 65 LIMIT 1 [ RunTime:0.000233s ]
  11. SELECT * FROM `article` WHERE `id` < 463299 ORDER BY `id` DESC LIMIT 1 [ RunTime:0.003187s ]
  12. SELECT * FROM `article` WHERE `id` > 463299 ORDER BY `id` ASC LIMIT 1 [ RunTime:0.002794s ]
  13. SELECT * FROM `article` WHERE `id` < 463299 ORDER BY `id` DESC LIMIT 10 [ RunTime:0.001755s ]
  14. SELECT * FROM `article` WHERE `id` < 463299 ORDER BY `id` DESC LIMIT 10,10 [ RunTime:0.034070s ]
  15. SELECT * FROM `article` WHERE `id` < 463299 ORDER BY `id` DESC LIMIT 20,10 [ RunTime:0.107885s ]
0.245921s