You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
PraisonAI PR #1644 (merged) adds a brand-new Scientific Writing example set under examples/scientific_writing/ in the PraisonAI repo. This is a re-implementation of the previously-reverted CAJAL Scientific Writer feature (PR #1611 → revert #1641), now correctly placed as user-facing examples per AGENTS.md §4.1.
These examples are not currently documented in PraisonAIDocs and need a new documentation page (no existing page covers LaTeX/academic-paper generation or the CAJAL-4B HuggingFace model).
Action required: Create one new documentation page that walks the user through using PraisonAI to generate scientific/LaTeX papers, both single-agent and multi-agent (Python + YAML).
Different scope: research-assistant is a web-search → gap-analysis → experiment-design pipeline. Scientific Writing is paper generation in LaTeX with a domain-specific model.
Update an existing recipe under docs/examples/agent-recipes/documents/
❌ No
Recipe pages are short single-task docs. This example showcases the agent-centric multi-agent + 3-way (Python/YAML/CLI) pattern and deserves a full case-study page.
Create new pagedocs/examples/scientific-writer.mdx
✅ Yes
Joins peer pages such as research-assistant.mdx, healthcare-diagnosis.mdx, medicine-protocol.mdx in the Examples → Examples group. ~200–300 lines like the others.
File to create
Path:docs/examples/scientific-writer.mdx
Frontmatter:
---
title: "Scientific Writer"sidebarTitle: "Scientific Writer"description: "Generate LaTeX-formatted academic papers with the CAJAL-4B model — single agent or multi-agent workflow"icon: "graduation-cap"
---
Suggested icon alternatives:graduation-cap, microscope-circle, flask, book-open-cover. Pick whatever is consistent with peers in docs/examples/.
docs.json update required
Add the new page to the Examples → Examples group at docs.json line ~2145, right after research-assistant:
"docs/examples/research-assistant",
"docs/examples/scientific-writer", // ← add this line"docs/examples/quantum-optimiser"
⚠️ Per AGENTS.md §1.8, do not place this in docs/concepts/ or in any auto-generated section. The Examples → Examples group is the correct location.
Content the page MUST cover
Follow the AGENTS.md page-structure template (frontmatter → hero mermaid diagram → Quick Start <Steps> → How It Works → Configuration → Common Patterns → Best Practices → Related). Be agent-centric, beginner-friendly, and progressive.
Section 1 — Hero Mermaid diagram
Show the agent-centric flow. Use the standard color scheme (#8B0000, #189AB4, #10B981, #F59E0B, #6366F1).
graph LR
Topic[📝 Research Topic] --> Writer[🧪 Scientific Writer Agent]
Writer --> LaTeX[📄 LaTeX Section]
Writer --> Cite[📚 APA Citation]
LaTeX --> Paper[📑 Final Paper]
Cite --> Paper
classDef input fill:#6366F1,stroke:#7C90A0,color:#fff
classDef agent fill:#8B0000,stroke:#7C90A0,color:#fff
classDef tool fill:#189AB4,stroke:#7C90A0,color:#fff
classDef result fill:#10B981,stroke:#7C90A0,color:#fff
class Topic input
class Writer agent
class LaTeX,Cite tool
class Paper result
Loading
Section 2 — Setup
pip install "praisonaiagents[llm]"export HUGGINGFACE_API_KEY="your-key"# for CAJAL-4B via litellm# Optional fallback: export OPENAI_API_KEY="your-key"
The very first code block on the page must be a minimal agent-centric example so the user feels "is it really this easy?".
frompraisonaiagentsimportAgent, tool@tooldefformat_latex_section(title: str, content: str) ->str:
"""Wrap prose in a LaTeX \\section{} block."""returnf"\\section{{{title}}}\n{content}\n"@tooldefformat_citation(authors: str, year: int, title: str, venue: str) ->str:
"""Render an APA citation."""returnf"{authors} ({year}). {title}. *{venue}*."agent=Agent(
name="Scientific Writer",
instructions="You are a specialised scientific paper writer. Use LaTeX formatting and APA citations.",
llm="huggingface/Agnuxo/CAJAL-4B-P2PCLAW",
tools=[format_latex_section, format_citation],
)
agent.start(
"Write a short paper (Abstract + Introduction + Conclusion) on ""'Climate change effects on coral reef biodiversity'."
)
💡 Tip callout: swap llm="huggingface/Agnuxo/CAJAL-4B-P2PCLAW" for any other model (e.g. gpt-4o-mini) to use a general-purpose LLM if HuggingFace access is unavailable.
Use a sequence diagram to show the agent collaboration:
sequenceDiagram
participant User
participant Reviewer as Literature Reviewer
participant Designer as Methodology Designer
participant Writer as Scientific Writer
User->>Reviewer: Topic
Reviewer-->>Designer: Literature review (APA)
Designer-->>Writer: Methods (LaTeX)
Writer-->>User: Complete LaTeX paper
Loading
Then show the Python multi-agent code, copied/adapted from examples/scientific_writing/multi_agent_paper.py:
frompraisonaiagentsimportAgent, AgentTeam, Taskliterature_reviewer=Agent(
name="Literature Reviewer",
instructions="Survey academic literature. Produce 5–8 APA citations.",
tools=[format_citation],
)
methodology_designer=Agent(
name="Methodology Designer",
instructions="Design a reproducible research methodology.",
tools=[format_latex_section],
)
scientific_writer=Agent(
name="Scientific Writer",
instructions="Assemble the final paper. Use LaTeX + APA.",
llm="huggingface/Agnuxo/CAJAL-4B-P2PCLAW",
tools=[format_latex_section, format_citation],
)
topic="Transformer architectures for protein folding prediction"t1=Task(name="review_literature", description=f"Review literature on: {topic}",
agent=literature_reviewer, expected_output="APA literature review.")
t2=Task(name="design_methodology", description=f"Design methodology for: {topic}",
agent=methodology_designer, expected_output="LaTeX methods section.")
t3=Task(name="write_paper",
description=f"Combine review + methodology into a full paper on: {topic}.",
agent=scientific_writer, expected_output="Complete LaTeX paper.")
team=AgentTeam(
agents=[literature_reviewer, methodology_designer, scientific_writer],
tasks=[t1, t2, t3],
)
print(team.start())
Section 5 — Run with YAML (3-way parity)
Use <Tabs> or <CodeGroup> to show YAML alternative. Copy verbatim from examples/scientific_writing/agents.yaml:
framework: praisonaitopic: "Climate change effects on coral reef biodiversity"roles:
literature_reviewer:
role: "Literature Reviewer"goal: "Survey recent academic work on {topic} and produce an APA review."backstory: "Expert in academic literature surveying and citation hygiene."llm: "gpt-4o-mini"tasks:
review_literature:
description: "Produce a concise literature review with 5-8 APA citations."expected_output: "APA-formatted literature review."methodology_designer:
role: "Methodology Designer"goal: "Design a reproducible research methodology for {topic}."backstory: "Specialises in rigorous experimental design."llm: "gpt-4o-mini"tasks:
design_methodology:
description: "Write a reproducible methods section in LaTeX."expected_output: "LaTeX methods section."scientific_writer:
role: "Scientific Writer"goal: "Assemble the final LaTeX paper on {topic}."backstory: >- Specialised in LaTeX-formatted academic papers, fine-tuned on scientific literature (CAJAL-4B checkpoint).llm: "huggingface/Agnuxo/CAJAL-4B-P2PCLAW"tasks:
write_paper:
description: >- Combine the literature review and methodology into a full scientific paper on {topic}. Use LaTeX formatting.expected_output: "Complete LaTeX paper."
Run command:
praisonai agents run --file agents.yaml
Section 6 — Decision diagram: which option to choose?
Per AGENTS.md §6.1, when multiple options exist on one page, include a "which to choose" mermaid diagram so non-developers don't get confused:
graph TB
Q{Need full paper<br/>with literature + methods?}
Q -->|No, just one section| Single[Single Agent<br/>scientific_writer.py]
Q -->|Yes| Q2{Prefer code<br/>or config file?}
Q2 -->|Python code| Multi[Multi-Agent<br/>multi_agent_paper.py]
Q2 -->|YAML config| YAML[YAML workflow<br/>agents.yaml]
classDef question fill:#F59E0B,stroke:#7C90A0,color:#fff
classDef option fill:#189AB4,stroke:#7C90A0,color:#fff
class Q,Q2 question
class Single,Multi,YAML option
Loading
Section 7 — Configuration / Tools table
Tool
Purpose
Inputs
format_latex_section
Wrap prose in \section{}
title: str, content: str
format_citation
Build APA citation line
authors: str, year: int, title: str, venue: str
Section 8 — Best Practices (<AccordionGroup>)
Cover at least:
Choosing the right model (CAJAL-4B for LaTeX-fluent output vs. general-purpose gpt-4o-mini when HF access is unavailable)
Adding more @tool functions (e.g. format_equation, format_table, format_figure_caption) to extend the writer
Splitting long papers across multiple agents/tasks (one task per section)
HuggingFace API key vs. local inference server for CAJAL-4B
Section 9 — Related (<CardGroup cols={2}>)
Link to:
/docs/examples/research-assistant — multi-agent research workflow
/docs/concepts/agents — Agent fundamentals
/docs/concepts/tasks (or equivalent) — Task and AgentTeam
Summary
PraisonAI PR #1644 (merged) adds a brand-new Scientific Writing example set under
examples/scientific_writing/in the PraisonAI repo. This is a re-implementation of the previously-reverted CAJAL Scientific Writer feature (PR #1611 → revert #1641), now correctly placed as user-facing examples per AGENTS.md §4.1.These examples are not currently documented in PraisonAIDocs and need a new documentation page (no existing page covers LaTeX/academic-paper generation or the CAJAL-4B HuggingFace model).
Action required: Create one new documentation page that walks the user through using PraisonAI to generate scientific/LaTeX papers, both single-agent and multi-agent (Python + YAML).
Source PR Reference
db430fe57dd168d66848360f89a20b6d0e684406mainexamples/scientific_writing/scientific_writer.py(85 lines) — single-agentexamples/scientific_writing/multi_agent_paper.py(73 lines) — 3-agent workflowexamples/scientific_writing/agents.yaml(40 lines) — YAML parityDecision: New page vs. update existing
docs/examples/research-assistant.mdxresearch-assistantis a web-search → gap-analysis → experiment-design pipeline. Scientific Writing is paper generation in LaTeX with a domain-specific model.docs/examples/agent-recipes/documents/docs/examples/scientific-writer.mdxresearch-assistant.mdx,healthcare-diagnosis.mdx,medicine-protocol.mdxin the Examples → Examples group. ~200–300 lines like the others.File to create
Path:
docs/examples/scientific-writer.mdxFrontmatter:
Suggested icon alternatives:
graduation-cap,microscope-circle,flask,book-open-cover. Pick whatever is consistent with peers indocs/examples/.docs.json update required
Add the new page to the
Examples → Examplesgroup atdocs.jsonline ~2145, right afterresearch-assistant:Content the page MUST cover
Follow the AGENTS.md page-structure template (frontmatter → hero mermaid diagram → Quick Start
<Steps>→ How It Works → Configuration → Common Patterns → Best Practices → Related). Be agent-centric, beginner-friendly, and progressive.Section 1 — Hero Mermaid diagram
Show the agent-centric flow. Use the standard color scheme (
#8B0000,#189AB4,#10B981,#F59E0B,#6366F1).graph LR Topic[📝 Research Topic] --> Writer[🧪 Scientific Writer Agent] Writer --> LaTeX[📄 LaTeX Section] Writer --> Cite[📚 APA Citation] LaTeX --> Paper[📑 Final Paper] Cite --> Paper classDef input fill:#6366F1,stroke:#7C90A0,color:#fff classDef agent fill:#8B0000,stroke:#7C90A0,color:#fff classDef tool fill:#189AB4,stroke:#7C90A0,color:#fff classDef result fill:#10B981,stroke:#7C90A0,color:#fff class Topic input class Writer agent class LaTeX,Cite tool class Paper resultSection 2 — Setup
Section 3 — Quick Start (single agent, agent-centric)
The very first code block on the page must be a minimal agent-centric example so the user feels "is it really this easy?".
Section 4 — Multi-agent workflow (Literature Reviewer → Methodology Designer → Writer)
Use a sequence diagram to show the agent collaboration:
sequenceDiagram participant User participant Reviewer as Literature Reviewer participant Designer as Methodology Designer participant Writer as Scientific Writer User->>Reviewer: Topic Reviewer-->>Designer: Literature review (APA) Designer-->>Writer: Methods (LaTeX) Writer-->>User: Complete LaTeX paperThen show the Python multi-agent code, copied/adapted from
examples/scientific_writing/multi_agent_paper.py:Section 5 — Run with YAML (3-way parity)
Use
<Tabs>or<CodeGroup>to show YAML alternative. Copy verbatim fromexamples/scientific_writing/agents.yaml:Run command:
Section 6 — Decision diagram: which option to choose?
Per AGENTS.md §6.1, when multiple options exist on one page, include a "which to choose" mermaid diagram so non-developers don't get confused:
graph TB Q{Need full paper<br/>with literature + methods?} Q -->|No, just one section| Single[Single Agent<br/>scientific_writer.py] Q -->|Yes| Q2{Prefer code<br/>or config file?} Q2 -->|Python code| Multi[Multi-Agent<br/>multi_agent_paper.py] Q2 -->|YAML config| YAML[YAML workflow<br/>agents.yaml] classDef question fill:#F59E0B,stroke:#7C90A0,color:#fff classDef option fill:#189AB4,stroke:#7C90A0,color:#fff class Q,Q2 question class Single,Multi,YAML optionSection 7 — Configuration / Tools table
format_latex_section\section{}title: str,content: strformat_citationauthors: str,year: int,title: str,venue: strSection 8 — Best Practices (
<AccordionGroup>)Cover at least:
gpt-4o-miniwhen HF access is unavailable)@toolfunctions (e.g.format_equation,format_table,format_figure_caption) to extend the writerSection 9 — Related (
<CardGroup cols={2}>)Link to:
/docs/examples/research-assistant— multi-agent research workflow/docs/concepts/agents— Agent fundamentals/docs/concepts/tasks(or equivalent) — Task and AgentTeam/docs/features/yaml-config(or equivalent) — YAML configurationConstraints & rules to follow (from AGENTS.md)
docs/examples/(Examples tab). NOTdocs/concepts/(humans only) and NOTdocs/js/ordocs/rust/(auto-generated).from praisonaiagents import Agent, AgentTeam, Task, tool— no submodule imports.<Steps>,<AccordionGroup>,<CardGroup>,<Tabs>,<Note>/<Tip>/<Warning>.docs.jsonis still valid JSON after the addition.docs/examples/research-assistant.mdx.Acceptance criteria
docs/examples/scientific-writer.mdxexists with all sections above.title,sidebarTitle,description,icon).multi_agent_paper.py.agents.yamlbyte-for-byte (preserved verbatim).docs.jsonupdated — page added toExamples → Examplesgroup, valid JSON, builds without errors.docs/concepts/,docs/js/, ordocs/rust/.Triggered by PR MervinPraison/PraisonAI#1644 merge on 2026-05-09. Another agent will pick up this issue and create the documentation page.