Building effective agent

what are agents/workflows?

agentic-loop.svg

When(and when not) to use agents:

When building applications with LLMs, we recommend finding the simplest solution possible, and you should consider adding complexity only when it demonstrably improves outcomes. This might mean not building agentic systems at all. Agentic systems often trade latency and cost for better task performance, and you should consider when this tradeoff makes sense.

When more complexity is warranted, workflows offer predictability and consistency for well-defined tasks, whereas agents are the better option when flexibility and model-driven decision-making are needed at scale.(Agents can be used for open-ended problems where it’s difficult or impossible to predict the required number of steps, and where you can’t hardcode a fixed path.The LLM will potentially operate for many turns, and you must have some level of trust in its decision-making. Agents' autonomy makes them ideal for scaling tasks in trusted environments.) For many applications, however, optimizing single LLM calls with retrieval and in-context examples is usually enough.

image.png

                                                         (The augmented LLM)

Effective context engineering for AI agents

Context engineering refers to the set of strategies for curating and maintaining the smallest set of high-signal tokens that maximize the likelihood of your desired outcome.

System prompts

System prompts should be extremely clear and use simple, direct language that presents ideas at the right altitude for the agent. 指的是既不输入硬核,复杂的既定逻辑给LLM,也不只给一些模糊的信号,假定LLM知道背景。

image.png

Tools

Building tools that are well understood by LLMs and have minimal overlap in functionality.If a human engineer can’t definitively say which tool should be used in a given situation, an AI agent can’t be expected to do better.