Context
Context is the relevant information, state, or circumstances surrounding an input, decision, or activity that influence its interpretation or behavior.
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
- Guides coding assistants toward the intended task using project information, constraints, and conversational refinement.
- How deep it goes
- Defines context and gives selection and prompting practices, including noise and token-limit trade-offs, without a detailed model-internals treatment.
- Examples
- Illustrates context with a SQLite connection prompt and an IntegrityError investigation involving question-set IDs.
- What you can do after
- Apply it via Cursor by selecting relevant files, documentation, chat history, terminal output, or other available context.
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
- Uses request context to make authorization responsive to changing conditions rather than relying on static access assignments.
- How deep it goes
- Explains context selection, delivery, caching, freshness, and request mapping, with policy and architecture tradeoffs.
- Examples
- Compares deployment decisions using clearance, managed-device status, time, and on-call status.
- What you can do after
- Evaluate authorization context by selecting signals and balancing freshness, risk, latency, and data exposure.
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 assess AI interpretation and decision-making in situations where data alone can mislead.
- How deep it goes
- Explains contextual reasoning through examples and desired capabilities, without detailing an implementation.
- Examples
- Illustrates context with birds startled by gunfire, aircraft damage records, pregnancy prescriptions, and vacation spending.
- What you can do after
- Evaluate AI outputs by identifying relevant circumstances and seeking domain expertise during validation.
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 →
Spec-Driven Development
Information supplied to an AI coding agent to guide its understanding and work.
- How it is used
- Guides coding-agent execution by carrying relevant intent, constraints, and verification criteria across changes and sessions.
- How deep it goes
- Explains selection, placement, persistence, and revision of context, including context-window limits; does not prescribe a universal context template.
- Examples
- Uses URL-shortener project configuration, recurring business rules, and an expiration change that risks losing a shortcode reassignment ban.
- What you can do after
- Operate/configure it through OpenSpec config.yaml or SpecKit constitution.md to supply recurring guidance to future agent sessions.
AI for Everyday IT
Context is the surrounding information or events that provide clarity or understanding, including the structural and logical information surrounding source code.
- How it is used
- Guides AI responses with task details, conversation history, and execution information.
- How deep it goes
- Defines context and illustrates retention limits and prompt refinement without detailing model internals.
- Examples
- Uses a small IT project prompt and a logged user lookup to illustrate context.
- What you can do after
- Practice supplying task details and carrying key points into a new chat, then verify the response.
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 context to interpret query intent and supply candidate passages for extractive question answering.
- How deep it goes
- Works through graph-based classification and disambiguation, spelling limitations, and answer-context retrieval; defers Transformer internals.
- Examples
- Illustrates category-specific meanings of “server,” spelling suggestions for “moden,” and retrieved contexts for a question about minimalist shoes.
- What you can do after
- Apply it via a semantic knowledge graph to classify queries and generate category-specific related terms.
AI Model Evaluation
A contextual feature is an input variable describing the circumstances surrounding a user's current interaction or request.
- How it is used
- Uses contextual features as recommender inputs and contextual metadata to interpret offline and counterfactual evaluations.
- How deep it goes
- Explains what to log, why missing context distorts comparisons, and the assumptions needed for counterfactual estimates.
- Examples
- Illustrates device and time features in movie recommendations, weekend viewing differences, and informational versus transactional search queries.
- What you can do after
- Evaluate and understand whether logged context supports meaningful policy comparisons and whether contextual features improve recommendations without harming guardrails.
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 context to explain token prediction, question answering, and how prompts communicate intent.
- How deep it goes
- Explains left and right context intuitively and distinguishes provided support from training-based answers, without implementation details.
- Examples
- Illustrates context with an Eiffel Tower sentence, an ambiguous presidential question, and a targeted executive-summary prompt.
- What you can do after
- Evaluate how surrounding text and supplied information can shape predictions and answers, including where unsupported assumptions may arise.
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 →
Applied Reinforcement Learning
Context is observable information about a decision situation that is available before an action is selected.
- How it is used
- Uses observable information to tailor contextual-bandit decisions, such as choosing customer-specific discounts.
- How deep it goes
- Defines context as a vector and distinguishes it from state, without detailing its construction.
- Examples
- Uses customer data, environmental conditions, time signals, and personalized discount levels as examples.
- What you can do after
- Apply observable customer information to choose discount levels for individual interactions.
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 for prompt instructions, document questions, and continuing chatbot conversations.
- How deep it goes
- Defines context and illustrates its placement in prompts and a retrieval chain, then introduces adding message history.
- Examples
- Uses a keynote prompt and questions about a passage on Paestum to illustrate background and document context.
- What you can do after
- Apply context in ChatGPT by submitting a document with a question and refining the question through follow-up.
Claude at Work
Context is information supplied to a language model that frames and conditions its response, including relevant prior conversation and background details.
- How it is used
- Guides the background supplied to Claude so responses fit the task and avoid unstated assumptions.
- How deep it goes
- Explains practical prompt ingredients, cumulative token limits, and session resets without requiring deep technical knowledge.
- Examples
- Uses a cloud migration prompt and web or file research to illustrate background details and context growth.
- What you can do after
- Apply it with Claude by supplying relevant background, checking assumptions, and revising or restarting conversations.
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
- Gives sensor readings and model outputs system-specific meaning for digital-twin decisions.
- How deep it goes
- Distinguishes four context types, demonstrates their combined use, and specifies decision information to retain for audits.
- Examples
- Uses an 85°C equipment reading and a garden moisture sensor to show how contextual information changes interpretation and action.
- What you can do after
- Evaluate sensor readings and decisions by linking them to equipment specifications, history, relationships, and operating rules.
AI Recommender Systems
Context is an external circumstance such as companions, mood, time, or prior activity that influences the relevance of a recommendation.
- How it is used
- Adapts recommendation relevance to the current situation, commonly by filtering or reranking candidates from other methods.
- How deep it goes
- Defines contextual signals and explains reranking with a comic example, but does not specify a contextual model implementation.
- Examples
- Compares one comic across a mobile lunch break and two weekend laptop sessions, then contrasts afternoon and evening rankings.
- What you can do after
- Evaluate/understand when current circumstances warrant changing a candidate’s rank and what capturing those circumstances requires.
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.
Understanding AI
Context is information about a situation, user, objective, constraints, or prior knowledge that conditions how a model interprets a request and selects relevant knowledge.
- How it is used
- Guides prompt engineering by supplying situation details that help select relevant knowledge and tailor responses.
- How deep it goes
- Defines context, demonstrates four prompt categories, and contrasts sequential retention with attention; it does not detail attention internals.
- Examples
- Uses electric-vehicle buyer prompts and an umbrella sentence completed as “raining.”
- What you can do after
- Apply it by adding identity, objective, constraints, and prior knowledge to make prompts more relevant.
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.
Architecting for Autonomy
The situational information required to interpret an interaction's intent safely and appropriately.
- How it is used
- Shapes the interpretation of agentic intent and carries decision-relevant circumstances through coordination and human handoffs.
- How deep it goes
- Defines context within a conversational contract and specifies the facts, uncertainties, and dependencies to include in a handoff.
- Examples
- Uses a lot-containment investigation and a quality manager’s review of a containment recommendation.
- What you can do after
- Evaluate whether coordination and handoffs preserve the circumstances, authority, and ownership needed for accountable decisions.
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.
Effective Behavior-Driven Development
The state or conditions established before an action takes place in an example.
- How it is used
- Sets the pre-action state in examples and Gherkin scenarios so a behavior can be understood against relevant conditions.
- How deep it goes
- Defines context and explains its boundary with action, noting that classification can vary with business behavior.
- Examples
- Uses a pizza delivery-address change and an unauthenticated customer choosing collection with unacceptable contact details.
- What you can do after
- Apply Gherkin’s Given step to express relevant preconditions and distinguish them from the triggering action.
Read how Effective Behavior-Driven Development explains context →
Acing the Frontend Interview
An execution context is the runtime record containing the state required to evaluate JavaScript code, including its bindings and lexical environment.
- How it is used
- Assesses whether candidates can explain JavaScript scope, trace variable access, and reason about closure-related memory behavior.
- How deep it goes
- Traces scope chains and persistent closure state, then probes memory retention, garbage collection, debugging, and private state trade-offs.
- Examples
- Uses hoisting, a persistent counter closure, and event handlers that either retain or clear a large object.
- What you can do after
- Evaluate execution-context behavior, trace closures, and diagnose potential memory retention in JavaScript code.
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.
Machines that Think
Context is the surrounding information and circumstances that determine how an expression, event, or task should be interpreted.
- How it is used
- Frames language interpretation and the information available to a model when generating an answer.
- How deep it goes
- Explains active token sequences, learned parameters and attention, while leaving the mechanisms behind chain-of-thought improvements unsettled.
- Examples
- Illustrates inaccessible information with post-training events, omitted documents and prior turns that must be reintroduced.
- What you can do after
- Enables evaluation of whether a model has the information needed to answer reliably, without treating fluency as proof of understanding.
Inside Deep Learning: Math, Algorithms, Models
Additional information about the other items in a sequence used to influence how an item's attention score is computed.
- How it is used
- Conditions each item's attention score on information from the other items, making local importance decisions context-aware.
- How deep it goes
- Defines a shared per-sequence context, gives averaging as a simple construction, and leaves room for alternatives.
- Examples
- Uses a noisy-coffee-shop analogy, averaged feature vectors, and a digit-bag task with an attention-derived context.
- What you can do after
- Apply context by averaging extracted features and passing the shared vector into each item's score computation.
Read how Inside Deep Learning: Math, Algorithms, Models explains context →
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 →
Also covered in
- Decision EngineeringIn early access (MEAP)
- Writing for Developers: Blogs that get read
- Architecture Modernization: Socio-technical alignment of software, strategy, and structure
- Enterprise RAGIn early access (MEAP)
- Spring AI in Action
- Data-Oriented Programming: Reduce software complexity
- Knowledge Graphs and LLMs in Action
- Kafka for Architects
- Grokking Software ArchitectureIn early access (MEAP)
- Grokking AI Algorithms, Second Edition
- Build an AI Agent (From Scratch)
- Functional Programming in Scala, Second Edition
What to know first
- language modelA language model is a computational model that represents patterns in linguistic sequences to assign probabilities, predict, generate, or evaluate language.
- promptA prompt is text or other input supplied to an AI model to provide instructions, context, or other information that guides its response or generated output.
- machine learningMachine learning is a field of computational methods in which systems learn patterns or relationships from data to make predictions, decisions, or other outputs.
- JSONJSON is a language-independent text-based data-interchange format that represents structured values using objects, arrays, strings, numbers, booleans, and null.
Related concepts
- promptpart of · A prompt is text or other input supplied to an AI model to provide instructions, context, or other information that guides its response or generated output.
- business rulehas part · A business rule is a domain-specific constraint, policy, or decision criterion that governs valid data, behavior, decisions, or processes.
- context windowcontrasts with · A context window is a bounded span of sequence elements or contextual information that a model or processing operation can consider together.
- examplepart of · An example is a concrete instance that illustrates expected behavior, a possible outcome, or an input-output relationship.
- skill activationused by · The process of loading a skill's complete instructions and resource-location information into an LLM's context.
Questions about context
What is context?
Context is the relevant information, state, or circumstances surrounding an input, decision, or activity that influence its interpretation or behavior.
Which Manning books explain context?
Coding with AI, Software Testing with Generative AI, Authorization in Action, Inside AI, Effective Conversational AI, Data Storytelling with Altair and AI, Spec-Driven Development, AI for Everyday IT and 22 more.
What should I know before learning context?
Manning books that teach context usually introduce language model, prompt, machine learning and JSON first.
What is the difference between context and context window?
Context is the relevant information, state, or circumstances surrounding an input, decision, or activity that influence its interpretation or behavior. A context window is a bounded span of sequence elements or contextual information that a model or processing operation can consider together.
What is context part of?
Context is part of prompt. A prompt is text or other input supplied to an AI model to provide instructions, context, or other information that guides its response or generated output.
What are the parts of context?
Context includes business rule.
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.





























