research-link-ai / docs /architecture.md
MHamdan's picture
Deploy Research-Link-AI (Docker Space, offline demo)
a753e74 verified
|
Raw
History Blame Contribute Delete
2.37 kB
# Architecture: ResearchLink AI
## Overview
ResearchLink AI is a sequential multi-agent pipeline where each agent handles one concern and passes structured Pydantic models to the next.
## Pipeline Flow
```
IngestionInput (user)
β”‚
β–Ό
IntakeAgent ──────────────── validates + normalises inputs
β”‚
β–Ό
SourceResolverAgent ────────── downloads PDF, checks URLs
β”‚
β–Ό
PDFExtractionAgent ─────────── extracts text + structure
β”‚
β–Ό
MetadataAgent ──────────────── builds PaperMetadata (+ LLM)
β”‚
β–Ό
CitationVerificationAgent ───── parses + classifies references
β”‚
β–Ό
GitHubRepoAnalyzerAgent ─────── inspects code repository
β”‚
β–Ό
[Content Agents β€” all run in sequence, all use LLM]
PaperDigestAgent
LiteratureReviewAgent
ConceptMapAgent
ImplementationLinkAgent
ReproducibilityAgent
LimitationsAgent
TeachingPathAgent
LabsGeneratorAgent
β”‚
β–Ό
ReviewerAgent ──────────────── quality-checks all content
β”‚
β–Ό
ExportAgent ─────────────────── writes files to disk
β”‚
β–Ό
GenerationReport
```
## Key Design Decisions
**Pydantic schemas:** All inter-agent data is typed. No raw dict passing between agents.
**LLM for content, heuristics for structure:** Structural extraction (PDF parsing, URL checking, citation regex) uses deterministic code. Content generation (digest, review, labs) uses the Claude API.
**Fail-open with flags:** If an agent step fails (LLM error, URL unreachable), it returns a partial result with notes and continues. Errors are collected in the GenerationReport.
**Honest labels:** All generated content uses `[paper-claim]`, `[agent-interpretation]`, and `[needs-verification]` labels throughout.
## File Structure
```
src/researchlink/
cli.py β€” Typer CLI entrypoint
pipeline.py β€” Pipeline orchestrator
config.py β€” Settings (env vars / .env)
schemas/ β€” Pydantic data models
agents/ β€” One file per agent
services/ β€” Reusable utilities (PDF, HTTP, GitHub, etc.)
templates/ β€” Jinja2 templates (for structured sections)
validators/ β€” Output and citation validation
```