---
title: "Prompt and context engineering"
description: "Prompt and context engineering for LLM apps: managing context windows, tool calling and function calling, structured outputs, and the techniques that hold up."
type: "topic-hub"
canonical_url: "https://theaiengineering.com/topics/prompt-engineering"
markdown_url: "https://theaiengineering.com/topics/prompt-engineering.md"
author: "The AI Engineering Editors"
publisher: "The AI Engineering"
keywords: ["context engineering","prompt engineering","context engineering vs prompt engineering","tool calling","function calling","structured outputs"]
citation: "The AI Engineering Editors. \"Prompt and context engineering.\" The AI Engineering. https://theaiengineering.com/topics/prompt-engineering"
---

# Prompt and context engineering

Deciding what the model sees: prompts, context, tools and structured output.

Prompt engineering shapes a single instruction; context engineering manages everything a model sees across a whole task, including system prompts, retrieved documents, tool definitions, tool results and memory. As agents run longer, the second discipline matters more.

The guides here cover context management, tool calling and structured outputs, and the prompting techniques that remain useful as models improve.

## Prompt and context engineering guides

- [What is context engineering? A practical guide for AI agents](https://theaiengineering.com/articles/context-engineering): Context engineering is the practice of choosing what fills an LLM context window. Learn its components, why context rot happens, and how to measure results.
- [What is tool calling? How LLM function calling works](https://theaiengineering.com/articles/tool-calling): Tool calling lets an LLM request actions from your code through structured calls. Learn the request loop, parallel calls, structured outputs, security, and MCP.

## Key terms

- [Chain-of-thought prompting](https://theaiengineering.com/glossary/chain-of-thought): Chain-of-thought prompting is a technique that has a language model write intermediate reasoning steps before its final answer, which improves large models' accuracy on arithmetic, commonsense, and symbolic reasoning tasks.
- [Context compaction](https://theaiengineering.com/glossary/context-compaction): Context compaction is a context management technique that replaces older conversation turns with a model-written summary as the context window nears its limit, so an agent can keep working.
- [Context engineering](https://theaiengineering.com/glossary/context-engineering): Context engineering is the practice of selecting, structuring, and pruning all the information placed in an LLM's context window at each step, including instructions, retrieved data, tool results, and memory.
- [Context rot](https://theaiengineering.com/glossary/context-rot): Context rot is the decline in a language model's accuracy and recall as the number of tokens in its input grows, even when the information a task needs is present in the context.
- [Few-shot prompting](https://theaiengineering.com/glossary/few-shot-prompting): Few-shot prompting is a technique that puts a few example inputs paired with desired outputs in a prompt, so a language model infers the task, format, and labels without changing its weights.
- [JSON Schema](https://theaiengineering.com/glossary/json-schema): JSON Schema is a declarative vocabulary, itself written in JSON, for describing the structure of JSON data; LLM APIs and MCP use it to define tool arguments and constrain model output.
- [Prompt engineering](https://theaiengineering.com/glossary/prompt-engineering): Prompt engineering is the practice of designing the instructions, examples, and formatting given to a large language model so it produces accurate, consistent output for a task, without changing model weights.
- [Structured outputs](https://theaiengineering.com/glossary/structured-outputs): Structured outputs is an LLM API feature that constrains generation so the model's response always conforms to a developer-supplied JSON Schema, producing output that code can parse without retries.
- [System prompt](https://theaiengineering.com/glossary/system-prompt): A system prompt is the set of developer-written instructions sent to a language model ahead of the conversation, defining its role, rules, output format, and tool use for every turn that follows.
- [Tool calling](https://theaiengineering.com/glossary/tool-calling): Tool calling is an LLM capability in which the model, given a list of tool definitions, outputs a structured request naming a tool and its arguments, which the application executes and returns.

## Cite this page

The AI Engineering Editors. "Prompt and context engineering." The AI Engineering. https://theaiengineering.com/topics/prompt-engineering

- Title: Prompt and context engineering
- Author: The AI Engineering Editors
- Publisher: The AI Engineering
- URL: https://theaiengineering.com/topics/prompt-engineering
- Markdown: https://theaiengineering.com/topics/prompt-engineering.md
