如何构建您的代理:11种提示技术以提升AI代理的表现

Prompt engineering has become one of the highest-leverage skills in modern software development. The prompt you feed an agent shapes how it plans, how it uses tools, and whether it builds or breaks your pipeline. Tiny changes—an extra line of context, a clarified constraint, a reordered instruction—often produce outsized gains in accuracy and reliability. This post distills field-tested tactics we use at Augment Code to build autonomous agents that behave like disciplined teammates instead of hallucinating vibe coding tools.

提示工程已成为现代软件开发中最具杠杆效应的技能之一。你提供给代理的提示决定了它的计划方式、使用工具的方式,以及它是构建还是破坏你的管道。微小的变化——额外的一行上下文、澄清的约束、重新排序的指令——往往会在准确性和可靠性上产生巨大的收益。本文提炼了我们在Augment Code中使用的经过实地验证的策略,以构建像有纪律的团队成员一样表现的自主代理,而不是幻觉般的编码工具。

The examples in the post focus on coding agents, but the techniques are generally applicable.

帖子中的示例集中在编码代理上,但这些技术通常是适用的。

What is prompt engineering?

什么是提示工程?

An agent’s prompt includes everything that gets supplied to the model as input. This includes various components:

代理的提示包括所有作为输入提供给模型的内容。这包括各种组件:

  • System prompt
  • 系统提示
  • Tool definitions
  • 工具定义
  • Tool outputs
  • 工具输出
  • User instructions
  • 用户指令
  • The model’s own outputs from previous turns
  • 模型在之前回合的输出

Prompt engineering is the art of improving a model’s performance on a task by providing it with a better prompt. All parts of the prompt can be potentially improved with prompt engineering. For example:

提示工程是通过提供更好的提示来提高模型在任务上的表现的艺术。提示的所有部分都可以通过提示工程进行潜在改进。例如:

  • The system prompt can include general instructions to nudge the model toward different  response styles or levels of autonomy
  • 系统提示可以包括一般指令,以引导模型朝向不同的响应风格或自主水平
  • Tool definitions can explain to the model under which circumstances a tool should or shouldn’t be used
  • 工具定义可以向模型解释在什么情况下应该或不应该使用某个工具
  • Tool outputs can tell the model about error conditions
  • 工具输出可以告诉模型关于错误条件的信息
  • User instructions can be re-written before being shown to the model (prompt enhancement).
  • 用户指令可以在展示给模型之前进行重写(提示增强)。
  • Previous model outputs can be compressed or truncated to save tokens, so longer dialog histories can fit in the context window. How they are truncated ma...
开通本站会员,查看完整译文。

首页 - Wiki
Copyright © 2011-2025 iteam. Current version is 2.143.0. UTC+08:00, 2025-05-25 21:54
浙ICP备14020137号-1 $访客地图$