Linear’s blog post on how they built their AI agent opens with a line that should be tattooed on every CSV engineer’s monitor: “Instead of engineering a fixed path for the agent, define the boundaries within which it can find its own path.”
At first glance, this seems antithetical to Computer System Validation. CSV exists to shrink possible outcomes. Every test script, every requirement trace, every IQ/OQ/PQ protocol is a bet on determinism. You write the path. The system follows it. Auditors verify it.
But here’s the thing: Linear’s problem and the CSV problem are structurally identical.
Linear: How do you give an agent freedom to improvise in a complex product without it doing something destructive?
CSV: How do you give an agent freedom to improvise in a GxP-regulated process without breaking data integrity, traceability, and auditability?
The difference is the blast radius. Linear’s worst case is a mis-filed issue. CSV’s worst case is a deviation record that feeds a CAPA that a regulator can pull. Same architecture. Higher stakes.
The Core Paradox: Probabilistic Intelligence Inside Deterministic Boundaries
Traditional CSV tries to predict every possible path through a system. You write test scripts that say “enter this value, expect this result, pass or fail.” The system is a puppet; the validation is the strings.
AI breaks this model. An LLM doesn’t follow a fixed path — it reasons, adapts, and occasionally improvises. That’s exactly what makes it useful for the tedious, repetitive, rule-heavy work of validation: drafting test scripts, cross-referencing traceability matrices, analyzing audit trails, flagging gaps in validation packages.
But it’s also exactly what makes it terrifying from a compliance perspective. An agent that “decides to improvise” is a non-conformance waiting to happen.
Linear’s answer resolves the paradox: don’t try to make the model deterministic. Make the environment deterministic. The model can be probabilistic. The boundary cannot be.
This maps to three architectural layers:
┌─────────────────────────────────────┐
│ AI reasoning space │
│ Agent can explore, reason, plan │
└──────────────────┬──────────────────┘
│
▼
┌─────────────────────────────────────┐
│ Controlled action space │
│ Constrained tools, skills, RBAC │
└──────────────────┬──────────────────┘
│
▼
┌─────────────────────────────────────┐
│ GxP assurance boundary │
│ Audit trails, e-signatures, │
│ evidence, immutable records │
└─────────────────────────────────────┘
The agent improvises inside the top layer. The middle layer enforces what it can actually do. The bottom layer ensures everything is traceable, attributable, and defensible.
Decision 1: The System Prompt Becomes the GxP Policy Engine
Linear focused their system prompt on four things: communication style, hard boundaries, product taxonomy, and default opinions. For CSV, each becomes a compliance control.
Communication Style → Audit-Ready Language
Linear says “adapt tone to surface.” For CSV, this means:
- In Slack with devs: Concise, technical. “The OQ for Module 3 has 2 open deviations.”
- In a Validation Summary Report: Formal, ALCOA+ compliant, citation-backed. No hallucinated regulatory references. No casual language. No summarizing away a risk.
- During an audit: Inspection-defensible. Every statement traceable to evidence.
Hard Boundaries → Regulatory Non-Negotiables
Linear’s boundaries are behavioral (no politics, no jokes). CSV boundaries are existential:
- Never fabricate objective evidence. If the agent didn’t run a test, read a log, or see a screenshot, it must say so. This is the ALCOA+ “Original” and “Accurate” principle in action.
- Never auto-approve, auto-execute in PROD, or auto-close a deviation/CAPA. Every regulated action requires a human e-signature under 21 CFR Part 11.
- Never expand validation scope without confirmation. “Validate this LIMS patch” does not mean “re-validate the entire LIMS.” Scope creep in validation is a regulatory finding.
- Never offer opinions outside CSV scope. The agent is not a clinical advisor, a regulatory strategist, or a quality philosopher. It validates systems.
- ALCOA+ is non-negotiable. Attributable, Legible, Contemporaneous, Original, Accurate — plus Complete, Consistent, Enduring, Available. Every output must satisfy all nine principles.
Domain Taxonomy → The Agent’s Model of CSV
Base LLMs do not inherently understand GAMP 5 software categories, the V-Model lifecycle, or the difference between an IQ and an OQ at a structural level. You must teach them.
The agent needs to know:
- What GAMP Categories 1-5 mean and how they drive validation effort
- The V-Model: Planning → Requirements → Specifications → Testing → Reporting
- The distinction between a deviation (something went wrong) and a CAPA (systemic corrective action)
- How 21 CFR Part 11 applies to electronic records versus electronic signatures
- What “predicate rule” means in context
This is not dictionary-definition knowledge. It’s operational knowledge — what these concepts mean in your QMS, with your SOPs, for your systems.
Default Opinions → Strong Validation Priors
Linear’s agent has strong defaults for how to use features. A CSV agent needs strong defaults for validation decisions:
- If GxP impact = Yes → require the full chain: URS → FS → Risk Assessment → Traceability Matrix → IQ/OQ/PQ → Summary Report
- If GAMP Category 3 (COTS, non-configured) → lean validation, leverage vendor documentation
- If GAMP Category 4/5 (configured/custom) → full lifecycle validation
- When a requirement is vague (“The system should be fast”) → flag as untestable, request a quantifiable metric
- When in doubt → ask, don’t assume. This applies especially to anything touching Part 11, Annex 11, e-signatures, audit trails, data retention, or access control
Decision 2: Constrained Tools Make Invalid Actions Structurally Impossible
This is Linear’s most transferable insight. Their line — “We found it more effective to encode constraints into the design of Linear Agent’s tools than to spell them out in a prompt” — is the foundation of CSV agent engineering.
Prompt-level constraints are advisory. Tool-level constraints are enforceable. An LLM can be jailbroken through clever phrasing. A tool schema cannot.
The Bad Way
Give the agent a generic update_document() tool and tell it in the prompt: “Never modify an approved document.”
This will fail. Maybe not today. Maybe not tomorrow. But eventually, a sufficiently creative prompt will get the agent to call update_document() on an approved protocol.
The Good Way
Design the tool so it’s structurally impossible:
update_working_document(document_id, changes)
→ Enforces: document.status == DRAFT
→ Enforces: user.has_edit_permission
→ Enforces: agent_scope.includes(document)
→ Otherwise: DENY
The model doesn’t need to “remember” the rule. The tool enforces the rule.
Building GxP-Native Tools
Instead of exposing generic CRUD APIs to your QMS or document management system, build semantic tools that map to validation operations:
Requirements:
create_user_requirement()— creates a requirement with mandatory fields (ID, description, GxP impact, priority)trace_requirement()— links a requirement to test cases, ensuring bidirectional traceabilityanalyze_requirement_completeness()— checks for missing acceptance criteria, untestable language, orphaned requirements
Risk Assessment:
assess_gxp_impact()— evaluates a system change against GxP criticality criteriagenerate_risk_assessment()— produces an FMEA-style risk matrix with severity, probability, and detectability scorescalculate_risk_score()— computes composite risk from the three factors
Validation Protocol:
create_test_protocol(requirement_ids, risk_ids, protocol_type)— cannot create a test without linked requirements. Traceability is enforced by tool design.generate_test_case()— pulls from a locked template library, rejects free-form text in regulated fieldsexecute_test_step()— requires preconditions, actual results, and evidence references
Evidence:
add_validation_evidence(test_run_id, evidence_type, source_system, hash)— enforces attributable evidence with provenanceverify_evidence_provenance()— checks that evidence is original, timestamped, and unmodified
Deviations:
create_deviation(observed_vs_expected, linked_test_id)— cannot be created without a linked test caseclassify_deviation()— maps to CAPA severity levels per your SOPlink_deviation_to_test()— ensures no orphaned deviation records
Change Control:
assess_change_impact()— analyzes a proposed change against the current validation stateidentify_affected_validations()— pulls all validation deliverables linked to the changed component
Each tool encodes compliance constraints in its schema. As models get smarter, they orchestrate these tools better. You don’t have to rewrite the prompt.
Decision 3: System Skills Become Modular Validation Capabilities
Linear bundles tools, metadata, and prompt fragments into “system skills” that load dynamically based on context. For CSV, this maps directly to validation domain areas.
Why This Matters for CSV
Validation documentation is massive. A single LIMS validation package might include a 200-page URS, a 500-page Functional Design Specification, 50 test protocols, and hundreds of evidence artifacts. Loading all of this into every agent run would blow the context window, increase hallucination risk, and confuse the agent with irrelevant information.
Progressive skill loading keeps the context focused on what the agent actually needs for the current task.
The Skill Registry
| Skill | Loaded When | What It Contains |
|---|---|---|
gamp5_risk_assessment |
New system assessment | Category definitions, risk-based approach rules, impact assessment methodology |
part11_compliance_check |
Electronic record/signature system | Audit trail requirements, e-signature specs, access control checks |
alcoa_data_integrity |
Any data-related task | ALCOA+ principles with concrete examples, data integrity gap detection |
requirements_mgmt |
Draft or review requirements | URS/FRS tools, traceability linking, requirement quality checks |
protocol_generation |
Create validation protocol | IQ/OQ/PQ templates, test script generators, prerequisite checkers |
test_execution |
Enter test execution mode | Test step runners, deviation auto-generation, evidence capture |
change_control |
System modification detected | Impact assessment, version comparison, revalidation triggers |
periodic_review |
System in production | Review scheduling, gap analysis, requalification logic |
deviation_mgmt |
Test deviation detected | CAPA SOPs, root cause analysis frameworks |
traceability_matrix |
Cross-referencing deliverables | Bidirectional traceability, orphan detection, coverage analysis |
Dynamic Loading in Practice
A user says: “Draft an OQ protocol for the new LIMS module.”
The agent loads requirements_mgmt and protocol_generation. Mid-task, it realizes it needs to check the system’s GAMP category. It dynamically loads gamp5_risk_assessment. Then it discovers recent deviations on the LIMS, so it loads deviation_mgmt to assess whether those affect the new protocol.
Each skill is a governed capability:
skill:
id: protocol-generation
version: 2.1.0
tools: [create_test_protocol, generate_test_case, check_prerequisites]
knowledge: [IQ_OQ_PQ_templates, company_SOP_VAL_001]
policies: [GXP-PROTOCOL-001, DATA-INTEGRITY-003]
risk_level: medium
approval:
required_for: [modifying_approved_protocols]
The Audit Bonus
Every skill load is logged. When an auditor asks “what context did the agent have when it generated this test protocol?”, you can produce the exact skill manifest: which skills were loaded, which versions, which tools were available, which knowledge was in scope. That’s your explanation of agent behavior.
Decision 4: Conditional Approval Becomes Risk-Based HITL
Linear’s approval logic is contextual: the agent can delete something it created this session without asking, but must confirm before deleting an existing issue. For CSV, this maps to the risk-based approach that GAMP 5 and ICH Q9 already mandate.
The Risk-Based Approval Matrix
Not every tool call needs human approval. Requiring approval for everything creates alert fatigue and slows down legitimate work. The key is contextual risk assessment:
Low Risk (Auto-Proceed):
- Querying audit logs
- Reading URS specs or existing validation documents
- Generating draft traceability matrices
- Checking links between requirements and test cases
- Drafting test protocols in a staging area
Medium Risk (Soft Approval):
- Writing or modifying draft validation deliverables
- Suggesting risk classifications
- Proposing test case additions
High Risk (Hard Approval Required):
- Transitioning a document state (Draft → In Review)
- Logging an official GxP deviation
- Triggering automated test suite execution against a validated environment
- Modifying an approved protocol in the QMS
Critical (Human Only, Always):
- Approving a validation deliverable (requires e-signature)
- Releasing a system to production
- Closing a CAPA
Never Agent-Controlled:
- Deleting audit evidence
- Executing electronic signatures
- Modifying signed records
Contextual Rules, Not Tool-Name Rules
The same action has different approval requirements based on context:
| Action | Context | Approval |
|---|---|---|
| Edit document | Draft created this session | No |
| Edit document | Approved in QMS | E-signature required |
| Post result | Internal Slack | No |
| Post result | Regulatory submission system | QA review required |
| Delete item | Ephemeral scratchpad | OK |
| Delete item | QMS record | Never |
The agent must output its risk classification reasoning before executing — not just the tool call, but why it classified the action as low, medium, or high risk.
Decision 5: The Custom Harness Becomes the GxP Compliance Layer
Linear built their own harness because off-the-shelf agent frameworks bake in opinions about the run loop that fight fine-grained control. For CSV, the justification is even stronger: off-the-shelf frameworks lack native support for audit logging, state snapshotting, and strict compliance controls.
What the Harness Must Provide
1. Immutable Audit Trail (Non-Negotiable)
Every action — every prompt, tool input, model output, user confirmation — must be logged to a WORM (Write Once, Read Many) compliant store. Model version, prompt version, input data hashes, output timestamps, skill manifests. 21 CFR Part 11 requires immutable, timestamped, user-attributed audit trails for electronic records.
2. Durable Workflow Engine
CSV tasks are long-running. Generating a comprehensive Validation Master Plan, analyzing thousands of audit trail entries, or executing a 200-step IQ protocol can take hours. The harness must:
- Suspend execution cleanly without resource leaks
- Persist state across runs
- Resume deterministically (same inputs → same outputs)
- Log every suspension and resumption with timestamps
Temporal is the consensus tool for this — it provides exactly the durable execution semantics CSV needs.
3. Contextual Approval Engine
Not a simple “tool name → approval required” lookup. A full evaluation of WHO, WHAT, WHY, WHICH document, WHICH version, CURRENT state, AUTHORIZED user, REQUIRED approval level, and EVIDENCE attached. The engine evaluates all of these before allowing or blocking a tool call.
4. Dynamic Skill Injection
Skills load on demand with their tools, metadata, and knowledge. The harness preserves prefix cache (cost control) while injecting new capabilities. Every skill load is logged with version and timestamp.
5. Asynchronous Sub-Agent Execution
A parent agent orchestrating a full system validation spawns specialized sub-agents — one for requirements review, one for risk assessment, one for test design, one for traceability analysis. The parent suspends while sub-agents work in parallel. All sub-agent actions are fully logged and linked to the parent run.
6. Provider-Agnostic Model Layer
Model updates trigger change control in regulated environments. The harness must abstract the model provider so you can swap models without revalidating the entire orchestration layer.
7. Model Change Control
A model update, prompt change, or retrieval corpus update is a change control event. The harness versions everything and triggers re-qualification when performance baselines shift.
The Compliance Backbone: Evidence as First-Class Output
This is the one architectural element that doesn’t appear in Linear’s blog but is non-negotiable for CSV.
For a normal agent:
User → Agent → Answer
For a CSV agent:
User → Agent → Reasoning → Evidence Collection → Decision → Human Review → Audit Record
Every important conclusion must carry its evidence chain:
{
"claim": "Requirement URS-042 is adequately tested",
"evidence": ["URS-042", "TEST-089", "EVIDENCE-234"],
"source_versions": ["URS v3.2", "Protocol v2.1"],
"agent_version": "traceability-agent v1.7.2",
"model_version": "model-x-2026-08-01",
"run_id": "RUN-12345",
"timestamp": "2026-08-10T10:30:00-07:00",
"human_review": "pending"
}
This transforms the agent from “AI that writes validation documents” into “AI that produces an auditable chain of evidence.” That’s a fundamentally different — and far more defensible — architecture.
What to AVOID
Don’t Give the Agent Raw Access
Never give a CSV agent:
- Direct SQL access to your QMS database
- Raw API access to Veeva Vault, MasterControl, or TrackWise
- Arbitrary file system write access
- Selenium/Cypress execution against production GxP systems
If the agent gets stuck, it must fail safely and ask a human — not attempt a speculative database UPDATE to force a test to pass.
Don’t Allow Autonomous Scope Expansion
If a user asks the agent to validate a LIMS patch and the agent notices unvalidated integration pipelines, it must ask for confirmation before expanding scope. Unanticipated scope expansion is a regulatory finding, not a feature.
Don’t Accept Hallucinated Evidence
The agent must never claim a test passed if it didn’t observe the execution. It must never cite a regulatory document it hasn’t read. It must never fabricate a statistic, a date, or a source. If it can’t verify, it must say so.
Don’t Skip the Refusal
An agent that occasionally says “I cannot safely complete this validation task because the current System Classification and Risk Assessment are missing” is a feature, not a bug. In life sciences, a refusal is always better than a speculative action.
Validating the Agent Itself
Per GAMP 5 and FDA’s AI guidance, your CSV agent is GAMP Category 5 software. It needs:
- URS for the agent — what it’s authorized to do, what it must never do
- Risk assessment for agent failure modes — hallucinated requirements, missed Part 11 checks, scope creep, false confidence
- Test protocols for hard boundaries — verify the agent cannot auto-approve, cannot fabricate evidence, cannot expand scope without confirmation
- Periodic review of thread logs — ongoing monitoring of agent behavior as audit trail
If the agent is built with shallow, constrained tools and skill-based progressive disclosure, this validation is tractable. The tool schemas themselves become testable assertions: “Can the agent call create_test_protocol() without linked requirement IDs? No — the schema rejects it. Test passed.”
If the agent is given raw Python and QMS API access, it’s unvalidatable. The action space is too large, the failure modes too numerous, the test surface too broad.
The Bottom Line
Linear’s blog concludes: “Each decision is a bet on where the line between possibility and predictability sits.”
For life sciences, that line is drawn in ink by the FDA and EMA. But the mechanisms Linear built to control that line — constrained tools, progressive skill loading, contextual approval, a custom harness — are exactly the mechanisms that make AI agents viable in regulated environments.
The five architectural decisions, translated:
| Linear Decision | CSV Translation |
|---|---|
| System prompt as boundaries | GxP policy engine with regulatory hard boundaries |
| Constrained tool design | Tools that make invalid CSV actions structurally impossible |
| System skills | Modular validation capabilities with progressive loading |
| Conditional approval | Risk-based HITL matching GAMP 5 / ICH Q9 |
| Custom harness | GxP compliance layer with immutable audit trails |
The agent reasons flexibly. The environment enforces compliance deterministically. That’s not a compromise — it’s the architecture that makes AI safe enough to use where it matters most: the systems that produce the drugs, devices, and therapies that patients depend on.
Research notes: [[linear-agent-architecture-csv-ai-agents]]
Saram Consulting