AI for Science: Agent-Driven Reconstruction of the Research Workflow

    This article explains how general-purpose large language models are moving from one-shot Q&A assistance to stateful, multi-step execution inside research workflows. It presents a five-layer reference architecture, a context engineering approach that separates task, data, and domain context, and a tool orchestration pattern built on machine-readable contracts and plan-execute-verify loops. It also covers reproducibility and trust requirements, a three-tier evaluation system, a phased adoption path, and common pitfalls, with guidance on pushing deterministic computation down to tools, keeping decisions with the model, and leaving explanation and approval to humans.

    1. From Q&A Assistance to Owning the Workflow: The Capability Leap of Research Agents

    Over the past two years, general-purpose large models in research settings have mostly served as Q&A assistants: explaining concepts, polishing drafts, and generating code snippets. A newer practice is now emerging — placing the model inside the analysis pipeline itself and having it handle a continuous chain of steps: understanding the research question, writing analysis code, calling specialized tools, and explaining intermediate results. The essence of this shift is not that models have become “smarter,” but that the engineering paradigm has moved from single-turn generation to stateful, multi-step execution.

    Three general capabilities underpin this leap. First, long context, which allows papers, data dictionaries, and experiment logs to enter the model’s view in their entirety. Second, structured output and function calling, which let the model issue tool requests in a parseable format. Third, reasonably stable multi-step reasoning, which allows a task to be decomposed into verifiable sub-steps. It is worth stressing that these are general capabilities widely available across the industry; the actual ceiling depends on the specific model choice and engineering implementation, and no fixed numbers should be assumed in advance.

    2. Reference Architecture: A Five-Layer Breakdown

    A research agent that can actually be deployed is usually broken into five layers:

    1. Interaction and task definition layer: translates natural-language research intent into a structured task sheet, specifying input data, target metrics, constraints, and deliverables.
    2. Context and knowledge layer: manages papers, metadata, data dictionaries, and historical experiment records, and provides retrieval and citation location.
    3. Planning and execution layer: handles task decomposition, step scheduling, retry on failure, and fallback strategies.
    4. Tool and compute layer: exposes statistical modeling, visualization, sequence and structure processing, and domain-specific solvers as services or command-line tools.
    5. Audit and reproducibility layer: records the input and output of every step, random seeds, and dependency versions, and produces a reproducible experiment package.

    The key design principle across these five layers is “push capabilities down, pull decisions up”: deterministic computation goes to tools, uncertain judgment goes to the model, and the final right of explanation stays with the human.

    3. Context Engineering: The First-Order Problem in Research Scenarios

    Most failures in research tasks are not caused by insufficient reasoning ability but by the wrong context being supplied. In practice, it helps to split context into three types and govern each separately:

    • Task context: the research question, hypotheses, evaluation metrics, and acceptance criteria;
    • Data context: field meanings, units, missing-value rates, dimensions, and sampling frequency;
    • Domain context: applicability conditions of methods, common pitfalls, and terminology definitions.

    A schematic task sheet structure looks like this (field names are examples only and do not represent any product interface):

    1. {
    2. "question": "Assess whether processing time has a significant effect on yield",
    3. "dataset": {"path": "sandbox://exp_2024_07", "unit_policy": "SI"},
    4. "metric": {"name": "effect_size", "ci": 0.95},
    5. "constraints": ["Raw data must not be shared externally", "Random seed fixed at 42"],
    6. "deliverables": ["Statistical test report", "Reproducible script", "Charts"]
    7. }

    When the context grows too long, use layered retrieval: first filter coarsely by metadata, then load fragments on demand, and explicitly mark citation sources in the prompt so the model does not “answer from impression.”

    4. Tool Orchestration: Making the Model “Use Its Hands” Instead of “Imagine”

    The reliability of tool calls depends on three things: clear descriptions, constrained parameters, and parseable returns. It is advisable to define a machine-readable contract for each tool and to validate parameters with enumerations and range checks:

    1. # Illustrative code: tool contract and validation (platform-agnostic)
    2. def run_regression(data_uri: str, y: str, xs: list[str],
    3. seed: int = 42) -> dict:
    4. assert data_uri.startswith("sandbox://"), "Sandbox data only"
    5. assert 0 <= seed <= 2**32 - 1
    6. # Actual computation is done by deterministic tools; the model only orchestrates
    7. return {"coef": [], "pvalues": [], "seed": seed}

    For orchestration, a three-stage “plan-execute-verify” pattern is recommended: the model first produces a step plan, the executor calls tools step by step, and a verifier then checks whether value ranges, sample sizes, and assumption conditions are satisfied. If they are not, the flow falls back to the previous step and retries with the error message attached. High-risk operations (deleting data, sending results externally) should be gated behind human confirmation.

    5. Reproducibility and Trust: The Non-Negotiable Baseline in Research

    The more automation you add, the more you need a trace. The minimum viable reproducibility elements include an input data snapshot identifier, a dependency and version manifest, random seeds, the command and a return summary for each step, and a hash of the final artifacts. On the engineering side, you can use object storage to keep snapshots, a message queue to decouple long-running tasks, a container platform to freeze the runtime environment, and logging services with monitoring and alerting to track failure rates and latency distributions. These are all general cloud product categories; when selecting among them, prioritize auditability and rollback capability.

    Trust also has to answer “on what basis should this be believed.” A workable approach is to require the model to provide an evidence chain for every conclusion: cite the specific field or passage in the literature, and mark the sources of uncertainty. If the evidence is insufficient, the model should output “cannot determine” rather than forcing a conclusion.

    6. Evaluation: How to Prove It Actually Works

    A three-tier evaluation is recommended:

    • Task tier: end-to-end completion rate, deliverable pass rate, and human rework time;
    • Process tier: step validity rate, tool call success rate, number of fallbacks, and average chain length;
    • Safety tier: interception rate of unauthorized access, number of sensitive data leakage incidents, and proportion of non-reproducible experiments.

    The evaluation set should cover four scenario types: clean data, dirty data, conflicting evidence, and tool failure, and a human baseline should be kept for comparison. Only when process metrics and outcome metrics improve together can you conclude that the agent has genuinely entered the workflow rather than creating new rework.

    7. Adoption Roadmap and Common Pitfalls

    A three-phase rollout is recommended: start with read-only analysis (no changes to raw data), then a closed loop inside a sandbox (writes allowed to temporary space), and finally connect to real experiment systems while keeping human approval. There are four common pitfalls. First, handing deterministic computation to the model for “mental math,” which causes numerical drift. Second, piling up context without citations, which amplifies hallucination. Third, unstable tool return formats, which break the chain frequently. Fourth, evaluating only outcomes and not the process, which hides problems.

    8. Conclusion

    The value of connecting research agents to general-purpose large models lies not in replacing researchers but in standardizing repetitive, error-prone parts of the workflow. Three engineering points are enough to move forward steadily: push capabilities down to tools, pull decisions up to the model, and leave explanation and approval to humans. If you need to carry snapshots, long-running tasks, and environment freezing, you can build an auditable foundation on general capabilities such as object storage, message queues, container platforms, and logging and monitoring from Baidu AI Cloud, so that automated analysis is both efficient and trustworthy.