liveBook · Manning

Prompt

As explained in Build an AI Agent (From Scratch)

An instruction supplied to a language model that establishes high-level behavior or constraints for an interaction.

A prompt is input text sent to a language model. A user prompt contains a request; a system prompt supplies developer-defined instructions for how the model should behave. Both are part of the model’s context, alongside conversation history, tool results, and retrieved documents. section 1.5 section 2.3

For an agent, the system prompt sets rules that persist across turns. It guides decisions to call tools, interpret results, and choose the next action. Because the model generates from what is in its context window, these instructions matter throughout a multi-step task. section 2.3 section 2.3.1 section 1.5

A practical system prompt can specify:

  • Identity: what the agent is and what product facts it can state. section 2.3.1
  • Output format and style: how responses should be presented. section 2.3.1
  • Boundaries and knowledge limits: prohibited behavior and when to avoid unsupported claims. section 2.3.1
  • Action and tool-use rules: when to proceed, clarify, search, or use another available tool. section 2.3.2

Turn a vague instruction into an action rule

For an agent with a search tool, “use tools when necessary” leaves too much to interpretation. A more actionable rule is to search immediately for rapidly changing information. Likewise, tell the agent to execute when intent is clear and ask minimal clarifying questions only when it is unclear. section 2.3.2

More instructions are not always better. Combining research, coding, writing, and review rules in one prompt can make the relevant rule harder to identify. Separate specialist agents can instead use role-focused prompts and dedicated tools. section 9.1

Figure 9.2 Four specialist agents for technical blog writing. Each agent focuses on a single role with optimized prompts and dedicated tools.

The four-agent diagram shows how role-focused prompts and dedicated tools replace one crowded set of instructions. section 9.1

How Build an AI Agent (From Scratch) covers it

How deep it goes
Defines prompt categories, details system-prompt roles and actionable guidelines, and examines the cost of packing multiple roles into one prompt.
Examples
Uses weather searches, clarification rules, and a technical-blog assistant combining research, coding, writing, and review.
What it assumes
Assumes an LLM and its API have been selected, while defining prompts and distinguishing system instructions from user requests.
What you can do after
Build it from scratch by writing agent instructions for action, clarification, and tool selection, then splitting crowded roles when needed.
How it connects
Links prompts to context engineering, tool use, conversation history, and multi-agent systems.

Also explained in

Compare how 50 books explain prompt →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Build an AI Agent (From Scratch). The section links point to the parts of the book it draws on.