How astropilot-ai/denario works
Purpose and Entry Points
Denario is a Python 3.12+ multi-agent scientific-research assistant. It turns a user’s data/tool description into a research idea, method, computational results, and a LaTeX paper. Primary programmatic entry is the Denario API; CLI support also launches the separately packaged GUI application.
• denario/__init__.py
• denario/denario.py
• denario/cli.py
Workflow Orchestrator and Project State
The Denario façade coordinates the staged workflow: accept or generate data description, idea, methodology, results, and paper. Domain objects model these intermediate artifacts, allowing users to supply Markdown/string content at individual boundaries rather than invoke every generation stage.
• denario/denario.py
• denario/idea.py
• denario/method.py
• denario/experiment.py
Research Generation Pipeline
Idea, method, and experiment/result generation are distinct stages with dedicated prompt assets. The orchestration boundary separates user/project inputs from LLM-produced research plans and from the external analysis backend that performs research computations.
• denario/research.py
• denario/prompts/idea.py
• denario/prompts/method.py
• denario/prompts/experiment.py
LLM and Credential Boundary
LLM access is centralized rather than embedded in individual agents. Denario supports OpenAI, Claude, and Gemini credentials; key/configuration handling forms the external-service boundary for all agent calls.
• denario/llm.py
• denario/key_manager.py
• denario/config.py
LangGraph Research-Agent Subsystem
The main research-agent implementation uses LangGraph graphs, specialized nodes, and routers. It includes agents for idea development, literature handling, methodology, parameter work, PDF reading, and referee/review tasks. Routers determine graph transitions, while prompts define agent behavior.
• denario/langgraph_agents/agents_graph.py
• denario/langgraph_agents/routers.py
• denario/langgraph_agents/literature.py
• denario/langgraph_agents/pdf_reader.py
Analysis Execution Backend
Denario delegates scientific analysis execution to the external cmbagent ecosystem, described as its research-analysis backend. Denario’s experiment/research layers provide the planned method and project context; backend execution returns results and plots that become paper inputs. This is the material integration boundary, not an in-repository numerical engine.
• denario/research.py
• denario/experiment.py
• denario/utils.py
Paper Production Subsystem
A separate agent graph transforms research artifacts and literature context into a manuscript. It has nodes for paper generation, literature/reader operations, parameters, routing, journal selection, and LaTeX rendering. Journal presets and bundled class/style/bibliography files support target publication formats.
• denario/paper_agents/agents_graph.py
• denario/paper_agents/paper_node.py
• denario/paper_agents/journal.py
• denario/paper_agents/latex.py
• denario/paper_agents/LaTeX
Runtime and Deployment
The package runs locally in a Python environment and can be installed with the optional GUI dependency. Docker images package required dependencies including LaTeX; Compose and dev/prod Dockerfiles support containerized execution, volume-mounted projects, and environment-provided API keys. The GUI itself is an external DenarioApp project.
• pyproject.toml
• compose.yaml
• docker/Dockerfile.dev
• docker/Dockerfile.prod
Main entry points: denario.py Denario API · paper_agents/agents_graph.py Paper agent graph · langgraph_agents/agents_graph.py Research agent graph · research.py Research pipeline
Components 18
Entry & Workflow
- Denario API · Primary programmatic workflow entry point.
denario/denario.py - CLI · Launches workflows and the separately packaged GUI.
denario/cli.py - Research artifacts · Idea, method, and experiment artifacts can be supplied or generated per stage.
denario/idea.py - Research pipeline · Generates research plans and delegates computational work.
denario/research.py
Research Agents
- LLM gateway · Centralized OpenAI, Claude, and Gemini access.
denario/llm.py - Credentials & config · Manages provider keys and runtime settings.
denario/key_manager.py - Research agent graph · Coordinates specialized research agents.
denario/langgraph_agents/agents_graph.py - Research routers · Selects transitions between agent stages.
denario/langgraph_agents/routers.py - Literature & PDF agents · Handles literature context and PDF reading.
denario/langgraph_agents/literature.py - Research prompts · Defines idea, method, and experiment generation behavior.
denario/prompts/idea.py
Paper Production
- Paper agent graph · Transforms research artifacts and literature into a manuscript.
denario/paper_agents/agents_graph.py - Manuscript generation
denario/paper_agents/paper_node.py - Journal selection · Selects target journal formatting.
denario/paper_agents/journal.py - LaTeX rendering · Produces the formatted paper using bundled publication assets.
denario/paper_agents/latex.py
Runtime & Deployment
- Local Python runtime
pyproject.toml - Container deployment · Packages dependencies including LaTeX and supplies API keys via environment.
compose.yaml
Other components
- cmbagent backend · Executes planned scientific analysis and returns results and plots.
- DenarioApp GUI · Separately packaged optional GUI.
Connections 21
- CLI → Denario API: invokes
- CLI → DenarioApp GUI: launches
- Denario API → Research artifacts: accepts / produces
- Denario API → Research pipeline: orchestrates
- Research pipeline → Research agent graph: plans research
- Research pipeline → cmbagent backend: delegates analysis
- cmbagent backend → Research artifacts: results and plots
- Research agent graph → Research routers: routes stages
- Research routers → Literature & PDF agents: selects specialist
- Research agent graph → Research prompts: uses
- Research agent graph → LLM gateway: agent calls
- Credentials & config → LLM gateway: configures
- Denario API → Paper agent graph: creates paper
- Research artifacts → Paper agent graph: research inputs
- Literature & PDF agents → Paper agent graph: literature context
- Paper agent graph → Manuscript generation: generates draft
- Paper agent graph → Journal selection: chooses format
- Manuscript generation → LaTeX rendering: renders manuscript
- Journal selection → LaTeX rendering: supplies preset
- Local Python runtime → Denario API: runs
- Container deployment → Local Python runtime: packages