Context
Context is the surrounding information, state, or circumstances that condition how an entity, event, or task is interpreted or how a system behaves.
Coding with AI
Context is the surrounding conversation history, instructions, assumptions, and other information that determines the meaning and intent of an input.
- How it is used
- Improves AI coding requests by supplying project information, constraints, and instructions that guide relevant suggestions.
- How deep it goes
- Explains context through IDE inputs, prompt components, selection trade-offs, and iterative refinement rather than model internals.
- Examples
- Contrasts vague and SQLite-specific connection comments and uses selected-code debugging of a database integrity error.
- What you can do after
- Apply it by selecting relevant project artifacts and adding focused requirements before reviewing and testing generated code.
Software Testing with Generative AI
The relevant background information, constraints, and requirements provided to guide interpretation of a testing request.
- How it is used
- Guides prompts and AI-assisted testing toward outputs relevant to a specific feature, system, product, or testing task.
- How deep it goes
- Explains contextual prompting, system slicing, retrieval, and fine-tuning, while stopping short of eliminating hallucinations or human verification.
- Examples
- Demonstrates file-upload testing, authorization-token risks, Copilot timesheet code, and modeled booking-report data.
- What you can do after
- Evaluate and refine prompts, provide focused context, use retrieved information, and verify generated testing or development suggestions.
Read how Software Testing with Generative AI explains context →
Authorization in Action
Context is the current information and attributes surrounding an access request that can affect an authorization decision.
- How it is used
- Drives runtime authorization decisions when identity alone cannot determine whether an action should be allowed.
- How deep it goes
- Explains contextual inputs, policy conditions, distributed retrieval, freshness tradeoffs, and language-specific representations without prescribing one universal implementation.
- Examples
- Uses shift-based customer-data access, registered devices, confidential financial reports, conditional deployments, and policy-aware agent tool calls.
- What you can do after
- Evaluate/understand which request signals belong in authorization context and how freshness affects policy reliability.
Inside AI
Context is the surrounding situation, knowledge, and circumstances that influence the interpretation of an utterance or event.
- How it is used
- Uses context to distinguish situationally sound interpretations and decisions from answers based only on surface patterns.
- How deep it goes
- Explains contextual reasoning through applied cases and AI failures, without giving an implementation procedure.
- Examples
- Illustrates it with birds startled by a gunshot, damage on returning planes, pregnancy-related prescribing, and unusual spending during holidays.
- What you can do after
- Evaluate/understand it by checking whether AI conclusions account for relevant circumstances and seeking domain-expert validation for consequential decisions.
Effective Conversational AI
Context is information about a user or interaction that a conversational system retains to interpret and manage the conversation.
- How it is used
- Uses available user and situational information to make virtual-assistant responses more relevant and interactions less burdensome.
- How deep it goes
- Defines contextual information through worked interactions and design guidance, while noting that historical awareness needs additional development rather than detailing its implementation.
- Examples
- Contrasts generic banking advice with account-aware help, and a caller’s repeated account lookup questions with caller-ID-assisted confirmation.
- What you can do after
- Apply it by using known information to shorten flows and tailor replies, while checking accuracy and protecting location data.
Data Storytelling with Altair and AI
Textual context is written material that provides background or explanation around a data visualization.
- How it is used
- Turns charted information into knowledge by supplying background that explains why an observed situation occurs.
- How deep it goes
- Defines context, demonstrates textual and visual forms, and provides Altair and ChatGPT procedures for adding it.
- Examples
- Uses pet participation rates, Portugal tourism and low-cost flights, sports baselines, homelessness, and fake-news charts.
- What you can do after
- Apply it via Altair and ChatGPT to add audience-tailored annotations, subtitles, supporting charts, and visual cues.
Read how Data Storytelling with Altair and AI explains context →
AI-Powered Search
Context is surrounding linguistic, domain, document, conversational, or user information that helps determine the intended meaning of a query or interaction.
- How it is used
- Uses domain, content, and user information to interpret queries and choose relevant search behavior.
- How deep it goes
- Works through category classification, two-level term disambiguation, and spelling limitations; defers Transformer internals.
- Examples
- Contrasts travel and devops meanings of “driver,” index-based suggestions for “moden,” and retrieved passages for questions.
- What you can do after
- Apply it via an SKG to classify queries and select related terms within a category before rewriting a search query.
Introduction to Generative AI, Second Edition
Linguistic context is surrounding sequence information that informs the interpretation or prediction of a token.
- How it is used
- Uses surrounding text and supplied information to explain token prediction, question answering, and prompt design.
- How deep it goes
- Contrasts left-only and bidirectional context through plain-language examples without detailing model internals.
- Examples
- Uses an Eiffel Tower sentence, an ambiguous president question, and a more specific executive-summary prompt.
- What you can do after
- Apply it via prompt engineering by specifying purpose, audience, and supporting information while checking answers that rely on unstated assumptions.
Read how Introduction to Generative AI, Second Edition explains context →
Natural Language Processing in Action, Second Edition
Context is semistructured information about a user or conversation session that constrains how subsequent dialog should be interpreted or generated.
- How it is used
- Guides NLP interpretation, dialog-state transitions, personalization, and analysis of user sessions.
- How deep it goes
- Defines context, shows state-based decisions and JSON storage, and stops short of specifying a complete context-management implementation.
- Examples
- Uses sarcasm detection, a counting tutor, adaptive math attempts, teacher-bot records, and a question-answering context field.
- What you can do after
- Apply context via JSON fields and dialog-state logic to personalize responses, branch conversations, and review session behavior.
Read how Natural Language Processing in Action, Second Edition explains context →
AI Agents and Applications
Prompt context is background text or information supplied alongside a request to help a language model interpret it and formulate an answer.
- How it is used
- Supplies background beside a user question so a chatbot can select information and synthesize an answer.
- How deep it goes
- Defines context through a single-document Q&A workflow and shows separate context and question slots in an initial RAG prompt.
- Examples
- Uses a Paestum passage and temple questions, plus a LangChain prompt template with context and question slots.
- What you can do after
- Apply it via a prompt template that pairs a question with document context, then consider message history for follow-up questions.
Digital Twins in Action
Context is information about a specific system, domain, or situation that conditions the interpretation and generation of model outputs.
- How it is used
- Turns sensor readings into equipment-specific information for digital-twin decisions and grounds generated answers in system data.
- How deep it goes
- Defines four context types and works through sensor interpretations, then identifies knowledge capture and decision logging as implementation challenges.
- Examples
- Contrasts furnace and pump temperatures, combines garden moisture with sprinkler relationships, and records a denied irrigation command.
- What you can do after
- Diagnose/debug with it by reviewing logged inputs, models, rules, and actions to investigate an automated decision.
Prompt Engineering in Practice
Context is supplementary information supplied to a model because it cannot be assumed to know it.
- How it is used
- Frames engineering tasks with the background needed to interpret instructions and produce relevant responses.
- How deep it goes
- Defines static prompt context and works through engineering examples; defers in-context learning and few-shot prompting.
- Examples
- Demonstrates architecture decision summaries and incident status updates grounded in supplied operational details.
- What you can do after
- Build it from scratch: compose prompts with relevant background, separated variable inputs, and explicit output requirements.
Optimization Algorithms: AI techniques for design, planning, and control problems
Context is observed information describing the current situation that conditions the expected reward of an action.
- How it is used
- Conditions action selection when expected rewards vary with observed situation information.
- How deep it goes
- Defines context, contrasts it with noncontextual bandits and MDPs, and demonstrates implementation without deriving learning theory.
- Examples
- Uses casino slot machines as a noncontextual contrast and truck selection across route types as a contextual example.
- What you can do after
- Apply it via Vowpal Wabbit to select actions whose rewards depend on shared and action-dependent features.
Grokking AI Applications
Context is a numerical representation derived from the input text that summarizes information relevant to predicting a continuation.
- How it is used
- Supports GPT sentence completion by summarizing input information for predicting the next word or longer continuation.
- How deep it goes
- Defines context as a numerical representation and connects it to embeddings and prediction without developing mathematical internals.
- Examples
- Uses a tiny eight-word dictionary, numerical word representations, prompts, and repeated next-word generation.
- What you can do after
- Understand how GPT turns tokenized input into context for predicting and repeatedly generating continuations.
LLMs in Production
Information supplied with a prompt that enables a language model to interpret a request and produce an appropriate response.
- How it is used
- Supplies retrieved or otherwise added information that helps a model answer questions beyond its direct prompt knowledge.
- How deep it goes
- Explains context as one of four prompt parts and shows vector database retrieval, but does not detail retrieval implementation.
- Examples
- Uses a company-policy 401k question, retrieved vector database documents, and structured instructions as concrete examples.
- What you can do after
- Apply it through RAG or database lookups to add relevant information to prompts and improve response appropriateness.
Experimentation for Engineers
The observed information about a user that conditions which action a contextual bandit selects.
- How it is used
- Conditions contextual-bandit post selection by representing the current user’s features.
- How deep it goes
- Defines context as a feature vector and uses it in a simulated reward function, without detailing feature engineering.
- Examples
- Uses age, ZIP code, reported interests, app-use frequency, posts, and viewing time as concrete examples.
- What you can do after
- Apply it via a reward simulator by encoding user information as a feature vector.
Effective Data Analysis
Contextual information is a combination of non-sensitive details that provides enough clues to infer an individual's identity.
- How it is used
- Warns that anonymization may fail when analysts release or analyze datasets containing combinations of seemingly harmless details.
- How deep it goes
- Defines contextual information and illustrates cross-referencing risks, but stops short of specifying a formal risk-assessment procedure.
- Examples
- Uses Netflix ratings, IMDb, transit cards, social-media check-ins, demographics, AOL searches, and small employee-survey groups.
- What you can do after
- Evaluate whether removing direct identifiers adequately protects people by examining combinations that could be matched with public information.
The Art of AI Product Development
Prompt context is external information supplied to a model to influence its response, including prior conversation or a specified role.
- How it is used
- Uses conversation history and domain roles to steer model responses within reusable prompt structures.
- How deep it goes
- Defines context and illustrates its uses, but stops short of explaining model internals or systematic evaluation.
- Examples
- Uses prior conversation, an AI-compliance expert role, and an EU AI Act article request as concrete examples.
- What you can do after
- Apply it by adding relevant conversation history or a specialized role to prompts and adapting those prompts through templates.
Read how The Art of AI Product Development explains context →
Related concepts
- promptpart of · An input, typically containing instructions or context, supplied to an artificial-intelligence model to guide or elicit its output.
- context windowcontrasts with · A context window is the bounded sequence of tokens or other input information a model can access when processing or generating an output.
- demonstrationpart of · A demonstration is an example pairing an input, request, or prompt with a corresponding output, answer, or label to illustrate a task or expected behavior.
- business rulehas part · A business rule is a domain-specific policy, condition, or constraint that governs valid data, decisions, actions, or behavior in an organization or its systems.
- intentionhas part · Intention is a goal or purpose attributed to an agent and expressed or implied by a request, action, plan, or desired outcome.
These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.

















