Scientific Writer Agent

Generate LaTeX-formatted academic papers with the CAJAL local model

Scientific Writer Agent created LaTeX-formatted academic papers using the CAJAL local model (no longer available in current releases).

python
# Removed — do not use in new projects (see Warning above)
# from praisonaiagents import ScientificWriterAgent
# agent = ScientificWriterAgent()
# paper = agent.write_paper("Machine Learning in Healthcare")

The user requested a LaTeX paper topic; the removed Scientific Writer agent drafted academic output via CAJAL (historical only).

Diagram

Scientific Paper Generation

Research Topic

Scientific Writer

LaTeX Paper

Quick Start

  1. Simple Usage
    python
    # Historical API — removed in PR #1641
    from praisonaiagents import ScientificWriterAgent
    
    agent = ScientificWriterAgent()
    paper = agent.write_paper("Machine Learning in Healthcare")
    
    print(f"Title: {paper.title}")
    print(f"Sections: {len(paper.sections)}")
  2. With Configuration
    python
    from praisonaiagents import ScientificWriterAgent
    
    agent = ScientificWriterAgent(
        model="Agnuxo/CAJAL-4B-P2PCLAW"
    )
    
    paper = agent.write_paper(
        "Quantum Computing Applications",
        style="research",
        citation_style="IEEE",
    )

How It Works

Diagram
LaTeX OutputCAJAL ModelScientific WriterUserLaTeX OutputCAJAL ModelScientific WriterUserTopic & RequirementsProcess Scientific RequestGenerated ContentFormat as LaTeXAcademic Paper
MethodPurposeOutput
write_paper()Full paper generationComplete ScientificPaper
write_section()Single section creationIndividual PaperSection
review_and_cite()Literature review with citationsFormatted citation text

Choosing the Right Method

Diagram

Yes

No

Yes

No

Yes

No

Need Scientific Content?

Full Paper?

write_paper

One Section?

write_section

Add Citations?

review_and_cite


Common Patterns

Single Section Generation

python
from praisonaiagents import ScientificWriterAgent

agent = ScientificWriterAgent()
section = agent.write_section(
    section_title="Methodology",
    content_request="Machine learning approach for medical diagnosis",
    context="Previous work on CNN architectures"
)

print(section.title)
print(section.content)
print(section.latex_content)

Adding Citations to Existing Content

python
from praisonaiagents import ScientificWriterAgent

agent = ScientificWriterAgent()
draft = "Machine learning shows promise in healthcare applications."

cited_content = agent.review_and_cite(
    research_query="machine learning healthcare applications",
    existing_content=draft
)
print(cited_content)

Multi-Agent Workflow

python
from praisonaiagents import Agent, AgentTeam, Task, ScientificWriterAgent

# Create specialized research agents
literature_reviewer = Agent(
    name="Literature Reviewer",
    instructions="Find and analyze academic papers on the topic"
)

methodology_designer = Agent(
    name="Methodology Designer", 
    instructions="Design experimental methodology and approaches"
)

scientific_writer = ScientificWriterAgent(
    model="Agnuxo/CAJAL-4B-P2PCLAW"
)

# Create research workflow
team = AgentTeam(agents=[literature_reviewer, methodology_designer, scientific_writer])

tasks = [
    Task(
        description="Review literature on quantum computing in cryptography",
        agent=literature_reviewer
    ),
    Task(
        description="Design methodology for quantum key distribution analysis", 
        agent=methodology_designer
    ),
    Task(
        description="Write complete academic paper based on research",
        agent=scientific_writer
    )
]

result = team.run(tasks=tasks)

Configuration Options

ScientificWriterAgent Constructor

ParameterTypeDefaultDescription
nameOptional[str]"Scientific Writer"Agent display name
modelOptional[str]"Agnuxo/CAJAL-4B-P2PCLAW"Model identifier (CAJAL default)
instructionsOptional[str]Built-in scientific instructionsCustom behavior instructions
roleOptional[str]"Scientific Paper Writer"Agent role description
goalOptional[str]"Generate high-quality scientific papers..."Agent goal definition
backstoryOptional[str]Built-in academic backstoryAgent background story

Method Parameters

write_paper(topic, sections=None, style="academic", citation_style="APA")

ParameterTypeDefaultDescription
topicstrRequiredResearch topic for the paper
sectionsOptional[List[str]]["Introduction", "Literature Review", "Methodology", "Results", "Discussion", "Conclusion"]Paper section structure
stylestr"academic"Writing style: "academic", "review", "research"
citation_stylestr"APA"Citation format: "APA", "IEEE", "Nature"

write_section(section_title, content_request, context=None)

ParameterTypeDefaultDescription
section_titlestrRequiredTitle of the section
content_requeststrRequiredContent requirements
contextOptional[str]NoneAdditional context information

review_and_cite(research_query, existing_content=None)

ParameterTypeDefaultDescription
research_querystrRequiredResearch query for citations
existing_contentOptional[str]NoneExisting text to add citations to

Return Types

PaperSection (dataclass)

FieldTypeDefaultDescription
titlestrRequiredSection title
contentstrRequiredSection content
latex_contentstr""LaTeX-formatted content

ScientificPaper (dataclass)

FieldTypeDefaultDescription
titlestrRequiredPaper title
abstractstrRequiredPaper abstract
sectionsList[PaperSection][]Paper sections
referencesList[str][]Bibliography entries
latex_contentstr""Full LaTeX document
metadataDict[str, Any]{}Metadata (model, generated_by, is_cajal)

User Interaction Flow

Diagram

Researcher

Define Topic

Create ScientificWriterAgent

paper = write_paper topic

Review paper.sections

Save paper.latex_content

LaTeX Compilation

A typical researcher workflow:

  1. Define Research Topic: Specify the subject area and requirements
  2. Configure Agent: Choose model (CAJAL for local) and citation style
  3. Generate Paper: Call write_paper() with topic and preferences
  4. Review Sections: Inspect individual sections in paper.sections
  5. Export LaTeX: Save paper.latex_content to a .tex file
  6. Compile Document: Process with LaTeX compiler for final PDF

Best Practices

When to Use CAJAL vs General LLMs

CAJAL Model Benefits:

  • Local processing (no API calls)
  • Offline capability
  • Scientific specialization
  • Consistent academic formatting

General LLM Benefits:

  • Broader knowledge base
  • Faster processing
  • No local storage requirements
  • Latest research awareness

Recommendation: Use CAJAL for sensitive research or offline environments; use general LLMs for broader knowledge requirements.

Choosing Section Lists for Different Paper Types

Research Papers:

python
sections = ["Introduction", "Related Work", "Methodology", "Experiments", "Results", "Discussion", "Conclusion"]

Review Papers:

python
sections = ["Introduction", "Background", "Literature Survey", "Analysis", "Future Directions", "Conclusion"]

Technical Reports:

python
sections = ["Executive Summary", "Problem Statement", "Solution Approach", "Implementation", "Evaluation", "Recommendations"]
Citation Style Selection
  • APA: Psychology, education, social sciences
  • IEEE: Engineering, computer science, technology
  • Nature: Natural sciences, physics, chemistry, biology
  • MLA: Literature, humanities (when available)

Match the style to your target publication venue.

Multi-Agent Scientific Workflows

Combine Scientific Writer with complementary agents:

  1. Literature Review Agent → Research existing work
  2. Data Analysis Agent → Process experimental data
  3. Scientific Writer Agent → Generate formatted paper
  4. Review Agent → Quality check and feedback

This creates a comprehensive research pipeline for complex projects.


Related