Leanpub Header

Skip to main content

AI Agents for Scientists and Engineers

Building, Verifying, and Deploying LLM Agents for Real Research

The instructor has published 100% of this course.Last updated on 2026-11-21

Learn to build AI agents that do trustworthy scientific work: they call your tools, run real computations, cite real sources, and are verified rather than believed. The course runs from a from-scratch agent loop to retrieval, evaluation, and MCP deployment, with a quiz in every lesson and a certificate.

Minimum price

$39.00

$59.00

You pay

Author earns

$

Also available for 1 course credit with a Learner Membership

PDF
EPUB
WEB
About

About

About the Course

AI Agents for Scientists and Engineers is a practical online course for researchers, engineers, and technical professionals who want AI agents that do trustworthy work: agents that call real tools, run real computations, cite real sources, and are verified rather than believed.

In 11 lessons you build, extend, and deploy agents step by step:

  • Foundations: what makes an agent different from a chatbot, the language model as a reasoning engine, and setting up a safe environment for keys, generated code, and cost.
  • Building: the agent loop written from scratch in about forty lines, and a complete scientific computing assistant whose every number comes from a tool, not from the model.
  • Extending: retrieval for literature and documentation with real citations, tool orchestration and planning with stage gates, and when multi-agent systems are worth their cost.
  • Trusting and deploying: guardrails, verification, and human checkpoints; evaluating agents with test sets and rubrics; and moving from notebook to production with the Model Context Protocol (MCP).

Every lesson includes figures, tables, code listings, key takeaways, and exercises. Each lesson ends with a marked quiz (88 questions in total). Score 70% or more to earn your certificate of completion.

Share this course

Instructor

About the Instructor

Kompri

Kompri is an academic, author, investor, and educator based in Jambi, Indonesia. He holds a doctorate in Education Management and a bachelor’s degree in Physics, and has written and published dozens of books along with numerous other scholarly works. An avid reader, he is one of today’s most productive researchers. Alongside his academic career, he publishes both theoretical and practical books for readers around the world. His work rests on one conviction: knowledge is most valuable when it is clear, usable, and shared, so that anyone, in any country, can put it to work.

Material

Course Material

  • Welcome to the Course

  • How the Course Works

  • Earning the Certificate

  • Chapter 1: Why Agents for Science and Engineering?

  • 1.1 From Chatbot to Agent: Answering Versus Acting

  • The reasoning-and-acting loop

  • A loop, concretely

  • The coordinator, not the computer

  • 1.2 When an Agent Is the Right Tool—and When It Is Overkill

  • When a plain script is better

  • When a trained model or a classical solver is better

  • Where the agent earns its place

  • 1.3 What This Looks Like in Practice: Four Sketches

  • The simulation runner

  • The tool-using domain specialist

  • The data analyst

  • The research assistant and literature scout

  • 1.4 Roadmap and Prerequisites

  • What you need to know already

  • Two commitments

  • 1.5 Limits and Risks, Stated at the Outset

  • Hallucination

  • Non-determinism

  • Cost and latency

  • Security

  • Key Takeaways

  • Lesson 1 Quiz

    10 attempts allowed

  • Chapter 2: The Language Model as a Reasoning Engine— What to Know, Not Train

  • 2.1 The Model from the Driver’s Seat: Tokens, Context, Temperature, Cost

  • Tokens

  • The context window

  • What a single call actually contains

  • Temperature and the fact of randomness

  • Cost and latency

  • 2.2 Prompting That Holds Up: Instructions, Examples, Decomposition

  • 2.3 Structured Output: Getting Back Something a Program Can Use

  • 2.4 Tool Calling: The Mechanism That Lets the Model Act

  • 2.5 Choosing a Model: Proprietary APIs, Open Models, and Your Data

  • Why the choice matters more for scientists

  • What you are not doing: training or fine-tuning

  • Key Takeaways

  • Lesson 2 Quiz

    10 attempts allowed

  • Chapter 3: Setting Up the Environment and the Safety Gloves

  • 3.1 The Environment and Your First Call

  • The API key is a password

  • The round trip

  • 3.2 Framework or From Scratch?

  • 3.3 Running Agent-Generated Code Safely

  • The threat model, honestly

  • Isolation, timeouts, and limits

  • 3.4 Project Structure and Logging Every Step

  • Log everything, because you cannot replay what you did not record

  • 3.5 Estimating and Fencing Costs Before You Automate

  • Key Takeaways

  • Lesson 3 Quiz

    10 attempts allowed

  • Chapter 4: Anatomy of an Agent—Building the Loop from Scratch

  • 4.1 The Loop, Without Jargon

  • Why the model must be reminded every turn

  • 4.2 A Tool Is Just a Python Function

  • What the model actually sees

  • 4.3 Building the Loop, Line by Line

  • The instructions

  • Reading the reply

  • The loop

  • 4.4 The Edges: Errors, Retries, and Stopping

  • Malformed replies and tool failures

  • The danger of trying forever

  • Side effects and the safety of retrying

  • 4.5 A Run, Start to Finish

  • 4.6 The Whole Picture

  • What this loop does not yet do

  • Key Takeaways

  • Lesson 4 Quiz

    10 attempts allowed

  • Chapter 5: Your First Agent—A Scientific Computing Assistant

  • 5.1 The Task

  • 5.2 Three Real Tools

  • 5.3 The Case Study: A Complete Run

  • What the agent’s code did

  • 5.4 Verifying Against Ground Truth

  • When you have no ground truth

  • 5.5 When the Agent Gets It Wrong

  • Answering from the head

  • The confident wrong statistic

  • Verification that passes when it shouldn’t

  • Unit and column confusion

  • A verification habit, in five questions

  • 5.6 Exercise: Add a Solver Tool

  • Making it your own

  • What You Have Built, and the Road Ahead

  • Key Takeaways

  • Lesson 5 Quiz

    10 attempts allowed

  • Chapter 6: Giving the Agent Knowledge—Retrieval for Literature and Technical Documentation

  • 6.1 Stale Knowledge and Hallucination: Why Retrieval, Not Fine-Tuning

  • 6.2 Embeddings and Vector Search, Without Training Anything

  • 6.3 Building a Retrieval Tool Over Your Own Documents

  • Chunking and building the index

  • The retrieve tool

  • When to reach for a vector database

  • 6.4 The Case Study: A Literature-Scout Agent That Cites Its Sources

  • Verifying the citations

  • 6.5 The Limits of Retrieval, and How to See Them

  • The answer is not in the corpus

  • The wrong passages come back

  • The key passage is cut, or crowded out

  • Key Takeaways

  • Lesson 6 Quiz

    10 attempts allowed

  • Chapter 7: Orchestrating Multiple Tools and Planning

  • 7.1 From One Tool to Many: How the Agent Chooses

  • The description is the router

  • The cost of too many tools

  • Watching the router

  • 7.2 Multi-Step Planning: Decomposing a Task

  • Two architectures: interleaved, and plan-then-execute

  • The same task, run both ways

  • When not to plan at all

  • The plan itself can be wrong

  • 7.3 The Case Study: A Data-Analysis Pipeline

  • The plan

  • The executor, with gates

  • What makes a good gate

  • Threading the result from one step to the next

  • Not every pipeline is a straight line

  • The run

  • Budgeting a multi-step run

  • 7.4 Pitfalls: Brittle Chains, Cascading Errors, and Recovery

  • Cascading errors

  • Brittleness

  • Recovery: re-planning, bounded retries, and checkpoints

  • Recoverable and unrecoverable failures

  • Key Takeaways

  • Lesson 7 Quiz

    10 attempts allowed

  • Chapter 8: Multi-Agent Systems—When They Help, When They’re Overkill

  • 8.1 Patterns: Ways to Split a Problem Across Agents

  • Generator and critic

  • Planner and executor

  • Specialists and a coordinator

  • 8.2 How Agents Communicate and Divide Labor

  • Dividing the work

  • The telephone problem

  • Keeping context from leaking

  • Deciding when they disagree

  • 8.3 Case Study: An Executor–Verifier Pair

  • Why a separate agent, and not self-checking

  • A run

  • When a verifier agent beats a plain harness

  • The honest limit of the pattern

  • 8.4 An Honest Look: When a Single Agent Is Better

  • The costs of a crowd

  • What another agent must buy to be worth it

  • A test before you add an agent

  • The exception at the top of the scale

  • Key Takeaways

  • Lesson 8 Quiz

    10 attempts allowed

  • Chapter 9: Reliability and Verification—Making an Agent Trustworthy in Science

  • 9.1 “Looks Right” Is Not Right: The Particular Danger for Science

  • 9.2 Guardrails: Validating What the Agent Produces

  • Schema: is it even the right shape?

  • Units and dimensions: does it mean the right thing?

  • Physical bounds: could the answer even be true?

  • 9.3 Verification, and Knowing a Guardrail Is Not One

  • 9.4 Human-in-the-Loop: Where a Person Must Stay

  • Which actions need a checkpoint

  • A dial, not a switch

  • 9.5 Security: The Agent Can Act, So It Can Be Turned Against You

  • Prompt injection: the signature attack

  • The defenses, layered like the rest

  • 9.6 A Readiness Checklist

  • Key Takeaways

  • Lesson 9 Quiz

    10 attempts allowed

  • Chapter 10: Evaluating Agents—Measure, Don’t Guess

  • 10.1 Why Evaluating an Agent Is Hard

  • Non-determinism: the same input, different runs

  • Many correct paths, and sometimes many correct answers

  • 10.2 Building a Test Set and a Rubric

  • What makes a good test set

  • Where test cases come from

  • The rubric: judging without a single right answer

  • The judge is a fallible instrument

  • Your own test set, not a public benchmark

  • 10.3 The Metrics Worth Measuring

  • Task success rate

  • Report the spread, not just the rate

  • Accuracy against ground truth

  • Cost and steps

  • Do not optimize a single number

  • 10.4 Regression Testing: Not Breaking What Works

  • Evaluation is not free

  • Make it automatic

  • 10.5 Case Study: Evaluating the Analysis Pipeline

  • The test set

  • The measurement

  • Key Takeaways

  • Lesson 10 Quiz

    10 attempts allowed

  • Chapter 11: From Notebook to Real Research Tool—MCP, Deployment, and Production

  • 11.1 The Model Context Protocol: A Standard Way to Connect

  • 11.2 Wrapping a Scientific Tool as a Server

  • Local and remote servers

  • 11.3 Observability: Seeing the Agent in Real Use

  • What to watch

  • Drift: the production-specific hazard

  • 11.4 Cost and Rate Control for Long-Running Operations

  • Budgets, quotas, and limits

  • Caching, and spending less to begin with

  • Reproducibility: recording what ran

  • 11.5 Case Study: Handing an Agent Tool to a Labmate

  • Documentation is a safety feature

  • A Closing Word

  • Key Takeaways

  • Lesson 11 Quiz

    10 attempts allowed

  • Glossary

  • Bibliography

The Leanpub 60 Day 100% Happiness Guarantee

Within 60 days of purchase you can get a 100% refund on any Leanpub purchase, in two clicks.

See full terms...

Earn $8 on a $10 Purchase, and $16 on a $20 Purchase

We pay 80% royalties on purchases of $7.99 or more, and 80% royalties minus a 50 cent flat fee on purchases between $0.99 and $7.98. You earn $8 on a $10 sale, and $16 on a $20 sale. So, if we sell 5000 non-refunded copies of your book for $20, you'll earn $80,000.

(Yes, some authors have already earned much more than that on Leanpub.)

Learn more about writing on Leanpub

Free Updates. DRM Free.

If you buy a Leanpub book, you get free updates for as long as the author updates the book! Many authors use Leanpub to publish their books in-progress, while they are writing them. All readers get free updates, regardless of when they bought the book or how much they paid (including free).

Most Leanpub books are available in PDF (for computers) and EPUB (for phones, tablets and Kindle). The formats that a book includes are shown at the top right corner of this page.

Finally, Leanpub books don't have any DRM copy-protection nonsense, so you can easily read them on any supported device.

Learn more about Leanpub's ebook formats and where to read them

Write and Publish on Leanpub

You can use Leanpub to easily write, publish and sell in-progress and completed ebooks and online courses!

Leanpub is a powerful platform for serious authors, combining a simple, elegant writing and publishing workflow with a store focused on selling in-progress ebooks.

Leanpub is a magical typewriter for authors: just write in plain text, and to publish your ebook, just click a button. (Or, if you are producing your ebook your own way, you can even upload your own PDF and/or EPUB files and then publish with one click!) It really is that easy.

Learn more about writing on Leanpub