liveBook · Manning

Prompt engineering

As explained in AI Agents and Applications

Prompt design is the practice of formulating instructions and context to influence a language model's behavior and output.

Prompt engineering is the practice of designing and refining the instructions, examples, and context sent to a language model. A prompt may be a single command or a structured set of directions. Clear, task-specific inputs help the model produce more useful and accurate responses without changing its training. section 1.4.1 section 2.0

Build a prompt around the job it needs to do:

  • State the task clearly. A chatbot can use role-based messages to establish consistent behavior across a conversation. section 1.1.2
  • Add relevant context or a few examples when the model needs to follow a pattern. Recent conversation turns can help maintain continuity; examples enable in-context learning without fine-tuning. section 1.4.1
  • Make repeated prompts reusable with a fixed instruction and variable fields, then test and refine the outputs. section 1.4.1 section 2.0

Research summarization

A research engine needs different prompts for different stages: turn a broad question into targeted web searches, extract key facts and arguments from retrieved pages, and combine the summaries into a report with citations. Separating these tasks makes each prompt’s purpose clear. section 4.5 section 4.8

Prompts also define an agent’s scope, available tools, and routing criteria. A router should account for ambiguous requests; a supervisor needs descriptions of specialist capabilities. When factual information is missing, clearer wording alone is not enough: retrieval can supply external context, and a grounded prompt should instruct the model to rely on it. section 12.4 section 1.4.2

How AI Agents and Applications covers it

How deep it goes
Defines the practice and develops reusable templates, examples, and task-specific prompts; identifies retrieval as a remedy when prompts lack needed facts.
Examples
Uses chatbot role instructions, research-query and report prompts, and specialist-agent routing criteria as concrete applications.
What it assumes
Starts with basic prompt design and introduces more sophisticated techniques; assumes no prior fine-tuning to use examples in prompts.
What you can do after
Practice/perform prompt design by writing, testing, and refining reusable instructions for specific LLM tasks.
How it connects
Links prompt design to in-context learning, few-shot prompting, conversation memory, Retrieval-Augmented Generation, and multi-agent routing.

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 AI Agents and Applications. The section links point to the parts of the book it draws on.