I built an AI physics agent that drafts research papers
I may have gone too far with this one.
I had a dream to make an agentic AI system that does research in fundamental physics:
Find and read recent papers
Determine future research directions
Write a new research paper as LaTeX and render as PDF
And then I made my dream come true!
“Muhahahaha….”
Check out the video on YouTube
AI Engineer Roadmap Launch 🚀
After 4 months of development, I’ve launched my AI Engineer Roadmap course!
This turned out to be a BEAST of a course, with 96 lessons across 9 topics in AI Engineering.
You can use the code ZAZEN33 to get 33% off in the month of March (ends March 31st 2025)
Topics from this week’s video
Overview of the Video
Demonstration of implementing a basic React-style agent using LangGraph.
Goal: Build an agent capable of writing physics research papers.
Learn about LangGraph and agent implementation.
What is an Agent?
An agent perceives and acts on its environment.
Language model agents use tools to act (e.g., web search).
Example: ChatGPT using tools to provide up-to-date data.
React Architecture
Combines reasoning and acting.
Inspired by the paper: "React: Synergizing Reasoning and Acting in Language Models" (2023).
Workflow is dynamic and graph-like.
Key Steps:
Reasoning: Step-by-step thinking process.
Acting: Invoking tools or APIs.
Iterative process alternating between these two.
Introduction to LangGraph
Library for building stateful, multi-actor LLM applications.
Designed for scalable, production-grade agents.
Offers tools like:
Memory management.
Tracing via LangSmith.
Tools Implemented
Read PDF: Extracts text from a PDF.
Archive Search: Searches arXiv for recent papers.
Render LaTeX PDF: Generates a PDF from LaTeX content.
Tools rely on good documentation to assist the agent in calling them appropriately.
Interactive Demo
Example topics explored: cold atomic gases, quantum phase transitions.
Agent behavior:
Searches for papers using arXiv API.
Reads PDFs and extracts research insights.
Suggests future research directions.
Drafts research papers using LaTeX.
Observations:
Automatically triggers tools based on context.
Handles errors (like LaTeX compilation issues) and attempts self-correction.
Generates research paper drafts and saves them locally.
Challenges Encountered
Premature calls to render LaTeX without sufficient content.
Rate limits on Anthropic’s API.
Switched to OpenAI’s GPT for continued testing.
Occasional unexpected behavior like repeated tool calls.
Outcomes
Successfully generated a basic research paper draft.
Demonstrated the autonomous and iterative capabilities of the agent.
Showcased LangGraph's reactive agent capabilities.
Being a physicist is hard, but it's better than having to work for a living.
Giorgio Parisi