Skip to main content
BioAgents uses a multi-agent architecture where specialized agents collaborate to perform autonomous scientific research. Each agent is an independent, self-contained function that performs a specific task in the research workflow.

Agent Types

BioAgents includes 7 core agents:

File Upload Agent

Parses and stores uploaded datasets with AI-generated descriptions

Planning Agent

Creates research plans based on user questions and current state

Literature Agent

Searches scientific literature across multiple backends

Analysis Agent

Performs data analysis on uploaded datasets

Hypothesis Agent

Generates research hypotheses from findings

Reflection Agent

Extracts insights and updates methodology

Discovery Agent

Identifies novel scientific claims with evidence

Reply Agent

Generates user-facing responses

Agent Architecture

Independent Functions

Each agent is a self-contained function that:
  • Takes specific inputs
  • Performs a single responsibility
  • Returns structured outputs
  • Does not directly modify global state
// src/agents/literature/index.ts
export async function literatureAgent(input: {
  objective: string;
  type: LiteratureType;
  onPollUpdate?: OnPollUpdate;
}): Promise<LiteratureResult> {
  // Search literature based on type
  // Return results with timing information
}

State Management

Agents read from and write to two types of state:
  • Message State: Ephemeral, tied to a single message
  • Conversation State: Persistent across the entire conversation
See State Management for details.

Agent Collaboration

Chat Mode

In chat mode, agents execute sequentially:
1

File Upload

Process any uploaded files
2

Planning

Generate literature search tasks
3

Literature

Execute literature searches in parallel
4

Hypothesis

Generate hypothesis if needed
5

Reflection

Extract insights and update state
6

Reply

Generate concise user response

Deep Research Mode

In deep research mode, agents execute in an iterative cycle:
1

Planning

Plan both LITERATURE and ANALYSIS tasks
2

Execution

Execute tasks in parallel with deduplication
3

Hypothesis

Synthesize findings into scientific claims
4

Reflection

Update world state with insights
5

Discovery

Identify novel claims with evidence links
6

Continue Decision

Decide whether to continue autonomously
7

Reply

Generate response with next steps

Creating Custom Agents

You can create custom agents for specialized tasks. See the Custom Agents guide for details.

Agent Template

import logger from "../../utils/logger";

export async function myAgent(input: {
  // Define inputs
}): Promise<MyResult> {
  const start = new Date().toISOString();
  
  logger.info({ input }, "my_agent_started");
  
  try {
    // Perform agent logic
    
    return {
      // Return structured output
    };
  } catch (err) {
    logger.error({ err }, "my_agent_failed");
    throw err;
  }
}

Best Practices

Each agent should have a single, clear responsibility. Don’t create “god agents” that do everything.
Design agents to work across different routes and contexts. Avoid route-specific logic.
Return TypeScript types with clear fields. This makes agents composable and testable.
Use structured logging for debugging and monitoring. Include timing information.
Catch errors and return informative error messages. Don’t let one agent crash the entire workflow.

Next Steps

Architecture

Understand the overall system design

Deep Research

Learn about the iterative research cycle

Custom Agents

Build your own specialized agents

Build docs developers (and LLMs) love