Menu
InfoQ Architecture·September 30, 2026

Context as Code: Managing AI Agent Context in Software Development

This article discusses the concept of "Context as Code" in the era of AI-native development, proposing that context for AI agents should be managed with the same rigor as traditional code. It covers the full lifecycle of context, from generation and evaluation (testing) to distribution and observation, applying software engineering principles like CI/CD, testing, and security scanning to ensure reliability and scalability of AI-driven systems. The core idea is to treat the inputs, configurations, and knowledge provided to AI agents as critical artifacts that require systematic management.

Read original on InfoQ Architecture

The "Context as Code" Paradigm

The presentation introduces the idea that the "context" provided to AI agents (e.g., prompts, specifications, documentation, code snippets, architectural guidelines) should be treated with the same engineering discipline as traditional software code. This paradigm aims to bring reliability, scalability, and maintainability to AI-driven development by applying established practices like version control, testing, continuous integration/delivery (CI/CD), and security scanning to context artifacts. It suggests moving beyond ad-hoc prompting to a structured "Context Development Life Cycle" that mirrors the Software Development Life Cycle (SDLC).

Context Development Life Cycle (CDLC)

The CDLC is an adaptation of the traditional SDLC, emphasizing a continuous loop of generating, evaluating, distributing, and observing context. This cycle ensures that the context provided to AI agents is effective, up-to-date, and aligned with system requirements.

  1. Generate: Creating and curating context artifacts such as AGENTS.md, skill definitions, API specifications, product requirements, and existing code/documentation. The focus shifts from humans as sole context generators to curating and standardizing context for AI consumption.
  2. Evaluate: Rigorously testing context quality. This includes linting structured context (e.g., YAML), using LLMs as judges for writing style and effectiveness, and functional testing of skills/tasks using benchmarks like SWE-bench. End-to-end testing within a codebase is crucial to validate context effectiveness in real-world scenarios.
  3. Distribute: Making context available to teams and AI agents in a controlled manner, similar to package management for code. This ensures consistency and proper versioning.
  4. Observe: Monitoring the performance and impact of distributed context in production, gathering feedback to iterate and improve.

Key Engineering Practices Applied to Context

The article highlights several analogies between traditional software engineering and "context engineering":

  • Version Control: Storing context artifacts (like AGENTS.md or task specifications) in version control systems to track changes, collaborate, and revert if necessary.
  • Testing & Benchmarking: Developing test suites for context, similar to unit and integration tests for code. This includes linting, LLM-as-a-judge for qualitative feedback, functional tests against specific tasks, and even end-to-end tests within a codebase to ensure AI agent behavior aligns with expectations.
  • CI/CD for Context: Automating the evaluation, packaging, and deployment of context changes. This allows for rapid iteration and ensures that only validated context reaches production AI agents.
  • Feedback Loops: Establishing mechanisms to observe how AI agents interpret and use context, and using this feedback to refine and optimize context definitions, similar to how monitoring and logging inform code improvements.
💡

Architectural Implications

Treating context as a first-class artifact with a dedicated lifecycle implies the need for infrastructure and tooling to support its management. This could involve specialized context repositories, testing frameworks for AI agent prompts, and CI/CD pipelines designed for context deployment. Architects must consider how to integrate these "context engineering" workflows into existing DevOps practices and how to ensure the security and governance of context data, especially for sensitive instructions or proprietary information given to AI models.

AI-native developmentcontext engineeringDevOpsLLMssoftware architectureCI/CDtestingknowledge management

Comments

Loading comments...