QPillars LogoQPillars
SolutionsCase StudiesAboutBlogCareersContact
Book a Demo
Back to Blog
Engineering

Agentic AI for Lab Workflows - From Scripts to Autonomous Systems

March 31, 202615 min readIacob Marian

Agentic AI for Lab Workflows - From Scripts to Autonomous Systems

AI agents for laboratory automation are systems that reason about protocols, adapt to instrument state, and compose multi-step workflows without hardcoded scripts. Unlike traditional LIMS automation that executes a fixed sequence regardless of what happens, an AI agent laboratory system observes results, decides the next step, and handles exceptions - the way an experienced scientist does, but at machine speed. The global laboratory automation market reached an estimated $8.4 billion in 2025 and is projected to exceed $14 billion by 2034 (Precedence Research, 2025), yet roughly 61% of labs still rely on manual processes for at least some workflows (MLO, 2025). Agentic AI changes the equation.

This post covers the evolution from scripts to agents, the architecture patterns that make it work, and the safety mechanisms required to trust an AI with physical lab operations.

Key Takeaways

  • Script-based automation handles 80% of routine workflows but fails on exceptions - edge cases that scientists handle intuitively but scripts cannot anticipate
  • Agentic AI introduces reasoning, tool use, and adaptive decision-making to lab workflows - agents observe, plan, act, and learn from results
  • MCP (Model Context Protocol) provides the standardized tool interface that makes agents instrument-agnostic
  • Human-in-the-loop is not optional - safety-critical lab operations require approval gates, not full autonomy
  • The realistic path is hybrid: agents handle orchestration and adaptation, humans approve irreversible actions

Three Generations of Lab Automation

Laboratory automation has evolved through three distinct generations, each adding a layer of intelligence. Understanding where your lab sits on this spectrum determines what agentic AI can do for you today.

Diagram comparing three generations of lab automation - from rigid scripts to rule-based orchestration to AI agents with reasoning and tool use

The diagram above shows the progression from Generation 1 (fixed scripts that execute sequentially) through Generation 2 (rule-based orchestration with conditional branching) to Generation 3 (AI agents that reason about goals and compose actions dynamically). Each generation retains the capabilities of the previous one while adding a new layer of adaptability.

Generation 1 - Script-Based Automation

The workhorse of most labs today. A Python script or vendor macro executes a fixed sequence: aspirate from plate A, dispense to plate B, incubate for 30 minutes, read absorbance. The script runs identically every time. If the plate reader returns an error, the script either crashes or skips the step. If a well is empty, it aspirates air.

# Generation 1: rigid script - no awareness of instrument state
for well in plate.wells():
    liquid_handler.aspirate(well, volume_ul=50)
    liquid_handler.dispense(target_plate[well], volume_ul=50)
incubator.run(minutes=30)
results = plate_reader.read_absorbance(wavelength_nm=450)
save_to_lims(results)

This works for routine assays where conditions are predictable. It breaks the moment something unexpected happens - a reagent running low, a well with an air bubble, an instrument needing recalibration. Manual and script-based operations see error rates of 10-30%, compared to 1-5% for fully automated systems with adaptive error handling (SNS Insider, 2026).

Generation 2 - Rule-Based Orchestration

LIMS workflow engines and schedulers like Hamilton VENUS, Beckman SAMI, or custom workflow engines add conditional logic. If the plate reader returns an error, retry. If a well OD exceeds a threshold, flag it. Rules handle known exceptions.

# Generation 2: rule-based - handles known exceptions
for well in plate.wells():
    volume = liquid_handler.detect_volume(well)
    if volume < 50:
        logger.warn(f"Insufficient volume in {well}, skipping")
        continue
    liquid_handler.aspirate(well, volume_ul=50)
    liquid_handler.dispense(target_plate[well], volume_ul=50)

incubator.run(minutes=30)
results = plate_reader.read_absorbance(wavelength_nm=450)

for well, od in results.items():
    if od > 3.0:
        flag_for_review(well, reason="OD out of range")

Better, but still brittle. Every exception must be anticipated and coded. When a scientist encounters a novel situation - the OD pattern suggests contamination, a reagent lot has different viscosity, the protocol needs adjustment based on upstream results - no rule covers it. The scientist intervenes manually, which defeats the purpose of automation.

Generation 3 - AI Agents with Tool Use

An AI agent receives a goal ("run the ELISA assay on plate 7, optimize for sensitivity"), discovers available instruments via MCP, reasons about the protocol, and composes a workflow dynamically. When something unexpected happens, the agent reasons about what to do - just like a scientist would.

# Generation 3: AI agent - reasons about goals, adapts to state
agent_prompt = """
Run an ELISA assay on plate 7.
Goal: maximize sensitivity for low-abundance analytes.
Available instruments: liquid_handler, incubator, plate_reader.
Constraints: use standard curve from plate 6 results.
Approval required for: any volume > 200uL, incubation > 60min.
"""

# The agent:
# 1. Discovers instrument capabilities via MCP tools/list
# 2. Checks plate 7 current state (volume, temperature)
# 3. Plans the workflow based on the goal
# 4. Executes step-by-step, observing results
# 5. Adapts if results deviate from expected ranges
# 6. Requests human approval for high-risk actions

The critical difference: the agent does not follow a fixed path. It has a goal, tools, and constraints. It plans, executes, observes, and adapts. This is what "agentic" means in a lab context.

What Makes a Lab AI Agent "Agentic"

The term "agentic AI" gets thrown around loosely. In a laboratory context, an AI system is agentic when it has four specific capabilities working together.

1. Tool Use - Interacting with Physical Instruments

The agent can discover and call tools that control lab instruments. With MCP as the integration layer, the agent connects to any instrument that has an MCP server - liquid handlers, plate readers, incubators, centrifuges - without custom integration code per instrument.

2. Reasoning - Planning Multi-Step Protocols

Given a high-level goal, the agent breaks it down into steps, considers dependencies (you cannot read a plate before dispensing reagents), and determines the optimal sequence. This uses the ReAct (Reasoning + Acting) pattern first described by Yao et al. in 2022, where the model alternates between thinking about what to do and taking actions.

3. Observation - Reading Instrument State and Results

After each action, the agent observes the result. Did the aspiration succeed? What OD values came back? Is the incubator at the target temperature? These observations feed back into the reasoning loop, allowing the agent to adjust subsequent steps.

4. Adaptation - Handling the Unexpected

When results deviate from expectations - an OD reading that suggests contamination, a volume check that shows a reagent is running low, an instrument reporting a calibration warning - the agent reasons about what to do. Retry? Skip? Alert a human? Adjust parameters? This is where agents fundamentally differ from scripts.

Architecture Patterns for Lab Agents

Building an AI agent for laboratory workflows requires choosing the right architecture pattern. Here are three approaches, ordered from simplest to most complex.

Pattern 1 - Single Agent with MCP Tools

The simplest pattern. One LLM agent connects to multiple MCP servers, each wrapping a lab instrument. The agent plans and executes the entire workflow.

Architecture diagram showing a single AI agent connected to multiple MCP instrument servers with a human approval gate

The single-agent pattern works well for workflows involving 2-5 instruments where one LLM can hold the full context. The agent discovers available tools via MCP, plans the protocol, and executes step by step. A human approval gate intercepts safety-critical actions before they reach hardware.

import Anthropic from "@anthropic-ai/sdk";
import { Client } from "@modelcontextprotocol/sdk/client/index.js";

const anthropic = new Anthropic();

// Connect to instrument MCP servers
const liquidHandler = new Client({ name: "liquid-handler-client" });
const plateReader = new Client({ name: "plate-reader-client" });

// Discover available tools from all instruments
const tools = [
  ...(await liquidHandler.listTools()).tools,
  ...(await plateReader.listTools()).tools,
];

// Agent loop: reason, act, observe, repeat
const messages = [
  { role: "user", content: "Run ELISA on plate 7, optimize for sensitivity" }
];

while (true) {
  const response = await anthropic.messages.create({
    model: "claude-sonnet-4-6",
    max_tokens: 4096,
    system: SYSTEM_PROMPT,
    tools: tools.map(convertMcpToolToAnthropicTool),
    messages,
  });

  if (response.stop_reason === "end_turn") break;

  // Execute tool calls against the appropriate MCP server
  for (const block of response.content) {
    if (block.type === "tool_use") {
      const result = await routeToolCall(block, { liquidHandler, plateReader });
      messages.push({ role: "tool", content: result });
    }
  }
}

Best for: Single-protocol workflows, small instrument sets, rapid prototyping.

Pattern 2 - Multi-Agent Orchestration (CrewAI / LangGraph)

For complex workflows spanning many instruments, a single agent's context window becomes a bottleneck. Multi-agent systems assign specialized agents to different roles - a protocol planner, an instrument controller, a quality checker - coordinated by an orchestrator.

CrewAI (44k GitHub stars, adopted by 60%+ of Fortune 500 companies) provides a framework for defining agent teams with roles, goals, and tool access. Each agent specializes in a subset of the workflow:

from crewai import Agent, Task, Crew

protocol_planner = Agent(
    role="Protocol Planner",
    goal="Design optimal assay protocols based on experimental goals",
    tools=[literature_search, protocol_database],
    llm="claude-sonnet-4-6",
)

instrument_operator = Agent(
    role="Instrument Operator",
    goal="Execute protocol steps on lab instruments safely",
    tools=[liquid_handler_mcp, plate_reader_mcp, incubator_mcp],
    llm="claude-sonnet-4-6",
)

qc_analyst = Agent(
    role="QC Analyst",
    goal="Validate results against acceptance criteria and flag anomalies",
    tools=[statistics_tools, lims_connector],
    llm="claude-sonnet-4-6",
)

crew = Crew(
    agents=[protocol_planner, instrument_operator, qc_analyst],
    tasks=[plan_task, execute_task, validate_task],
    process="sequential",  # or "hierarchical" with a manager agent
)

LangGraph (part of the 126k-star LangChain ecosystem) takes a different approach - modeling the workflow as a stateful directed graph where each node is an agent or function, and edges represent transitions based on the current state. This gives fine-grained control over execution flow that role-based frameworks like CrewAI abstract away.

Best for: Multi-protocol workflows, complex QC requirements, teams with diverse instrument fleets.

Pattern 3 - Custom Agent Loop with MCP and Safety Gates

For production lab environments where reliability and auditability matter more than framework flexibility, a custom agent loop gives full control over the execution cycle. This is what we build at QPillars.

class LabAgent:
    def __init__(self, instruments: list[McpClient], safety_config: SafetyConfig):
        self.instruments = {i.name: i for i in instruments}
        self.safety = safety_config
        self.audit_log = AuditLog()

    async def execute_protocol(self, goal: str) -> ProtocolResult:
        plan = await self.plan(goal)
        self.audit_log.record("plan_created", plan)

        for step in plan.steps:
            # Safety gate: check if action requires approval
            if self.safety.requires_approval(step):
                approval = await self.request_human_approval(step)
                if not approval.granted:
                    self.audit_log.record("step_rejected", step)
                    return ProtocolResult(status="halted", reason=approval.reason)

            # Execute via MCP
            result = await self.instruments[step.instrument].call_tool(
                step.tool_name, step.arguments
            )
            self.audit_log.record("step_executed", step, result)

            # Observe and adapt
            if self.is_anomalous(result, step.expected):
                adapted_plan = await self.replan(goal, plan, step, result)
                plan = adapted_plan
                self.audit_log.record("plan_adapted", adapted_plan)

        return ProtocolResult(status="completed", audit=self.audit_log)

Best for: GxP-regulated environments, clinical labs, any workflow where auditability is non-negotiable.

Safety - The Non-Negotiable Layer

Giving an AI agent control over physical instruments is fundamentally different from giving it access to APIs or databases. A misplaced decimal in a dispense volume can waste expensive reagents. A wrong temperature setpoint can destroy biological samples worth months of work. Safety is not a feature - it is the foundation.

The Approval Hierarchy

Not all lab actions carry equal risk. A well-designed agent system classifies actions by risk level and applies appropriate controls:

Risk LevelExamplesControl
LowRead temperature, check status, query LIMSFully autonomous
MediumAspirate/dispense within validated ranges, start standard incubationLog and proceed
HighVolumes > protocol maximum, non-standard temperatures, new reagent lotsHuman approval required
CriticalInstrument calibration, protocol deviation, discard samplesHuman approval + supervisor sign-off

This hierarchy maps directly to MCP tool definitions. Each tool's schema can encode safety boundaries - volume limits, temperature ranges, approved reagent lists - and the agent's safety layer enforces them before any tool call reaches hardware.

Digital Twin Validation

Before an agent runs a protocol on physical instruments, run it on a digital twin. The twin exposes the same MCP interface as the real instrument but executes in simulation. The agent cannot tell the difference. If the protocol completes successfully on the twin - volumes balance, timing works, no constraint violations - it is cleared for physical execution.

This is not theoretical. Our LiquidBridge platform uses exactly this pattern: agents develop and test protocols against a digital twin of the liquid handler, then execute on real hardware only after validation passes.

Audit Trail

Every action an agent takes must be logged with full context: what was the goal, what did the agent plan, what tool call was made, what arguments were sent, what result came back, and whether the result was within expected bounds. In regulated environments (GxP, 21 CFR Part 11), this audit trail is not just best practice - it is a legal requirement.

The Realistic Path to Autonomous Labs

Full laboratory autonomy - where AI agents run entire experiments without human involvement - is not happening tomorrow. But the path forward is clear, and each step delivers real value.

Phase 1 - Assisted (where most labs should start) AI agents suggest next steps based on results. Scientists approve and execute. The agent learns from the feedback loop. This is deployable today with existing LLMs and MCP infrastructure.

Phase 2 - Supervised Agents execute routine protocols autonomously. Humans monitor dashboards and approve non-routine decisions. Exception handling is automated for known patterns, escalated for novel situations.

Phase 3 - Autonomous (specific workflows only) Fully autonomous execution for validated, well-characterized workflows - routine QC assays, standard sample prep, repetitive screening runs. Novel experiments and method development remain human-driven.

Self-driving labs have already proven autonomous execution works for specific, well-bounded workflows. Berkeley Lab's A-Lab autonomously synthesized 41 of 58 predicted inorganic materials over 17 days of continuous operation - a 71% success rate with minimal human intervention (Nature, 2023). Emerald Cloud Lab enables fully remote experiment design and execution across hundreds of instruments. The challenge is generalizing beyond well-characterized workflows - and that is where agentic AI with tool use and reasoning capabilities changes the game.

On the regulatory side, the FDA issued draft guidance in January 2025 applying a Total Product Life Cycle approach to AI-enabled device software, requiring model documentation, performance metrics, and human-AI workflow specifications. NIST launched a dedicated AI Agent Standards Initiative in February 2026, focusing on ensuring autonomous agents are secure, interoperable, and trustworthy. The regulatory landscape is catching up to the technology - which means building safety-first architectures now is not just good engineering, it is future-proofing.

How QPillars Approaches This

We build the infrastructure that makes lab agents possible:

  1. MCP servers for instruments - Every instrument in the lab gets an MCP interface. The agent speaks one protocol, controls any instrument.
  2. Digital twin validation - Agents test protocols on LiquidBridge before touching real hardware. Same MCP interface, simulated execution.
  3. Safety-first architecture - Approval gates, parameter validation, and full audit trails are built into the agent loop, not bolted on after.
  4. Rust for the critical path - Instrument control code that runs below MCP is written in Rust for memory safety and real-time guarantees.

The future of lab automation is not scripts that run blindly. It is agents that reason about what they are doing - and know when to ask for help.

Frequently Asked Questions

What is an AI agent in a laboratory context?

An AI agent for laboratory workflows is a system that receives a high-level experimental goal, discovers available instruments via standardized protocols like MCP, plans multi-step protocols, executes them by calling instrument tools, observes results, and adapts its approach when conditions deviate from expectations. Unlike scripts, agents reason about what to do rather than following a fixed sequence.

Is it safe to let AI control lab instruments?

Safety requires a layered approach: parameter validation in tool schemas (preventing out-of-range commands), human approval gates for high-risk actions, digital twin validation before physical execution, and comprehensive audit trails. No responsible implementation gives an agent unrestricted access to hardware. The safety architecture is what makes autonomous operation possible for routine workflows while keeping humans in the loop for novel or high-risk situations.

How does agentic AI differ from traditional LIMS automation?

Traditional LIMS automation executes predefined workflows - fixed sequences of steps with conditional branches for known exceptions. Agentic AI receives goals and composes workflows dynamically, adapting to instrument state, intermediate results, and unexpected conditions. LIMS automation answers "execute this sequence." Agentic AI answers "achieve this goal, figure out the steps."

What frameworks are available for building lab AI agents?

CrewAI and LangGraph are the most mature multi-agent frameworks. CrewAI provides role-based agent teams with built-in coordination. LangGraph models workflows as state machines with agent nodes. For production lab environments, custom agent loops with direct MCP integration often provide better control over safety, auditability, and error handling than general-purpose frameworks.

Can AI agents work with existing lab instruments?

Yes - through MCP (Model Context Protocol). An MCP server wraps whatever interface the instrument already has (serial, TCP, REST, vendor SDK) and exposes it as standardized tools that any AI agent can discover and use. Adding a new instrument means deploying one MCP server. The agent side requires no changes.

Iacob Marian

Technical Lead & Co-founder at QPillars

Iacob builds intelligent software infrastructure for life sciences laboratories, with a focus on Rust for instrument control and agentic AI for lab automation.

Full profileLinkedInPublished March 31, 2026
AI agent laboratorylab automationagentic AIMCPCrewAIlaboratory workflows

Related Articles

Engineering

How to Connect AI Agents to Lab Instruments with MCP

Mar 21, 2026

Engineering

Why Rust Is the Future of Laboratory Instrument Control

Mar 18, 2026

Engineering

The Future of AI-Powered Instrument Control

Mar 1, 2026

QPillars LogoQPillars

Intelligent software for scientific instruments

Solutions

  • AI for Instruments
  • Systems Engineering
  • LiquidBridge

Company

  • About
  • Case Studies
  • Blog
  • Careers
  • Contact

Offices

Zurich, Switzerland

Chisinau, Moldova

© 2024-2026 QPillars GmbH. All rights reserved.

info@qpillars.com+41 78 262 97 97