Spaces:
Running
A newer version of the Gradio SDK is available:
6.1.0
Agents API Reference
This page documents the API for DeepCritical agents.
KnowledgeGapAgent
Module: src.agents.knowledge_gap
Purpose: Evaluates research state and identifies knowledge gaps.
Methods
evaluate
KnowledgeGapAgent.evaluate start_line:66 end_line:74
Evaluates research completeness and identifies outstanding knowledge gaps.
Parameters:
query: Research query stringbackground_context: Background context for the query (default: "")conversation_history: History of actions, findings, and thoughts as string (default: "")iteration: Current iteration number (default: 0)time_elapsed_minutes: Elapsed time in minutes (default: 0.0)max_time_minutes: Maximum time limit in minutes (default: 10)
Returns: KnowledgeGapOutput with:
research_complete: Boolean indicating if research is completeoutstanding_gaps: List of remaining knowledge gaps
ToolSelectorAgent
Module: src.agents.tool_selector
Purpose: Selects appropriate tools for addressing knowledge gaps.
Methods
select_tools
ToolSelectorAgent.select_tools start_line:78 end_line:84
Selects tools for addressing a knowledge gap.
Parameters:
gap: The knowledge gap to addressquery: Research query stringbackground_context: Optional background context (default: "")conversation_history: History of actions, findings, and thoughts as string (default: "")
Returns: AgentSelectionPlan with list of AgentTask objects.
WriterAgent
Module: src.agents.writer
Purpose: Generates final reports from research findings.
Methods
write_report
WriterAgent.write_report start_line:67 end_line:73
Generates a markdown report from research findings.
Parameters:
query: Research query stringfindings: Research findings to include in reportoutput_length: Optional description of desired output length (default: "")output_instructions: Optional additional instructions for report generation (default: "")
Returns: Markdown string with numbered citations.
LongWriterAgent
Module: src.agents.long_writer
Purpose: Long-form report generation with section-by-section writing.
Methods
write_next_section
LongWriterAgent.write_next_section start_line:94 end_line:100
Writes the next section of a long-form report.
Parameters:
original_query: The original research queryreport_draft: Current report draft as string (all sections written so far)next_section_title: Title of the section to writenext_section_draft: Draft content for the next section
Returns: LongWriterOutput with formatted section and references.
write_report
LongWriterAgent.write_report start_line:263 end_line:268
Generates final report from draft.
Parameters:
query: Research query stringreport_title: Title of the reportreport_draft: Complete report draft
Returns: Final markdown report string.
ProofreaderAgent
Module: src.agents.proofreader
Purpose: Proofreads and polishes report drafts.
Methods
proofread
ProofreaderAgent.proofread start_line:72 end_line:76
Proofreads and polishes a report draft.
Parameters:
query: Research query stringreport_title: Title of the reportreport_draft: Report draft to proofread
Returns: Polished markdown string.
ThinkingAgent
Module: src.agents.thinking
Purpose: Generates observations from conversation history.
Methods
generate_observations
ThinkingAgent.generate_observations start_line:70 end_line:76
Generates observations from conversation history.
Parameters:
query: Research query stringbackground_context: Optional background context (default: "")conversation_history: History of actions, findings, and thoughts as string (default: "")iteration: Current iteration number (default: 1)
Returns: Observation string.
InputParserAgent
Module: src.agents.input_parser
Purpose: Parses and improves user queries, detects research mode.
Methods
parse
InputParserAgent.parse start_line:82 end_line:82
Parses and improves a user query.
Parameters:
query: Original query string
Returns: ParsedQuery with:
original_query: Original query stringimproved_query: Refined query stringresearch_mode: "iterative" or "deep"key_entities: List of key entitiesresearch_questions: List of research questions
Factory Functions
All agents have factory functions in src.agent_factory.agents:
Factory Functions start_line:30 end_line:50
Parameters:
model: Optional Pydantic AI model. If None, usesget_model()from settings.oauth_token: Optional OAuth token from HuggingFace login (takes priority over env vars)
Returns: Agent instance.
See Also
- Architecture - Agents - Architecture overview
- Models API - Data models used by agents