Skip to content

Conversation

@TerminallyLazy
Copy link
Contributor

Summary

Implements the AI Scientist agent profile for Agent Zero - an autonomous research assistant that can generate novel research ideas, execute ML experiments, and write publication-ready papers. Inspired by https://arxiv.org/abs/2408.06292 from Sakana AI.

Key Features:

  • Research Idea Generation - Generates novel ideas with literature search, multi-round refinement, and novelty scoring
  • 4-Stage Experiment Pipeline - Initial implementation → Baseline tuning → Creative research → Ablation studies
  • Paper Generation - Produces LaTeX manuscripts with automatic citation gathering via Semantic Scholar
  • Profile-Specific UI - Three dedicated modal interfaces accessible via profile-specific buttons

Changes

New Agent Profile (agents/ai-scientist/)

  • agent.json - Profile configuration with title, description, and context
  • settings.json - Uses inherited model settings (no hardcoded models)
  • _context.md - Role definition and methodology documentation
  • prompts/ - Specialized system prompts for research methodology
  • extensions/ - State initialization for research data containers
  • tools/ - Four specialized tools:
    • generate_idea.py - Multi-round idea generation with novelty validation
    • run_experiment.py - 4-stage experiment pipeline with best-first tree search
    • write_paper.py - LaTeX paper generation with reflection rounds
    • semantic_scholar.py - Academic paper search integration

API Endpoints (python/api/)

  • scientist_generate_ideas.py - Trigger idea generation
  • scientist_get_ideas.py - Retrieve generated ideas
  • scientist_start_experiment.py - Launch experiment pipeline
  • scientist_get_experiments.py - List experiments with status
  • scientist_get_experiment_progress.py - Real-time progress polling
  • (Paper generation uses existing experiment data)

Frontend (webui/)

  • Ideas Manager Modal - Topic input, idea cards with novelty badges, detailed view
  • Experiment Dashboard Modal - Stage pipeline visualization, node tree, real-time progress
  • Paper Generator Modal - Experiment selection, format options, generation progress
  • Profile-Specific Buttons - Ideas/Experiments/Papers buttons appear only when AI Scientist profile is active

Architecture

  ┌─────────────────────────────────────────────────────────────┐
  │                     AI Scientist Profile                      │
  ├─────────────────────────────────────────────────────────────┤
  │  Tools                    │  UI Components                   │
  │  ├─ generate_idea         │  ├─ Ideas Manager Modal          │
  │  ├─ run_experiment        │  ├─ Experiment Dashboard Modal   │
  │  ├─ write_paper           │  └─ Paper Generator Modal        │
  │  └─ semantic_scholar      │                                   │
  ├─────────────────────────────────────────────────────────────┤
  │  Data Flow: context.data["research_ideas"|"experiments"|"papers"]│
  │  Storage: Persistent across sessions via AgentContext          │
  └─────────────────────────────────────────────────────────────┘

Technical Notes

  • Tool Discovery: Tools require both Python implementations AND agent.system.tool.*.md instruction files for LLM awareness
  • Data Storage: Uses context.data (not agent.data) for persistence across API calls
  • Async Execution: Agent runs asynchronously; UI uses polling to detect completion
  • JSON Parsing: Includes defensive parsing for LLM-generated JSON with wrapper extraction and field validation

TerminallyLazy and others added 6 commits January 13, 2026 03:54
…flow

Add a specialized AI Scientist agent profile that automates the research workflow from idea generation to paper writing.

Core Features:
- Research idea generation with Semantic Scholar integration
- Experiment management with tree search-based exploration
- Automated paper generation with LaTeX compilation
- Profile-specific UI with modals for ideas, experiments, and papers

Agent Tools:
- semantic_scholar: Search academic papers via Semantic Scholar API
- generate_idea: Generate novel research ideas with novelty scoring
- run_experiment: Execute experiments using subordinate agents with tree search
- write_paper: Generate LaTeX manuscripts with citations and compilation

API Endpoints:
- /api/scientist_generate_ideas: Generate research ideas
- /api/scientist_get_ideas: Retrieve stored ideas
- /api/scientist_get_experiments: List experiment history
- /api/scientist_start_experiment: Launch new experiments
- /api/scientist_get_experiment_progress: Poll experiment status

UI Components:
- Ideas Manager modal: Browse and generate research ideas
- Experiment Dashboard: Track experiments with real-time progress
- Paper Generator: Create manuscripts with stage-based workflow
- Profile-specific buttons in chat input (Ideas, Experiments, Papers)
- Status badges for scientist-specific message types

State Management:
- In-memory state for ideas and experiments via agent extensions
- Persistent experiment logs in agent memory directory
- Profile-specific memory isolation (agent_memory_subdir: "ai-scientist")

Message System Integration:
- IDEA status badge for idea generation steps
- EXP status badge for experiment execution steps
- PAPER status badge for paper generation steps
- Color-coded badges in process groups

Configuration:
- Inherits model settings from global Agent Zero config (no hardcoded models)
- Subordinate agent integration for experiment execution
- ~~~ code block delimiters per Agent Zero conventions

Co-Authored-By: Claude Sonnet 4.5 <[email protected]>
…flow

Add a specialized AI Scientist agent profile that automates the research workflow from idea generation to paper writing.

Core Features:
- Research idea generation with Semantic Scholar integration
- Experiment management with tree search-based exploration
- Automated paper generation with LaTeX compilation
- Profile-specific UI with modals for ideas, experiments, and papers

Agent Tools:
- semantic_scholar: Search academic papers via Semantic Scholar API
- generate_idea: Generate novel research ideas with novelty scoring
- run_experiment: Execute experiments using subordinate agents with tree search
- write_paper: Generate LaTeX manuscripts with citations and compilation

API Endpoints:
- /api/scientist_generate_ideas: Generate research ideas
- /api/scientist_get_ideas: Retrieve stored ideas
- /api/scientist_get_experiments: List experiment history
- /api/scientist_start_experiment: Launch new experiments
- /api/scientist_get_experiment_progress: Poll experiment status

UI Components:
- Ideas Manager modal: Browse and generate research ideas
- Experiment Dashboard: Track experiments with real-time progress
- Paper Generator: Create manuscripts with stage-based workflow
- Profile-specific buttons in chat input (Ideas, Experiments, Papers)
- Status badges for scientist-specific message types

State Management:
- In-memory state for ideas and experiments via agent extensions
- Persistent experiment logs in agent memory directory
- Profile-specific memory isolation (agent_memory_subdir: "ai-scientist")

Message System Integration:
- IDEA status badge for idea generation steps
- EXP status badge for experiment execution steps
- PAPER status badge for paper generation steps
- Color-coded badges in process groups

Configuration:
- Inherits model settings from global Agent Zero config (no hardcoded models)
- Subordinate agent integration for experiment execution
- ~~~ code block delimiters per Agent Zero conventions

Co-Authored-By: Claude Sonnet 4.5 <[email protected]>
- Added agent.system.tool.generate_idea.md
- Added agent.system.tool.run_experiment.md
- Added agent.system.tool.write_paper.md
- Added agent.system.tool.semantic_scholar.md

These instruction files make AI Scientist tools visible to the agent's
LLM by including them in the system prompt's 'Tools available' section.

Without these files, the Python tool classes exist but the agent doesn't
know about them because they're not mentioned in the prompt.
- Extract 'Current Idea' from wrapper structures returned by model
- Validate parsed JSON has required fields (Name, Title)
- Clearer refinement prompt to avoid wrapper structure responses
- Accept both dict and string prompts in _query_model()

Fixes KeyError on 'Name' and JSON parsing issues during idea refinement.
- Validate idea has Name and Title before accessing fields
- Log warning when idea is invalid instead of crashing
- Extract idea_name to variable for safer access
- Better debug logging for invalid ideas

Prevents KeyError crashes when LLM returns malformed JSON.
…lyLazy/agent-zero into feat-ai-scientist-agent

# Conflicts:
#	agents/ai-scientist/extensions/agent_init/_10_init_scientist_state.py
#	agents/ai-scientist/tools/generate_idea.py
#	agents/ai-scientist/tools/run_experiment.py
#	agents/ai-scientist/tools/write_paper.py
#	python/api/scientist_generate_ideas.py
#	python/api/scientist_get_ideas.py
#	webui/components/modals/ai-scientist/experiment-dashboard/experiment-dashboard-store.js
#	webui/components/modals/ai-scientist/ideas-manager/ideas-manager-store.js
#	webui/components/modals/ai-scientist/paper-generator/paper-generator-store.js
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant