AWS Builder Center
From Literature to Experiments: An AI Researcher on AWS

From Literature to Experiments: An AI Researcher on AWS

Autonomous AI Researcher on AWS: give it a research problem and it loops hypothesize → run experiment on GPU → learn → repeat, using Claude Code on Amazon Bedrock, with a compounding LLM Wiki and a web dashboard. Deployed with AWS CDK.

Senior Applied Scientist @ AWS Prototyping
Many of the problems engineers and scientists care about have no known optimal solution. There is no table you can look up to find the best feature set for your machine learning model, the best heuristic for your vehicle-routing problem, or the best controller for your plant. What you usually have instead is three things: a space of possible candidates that is far too large to enumerate, a way to compute a score for any single candidate, and a body of scientific literature that offers hints about where good candidates might be found.
Today, an expert works through that space by hand. They read a paper, try an idea inspired by it, measure the result, adjust, and repeat. This loop works, but it is slow, it depends on the expert's available time, and in practice it only ever explores a small corner of the search space.
This post introduces the AI Researcher, an open-source project that hands that loop to an autonomous agent running on AWS. You give it a research problem, packaged as a folder that contains the code to improve, the command that scores it, and a short written brief (more on this format below). From there, the agent works on its own: it reads the relevant literature, proposes experiments, delegates the execution of each experiment to a sub-agent running on GPU compute, records what it learned, and keeps improving the system under study. When the research is finished, it can even write up the work as a scientific paper.
The code is available on GitHub:  aws-samples/sample-aws-autoresearch . If you'd like to see it in action before reading further, watch this demo video:


The idea: the scientific method as a loop

At its core, the AI Researcher automates the same cycle a human researcher follows. Each turn of the loop has four steps:
  1. Read. The agent searches for relevant papers, summarizes them, and adds what it learns to the project's wiki, a growing knowledge base that acts as its long-term memory.
  1. Hypothesize. Based on the literature and on the results of earlier experiments, it designs one new experiment, for example a specific change to the code under study.
  1. Experiment. It runs that experiment on a worker machine and scores the result using the evaluation command you provided.
  1. Learn. If the change improved the score, it is kept; otherwise it is discarded. Either way, the agent updates the wiki and the status report with what it learned, and starts the next iteration.
The design was inspired by two public projects from Andrej Karpathy. His  autoresearch  project showed that an agent can make steady progress by repeatedly editing code and measuring it against a fixed metric. His  LLM Wiki  pattern showed how a large language model can build and maintain a persistent, interlinked knowledge base in plain markdown files. We combined both ideas and built a complete AWS solution around them, adding the pieces you need to run it for real: shared infrastructure, on-demand compute management, budget controls, and observability through a web application.

What a run looks like

To make this concrete, let's walk through a small project we ran. The goal was to train a denoising diffusion probabilistic model (DDPM), a type of generative model, to produce samples from a simple 2-D distribution known as "two moons". The quality of the model was measured as the KL divergence between generated and real samples (lower is better), and every training run had to fit in a fixed budget of 5 minutes. The agent was allowed to edit a single file,  src/train.py . Within that file, everything was fair game: the network architecture, the noise schedule, the number of diffusion steps, the optimizer, and the sampling procedure.
After 13 experiments, costing $1.36 out of the $100 budget we set, the agent had reduced the best KL divergence from 0.0234 (the baseline we started from) to 0.0094. The status report below was written entirely by the agent. It includes a summary of related work, a description of the current best solution, and an analysis of the remaining errors.

What we found most interesting is how candid the report is about its own results. The agent pointed out that its largest improvement didn't actually come from a better model. It came from drawing many sets of samples and reporting the best score among them, which mostly reduces the noise in the measurement rather than improving the underlying model. The agent estimated the model's true KL divergence at around 0.033, and proposed a follow-up experiment to measure the lowest score that is realistically achievable. In other words, the agent questioned its own headline number instead of just reporting it. That is exactly the kind of behavior you want from a research assistant, and it is also a useful reminder: always read the report before trusting a single metric.

What you get

A literature review that builds up over time, stored in an LLM Wiki

The agent doesn't rely only on what the underlying language model happens to remember from its training. Instead, a dedicated  knowledge-acquisition  skill searches sources such as arXiv, downloads relevant papers, and summarizes them into a wiki made of hyperlinked markdown pages. The wiki is organized into concepts, entities, comparisons, and findings, and pages link to one another with  [[wikilinks]] . Because each new paper and each experiment adds to the same wiki, the knowledge compounds over the course of the project.
The wiki serves two audiences.
For the agent, it is a compact, curated memory. Each research step runs as a separate, bounded Claude Code session rather than one conversation that never ends. This matters because a single session would accumulate context with every step, and over thousands of experiments it would eventually exceed what the model can handle. With bounded sessions, anything worth remembering has to be written into the wiki, and the next step starts by reading it back.
For you, the web app renders the same wiki with backlinks and an interactive graph view. You can follow what the researcher has understood so far and audit why it chose to try what it tried.


Version control for both the code and the wiki

Each project gets two Git repositories,  {project}-code  and  {project}-wiki , hosted on  AWS CodeCommit  (which is again available to new AWS accounts). Every experiment lives on its own branch as a diff against the code, and every change to the wiki is a commit. As a result, the agent's entire reasoning trail is versioned and reviewable, and you can inspect it with the Git tools you already use. The web app also shows the commit history, the diffs, and the wiki pages directly from these repositories.

Compute that runs only when it's needed

The work is split across two kinds of machines. The researcher itself, the agent that reads, reasons, and plans, runs on a small, inexpensive CPU instance ( m8g.large  by default). The heavy lifting, training and evaluating models, happens on a separate GPU instance called the worker.
When the researcher has designed an experiment, it hands it to a "run-experiment" sub-agent. That sub-agent starts the GPU worker, connects to it over SSH, runs the experiment (and debugs it if something goes wrong) within a set time budget, stops the worker again, and reports the results back to the researcher. The GPU is only powered on, and only billed, while an experiment is actually running.
We deliberately chose plain Amazon EC2 instances for the workers rather than a managed training-job service. The reason is that the code being run was written by an agent, so it fails often: tensors with the wrong shape, out-of-memory errors, missing or mismatched dependencies. The most efficient way to work through these failures is a fast cycle of editing the code, running it, reading the error, and fixing it. An interactive shell on a running machine supports that cycle well. A managed job service would require packaging the code, submitting it to a queue, and waiting for an instance to be provisioned on every single attempt, which adds minutes to each fix. To keep startup fast, an optional one-time  setup.sh  script installs dependencies and prepares data on the worker's EBS volume, where they persist between experiments.
The Experiments tab in the web app keeps a complete ledger of everything the agent has tried. Each row is one experiment, with its outcome (kept or discarded), its metric, its cost, and how long it ran. The page header shows total spend against the project's budget.

If you prefer to keep a GPU for the entire session and avoid the startup time before each experiment, you can select the "Run experiments locally" option when creating the project. In that mode, the researcher itself runs on a GPU instance and executes the experiments directly. The trade-off is that you pay for the GPU while it sits idle between experiments.

Guardrails on cost and access

An autonomous agent that can start GPU instances needs firm limits. The AI Researcher includes several layers of protection:
  • Budgets. Every project has a spending cap, and every user has an overall budget that an administrator grants.
  • Guaranteed shutdown. The worker is always stopped when a sub-agent exits, and a watchdog running on the worker itself shuts it down if something goes wrong.
  • A Stop button. One click halts both the researcher and the worker.
  • Time and progress limits. Each experiment has a timeout, enforced when it is dispatched. A "patience" setting pauses the project automatically when a given number of research steps in a row have failed to produce any improvement, so the agent doesn't keep spending money while it is stuck.
  • Least-privilege access. Each project has its own IAM role and SSH key, constrained by a permissions boundary. The agent has no direct access to the database. It can only update its state through a single Lambda function, which accepts only an allowlisted set of fields.
  • A protected evaluation harness. The files you mark as read-only are turned into deny rules in the agent's configuration, so the agent cannot edit the code that scores its experiments.
That last guardrail is essential for trusting the results. The evaluation harness, the fixed code that runs and scores each experiment, writes the score to a  metrics.json  file. Because the agent can't modify the harness, it can't fabricate or inflate its own score.

Watch it work

The control plane, the part of the solution that manages users, projects, and state, is fully serverless (Amazon API Gateway, AWS Lambda, Amazon DynamoDB, Amazon S3, Amazon Cognito, and Amazon CloudFront), so it costs close to nothing when no research is running. The web app streams the activity of the researcher and of each experiment sub-agent live from Amazon CloudWatch. Alongside the live stream, it shows the status report with charts, the experiment ledger with kept and discarded runs, the cost of each experiment, the code, and the wiki. You are not just an observer, either: you can type guidance into a text box, and the agent takes it into account in its next iteration.
The screenshot below shows the researcher stream, a live view of one research step. You can see the agent read the status report and the wiki, design an experiment, edit  train.py , push a new experiment branch, and dispatch the run to the worker. At the bottom, the guidance box lets you steer the next iteration, and a checkbox enables paper writing at the end of the research.


A scientific paper at the end

If you enable this option, a  scientific-paper-writing  skill runs when the research completes. It writes a paper in LaTeX, in the style of an IEEE conference paper, and compiles it to PDF. The result appears in the Paper tab of the web app. Because the paper is based on the experiment ledger and the wiki, every claim can be traced back to a specific commit and a measured result.
Treat this paper as a first draft for a human expert to review and correct, not as a finished publication.

Defining a project: everything lives in one folder

The platform itself contains no code specific to any particular problem. Everything the AI Researcher needs to know about your project comes from a single folder that follows a simple convention:
my-project/
├── auto-research.json # files, evaluation command, metric and direction
├── README.md # the brief: goal, background, seed papers, ideas
├── src/ # code under study + the fixed evaluation harness
└── setup.sh # optional, one-time worker setup
Each file has a clear role:
  •  auto-research.json  is the machine-readable specification. It tells the agent which files it may change, which files it must not touch, how to run and score an experiment, and whether the score should go up or down.
  •  README.md  is the brief written for the researcher, in plain prose. Describe the goal, give background on the problem, list the papers you'd like it to start from, and share any ideas you already have. It plays the same role as the briefing you would give a new colleague joining the project.
  •  src/  contains the code to be improved, together with the fixed evaluation harness that scores it.
  •  setup.sh  is optional. It runs once on the worker to install dependencies and prepare data.
The specification is short. Here is an example for a project that improves a heuristic for the traveling salesman problem (TSP):
{
"description": "Minimize TSP optimality gap on TSPLIB instances",
"modifiable_files": ["src/heuristic.py"],
"read_only_files": ["src/evaluate.py"],
"evaluation_command": "python src/evaluate.py > run.log 2>&1",
"metric_name": "gap_pct",
"metric_direction": "lower_is_better"
}
Here, the agent may only edit  src/heuristic.py . The evaluation script  src/evaluate.py  is protected, and the agent's goal is to minimize  gap_pct , the percentage gap between the tour length its heuristic finds and the best known solution.
To start a project, upload the folder in the web app, choose the compute, set a budget and a patience limit, and create the project.


When is this approach a good fit?

The AI Researcher applies to a problem when two conditions are met:
  1. A candidate solution can be represented in a form a computer can produce and modify. The answer is something like source code, a configuration file, a formula, a set of parameters, or a policy.
  1. A candidate solution can be scored automatically. A benchmark, a simulation, a test suite, a backtest, or a sensor reading can measure how good it is, without a human in the loop.
If both conditions hold, and the best answer isn't already known, the problem is a good candidate for this approach. The repository includes several demos you can try first:
  • Tabular machine learning on real datasets: California Housing, CoverType, MAGIC Gamma Telescope, and a regression task predicting the critical temperature of superconductors.
  • Algorithm discovery: the circle-packing task from Google DeepMind's AlphaEvolve, the online bin-packing task from FunSearch, and heuristics for the traveling salesman problem on TSPLIB instances.
  • Control: a swing-up controller for the  Pendulum-v1  environment in Gymnasium.
Each demo documents a baseline score and a published reference value, so you have a clear target to judge the agent's performance against.

Try it in your own domain

The same pattern applies across many fields. What changes from one domain to another is what the agent generates (the candidate) and how you measure it (the score):
Domain
Candidate
Score
Software performance
Source code
Test suite plus runtime benchmark
ML engineering
Architecture or hyperparameters
Validation metric
Prompt and agent tuning
Prompt or tool configuration
Success rate on an eval set
Materials and chemistry
Composition or structure
Simulation or surrogate model
Engineering design
Geometry or parameters
FEA or CFD simulation
Operations
Routes, schedules, policies
Cost model or discrete-event simulation
Energy and finance
Layouts, dispatch rules, strategies
Yield simulation or backtest
A good way to start is to pick one problem where your team currently tunes things by hand. Write the evaluation harness first: it must run without any human intervention and produce a single number that captures how good a candidate is. Then write a brief that lists the papers you would read yourself if you were tackling the problem, and let the researcher take it from there.

Deploy it

Before you start, you need:
  • The AWS CLI, authenticated to a sandbox AWS account
  • Python 3.11 or later, Node.js 18 or later, and the AWS CDK CLI
  • Access to the Amazon Bedrock model you plan to use, in your chosen AWS Region
  • Enough EC2 quota for the GPU worker (a  g4dn.xlarge  by default)
Deployment takes three commands:
export AWS_REGION=us-east-1
./scripts/deploy.sh # control plane (CDK)
./scripts/add_user.sh <username> <password>
./scripts/deploy_ui.sh # web app
Then sign in to the web app, grant yourself a budget, create a project from one of the demo folders, and watch the first experiments come in. The README in the repository describes every step in detail.

Cost, limitations, and cleanup

  • Cost. The control plane uses no GPU and costs very little while idle. Your spending comes from three sources: Amazon Bedrock tokens consumed by the agent, the researcher instance while it runs, and the GPU workers while experiments execute. Check current pricing for your chosen instance types and model in your Region, and set a budget you'd be comfortable losing entirely.
  • Results are only as good as your evaluation. The agent optimizes exactly what you measure. If the evaluation harness has loopholes, or if its score doesn't reflect your real objective, the agent will find a way to improve the number without improving what you actually care about. Review the kept experiments before trusting them.
  • This is a prototype. The sample is meant to be learned from and adapted, not used as a hardened production service. Review the security model described in the design document before using it with sensitive code or data.
  • Cleanup. Stop a running project with the Stop button, and delete the project to remove its instances and repositories. Running  cdk destroy --all  removes the control plane. The S3 data bucket is retained by design to prevent accidental data loss, so empty and delete it yourself if you no longer need it.

Next steps

Clone the repository, run one of the demos, and then replace it with a problem of your own. Whether you find a domain where the AI Researcher works well or one where it struggles, we'd like to hear about it. You can share feedback by  opening an issue on GitHub  or by leaving a comment on this post.
If you want to extend the solution, the  design document  describes the architecture, the CDK stacks, and the invariants the system relies on.
Any opinions in this article are those of the individual author and may not reflect the opinions of AWS.
Enjoyed reading this content? Let the author know!

Your likes, comments, shares, and saves help creators reach more builders.

Loading recommendations

Loading article