liveBook · Manning

Prompt engineering

As explained in Build an AI Agent (From Scratch)

Prompt engineering is the practice of designing prompts and instructions to elicit accurate or appropriately formatted outputs from a language model.

Prompt engineering designs instructions that help an LLM respond accurately and in the desired format. For an agent, the main design surface is the system prompt: developer-defined instructions that persist across turns and set its permissions, constraints, and tool-use policies. User prompts change each turn and are outside the developer’s control. section 1.5.2 section 2.3

An agent should work on the user’s behalf, not merely converse. Translate that goal into instructions for when to act, when to clarify, and how to use available tools. section 2.3.2

Act when the request is clear

A weather request should lead an agent with a search tool to search, rather than ask whether it should search. A system prompt can state: “When the user’s intent is clear, execute immediately without confirmation. Only when intent is unclear, ask minimal questions to clarify.” section 2.3.2

A static prompt is only part of an agent’s input. Search results, code-execution results, and database results can enter the context as work proceeds. Context engineering extends prompt design by deciding what information to retain and provide, when, and in what form. section 1.5.2

How Build an AI Agent (From Scratch) covers it

How deep it goes
Defines user and system prompts and gives actionable agent guidelines, without showing implementation code in the supplied excerpts.
Examples
Uses a weather request and sample system-prompt instructions to contrast immediate search with unnecessary confirmation.
What it assumes
Assumes an LLM has been selected and its API learned; introduces user and system prompts before agent-specific guidance.
What you can do after
Apply it via system prompts to direct immediate action, minimal clarification, and proactive tool use.
How it connects
Links system prompts to tool use and context engineering as tool results change an agent’s input.

Also explained in

Compare how 38 books explain prompt engineering →

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.