The New Skill in AI is Not Prompting, It's Context Engineering
使用 AI 的技巧,不在提示工程,而在長上下文的脈絡掌握
2025 年 6 月 30 日5 minute read
閱讀時間約 5 分鐘
Context Engineering is new term gaining traction in the AI world. The conversation is shifting from "prompt engineering" to a broader, more powerful concept: Context Engineering. Tobi Lutke describes it as "the art of providing all the context for the task to be plausibly solvable by the LLM.” and he is right.
情境工程是 AI 領域中正在受到關注的新概念。討論焦點正從「提示工程」轉向更廣泛、更有力的概念:情境工程。Tobi Lutke 把它形容為「提供足夠情境,讓大型語言模型能合理解決任務的藝術」,這說得沒錯。
With the rise of Agents it becomes more important what information we load into the “limited working memory”. We are seeing that the main thing that determines whether an Agents succeeds or fails is the quality of the context you give it. Most agent failures are not model failures anyemore, they are context failures.
隨著 AI 智能代理的興起,載入到「有限工作記憶」中的資訊變得更加關鍵。我們發現,決定一個代理成功與否的關鍵因素,就是你給它的情境品質。現在大多數代理失敗的原因,不再是模型本身的問題,而是情境給得不夠好。
什麼是情境?
What is the Context?To understand context engineering, we must first expand our definition of "context." It isn't just the single prompt you send to an LLM. Think of it as everything the model sees before it generates a response.
要理解情境工程,我們得先重新定義「情境」這個詞。它不只是你送給 LLM 的單一提示,而是模型在產出回應前所看到的所有內容。
- Instructions / System Prompt: An initial set of instructions that define the behavior of the model during a conversation, can/should include examples, rules ….
指令/系統提示:一開始設定模型在對話中應有的行為,可以/應該包含範例、規則等內容。 - User Prompt: Immediate task or question from the user.
使用者提示:來自使用者的即時任務或提問。 - State / History (short-term Memory): The current conversation, including user and model responses that have led to this moment.
狀態/歷史紀錄(短期記憶):目前的對話內容,包括使用者和模型之間的互動紀錄,累積至當前這一刻。 - Long-Term Memory: Persistent knowledge base, gathered across many prior conversations, containing learned user preferences, summaries of past projects, or facts it has been told to remember for future use.
長期記憶:持續累積的知識庫,來自過去多次對話,包含使用者偏好、過往專案摘要,或是被要求記住以供未來使用的資訊。 - Retrieved Information (RAG): External, up-to-date knowledge, relevant information from documents, databases, or APIs to answer specific questions.
擷取資訊(RAG):來自外部的即時知識,包含文件、資料庫或 API 中與問題相關的資訊,用來回答特定問題。 - Available Tools: Definitions of all the functions or built-in tools it can call (e.g., check_inventory, send_email).
可用工具:所有可呼叫的功能或內建工具的定義(例如:check_inventory、send_email)。 - Structured Output: Definitions on the format of the model's response, e.g. a JSON object.
結構化輸出:模型回應格式的定義,例如 JSON 物件。
為什麼這很重要:從陽春展示到驚艷產品的關鍵
Why It Matters: From Cheap Demo to Magical ProductThe secret to building truly effective AI agents has less to do with the complexity of the code you write, and everything to do with the quality of the context you provide.
打造真正有效的 AI Agent,關鍵不在於你寫了多複雜的程式碼,而是你提供了多高品質的上下文。
Building Agents is less about the code you write or framework you use. The difference between a cheap demo and a “magical” agent is about the quality of the context you provide. Imagine an AI assistant is asked to schedule a meeting based on a simple email:
建立 AI Agent 的重點,不在於你用什麼框架或寫了多少程式,而是在於你提供了什麼樣的上下文。想像一下,有人請 AI 助理根據一封簡單的 email 安排會議:
Hey, just checking if you’re around for a quick sync tomorrow.
嗨,想問你明天有沒有空快速聊一下。
The "Cheap Demo" Agent has poor context. It sees only the user's request and nothing else. Its code might be perfectly functional—it calls an LLM and gets a response—but the output is unhelpful and robotic:
「陽春展示版」的 Agent 缺乏上下文,只看到使用者的請求,其他什麼都不知道。雖然程式碼可以正常運作,呼叫 LLM 並取得回應,但結果卻很死板又沒幫助:
Thank you for your message. Tomorrow works for me. May I ask what time you had in mind?
謝謝你的訊息。明天我可以。請問你有想好的時間嗎?
The "Magical" Agent is powered by rich context. The code's primary job isn't to figure out how to respond, but to gather the information the LLM needs to full fill its goal. Before calling the LLM, you would extend the context to include
「驚艷版」的 Agent 則是靠豐富的上下文驅動。這時程式的主要任務不是決定怎麼回應,而是幫 LLM 準備好完成任務所需的資訊。在呼叫 LLM 之前,你會補充這些上下文:
- Your calendar information (which shows you're fully booked).
你的行事曆資訊(顯示你明天已經排滿)。 - Your past emails with this person (to determine the appropriate informal tone).
你和對方過去的 email 往來紀錄(用來判斷適合的語氣與風格)。 - Your contact list (to identify them as a key partner).
你的聯絡人清單(確認對方是重要合作夥伴)。 - Tools for send_invite or send_email.
用來發送邀請或寄送電子郵件的工具。
Then you can generate a response.
接著你就可以產生回應了。
Hey Jim! Tomorrow’s packed on my end, back-to-back all day. Thursday AM free if that works for you? Sent an invite, lmk if it works.
嘿 Jim!我明天行程滿滿,一整天都排滿了。週四早上有空,如果你可以的話?我已經發邀請了,看看是否 OK 再跟我說。
The magic isn't in a smarter model or a more clever algorithm. It’s in about providing the right context for the right task. This is why context engineering will matter. Agent failures aren't only model failures; they are context failures.
魔法不在於更聰明的模型或更巧妙的演算法,而是提供對的任務所需的正確脈絡。這也是為什麼「脈絡工程」會變得重要。代理失敗不只是模型失敗,更是脈絡失敗。
從提示工程到脈絡工程
From Prompt to Context EngineeringWhat is context engineering? While "prompt engineering" focuses on crafting the perfect set of instructions in a single text string, context engineering is a far broader. Let's put it simply:
什麼是脈絡工程?「提示工程」專注於打造一串完美的指令文字,而脈絡工程的範圍更廣。我們簡單說明一下:
Context Engineering is the discipline of designing and building dynamic systems that provides the right information and tools, in the right format, at the right time, to give a LLM everything it needs to accomplish a task.
脈絡工程是一門設計與建構動態系統的技術,目的是在正確的時間,以正確的格式,提供正確的資訊與工具,讓大型語言模型能順利完成任務。
Context Engineering is
脈絡工程是
- A System, Not a String: Context isn't just a static prompt template. It’s the output of a system that runs before the main LLM call.
一個系統,而不是一串文字:脈絡不只是靜態的提示模板,而是主模型執行前所產出的系統結果。 - Dynamic: Created on the fly, tailored to the immediate task. For one request this could be the calendar data for another the emails or a web search.
動態生成:根據任務即時產生,像是某次請求需要行事曆資料,另一次可能需要電子郵件或網頁搜尋結果。 - About the right information, tools at the right time: The core job is to ensure the model isn’t missing crucial details ("Garbage In, Garbage Out"). This means providing both knowledge (information) and capabilities (tools) only when required and helpful.
關鍵在於正確的資訊與工具、在正確的時間提供:核心目標是避免模型錯失關鍵細節(「輸入垃圾,輸出垃圾」)。這代表要在需要且有幫助的時候,提供知識(資訊)與能力(工具)。 - where the format matters: How you present information matters. A concise summary is better than a raw data dump. A clear tool schema is better than a vague instruction.
呈現方式也很重要:資訊怎麼呈現很關鍵。簡潔的摘要比原始資料堆砌更有效,清楚的工具格式比模糊的指令更實用。
結語
ConclusionBuilding powerful and reliable AI Agents is becoming less about finding a magic prompt or model updates. It is about the engineering of context and providing the right information and tools, in the right format, at the right time. It’s a cross-functional challenge that involves understanding your business use case, defining your outputs, and structuring all the necessary information so that an LLM can “accomplish the task."
打造強大又可靠的 AI 代理人,重點已不再是找到神奇的提示語或更新模型,而是如何設計脈絡,並在正確的時間、用正確的格式,提供正確的資訊與工具。這是一項跨領域的挑戰,包含理解業務需求、定義輸出目標,以及組織所有必要資訊,讓大型語言模型能「完成任務」。
致謝
AcknowledgementsThis overview was created with the help of deep and manual research, drawing inspiration and information from several excellent resources, including:
本概覽內容結合了深入研究與人工整理,參考了多個優質資源,靈感與資訊來源包括: