Files
DeepTutor/deeptutor/agents/__init__.py
Bingxi Zhao (Frank) 23ca3024be refactor(agents): rebuild Deep Research / Deep Solve / Question on agentic engine
Replaces three bespoke multi-agent pipelines with orchestrators on top
of a shared agentic-engine primitive set (core/agentic/: labeled_step,
loop, tool_dispatch, usage, client). Each capability now lives in one
pipeline.py file with one pipeline.yaml prompt.

- Deep Research: Rephrase (ask_user loop) -> Decompose (OUTLINE) ->
  Research blocks (THINK/TOOL/APPEND/FINISH per topic, dynamic queue
  preserved) -> Reporting (OUTLINE/INTRO/SECTION/CONCLUSION).
  CitationManager and the dynamic topic queue are kept.
- Deep Solve: Pre-retrieve (KB-only, QUERIES/rag/SUMMARY) -> Plan ->
  per-step THINK/TOOL/FINISH/REPLAN loop with back-edge to Plan ->
  Synthesize. Step FINISH text flows into the next step's context.
- Question: coordinator + pipeline replace generator / idea_agent /
  models, with new history.py and mimic_source.py helpers.

Removed: research/agents/, research/research_pipeline.py,
research/prompts/{en,zh}/*.yaml (legacy multi-agent prompts);
solve/agents/, solve/memory/, solve/utils/, main_solver.py,
session_manager.py, tool_runtime.py and old prompts;
question/agents/{generator,idea_agent}.py, example.py, models.py,
old prompts; api/routers/solve.py (capability owns its own routing).

Adds shared agents/_shared/tool_composition.py for cross-pipeline
tool wiring. Updates deep_research/deep_solve/deep_question
capabilities to dispatch through the new pipelines.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-21 18:03:44 +08:00

27 lines
980 B
Python

"""
Agents Module - Unified agent system for OpenTutor.
This module provides a unified BaseAgent class and module-specific agents:
- solve: Multi-step problem solving (``SolvePipeline`` on the agentic engine)
- research: Deep research agents (DecomposeAgent, ResearchAgent, etc.)
- question: Question generation agents (ReAct architecture, separate base)
- chat: ``AgenticChatPipeline`` — single-loop chat on the agentic engine
Note: ``co_writer`` and ``book`` are independent top-level modules under
``deeptutor/`` (e.g. ``deeptutor.co_writer``, ``deeptutor.book``). They
still inherit from :class:`BaseAgent` defined here but are not part of
the ``deeptutor.agents`` package.
Usage:
from deeptutor.agents.base_agent import BaseAgent
class MyAgent(BaseAgent):
async def process(self, *args, **kwargs):
...
"""
from .base_agent import BaseAgent
from .chat import ChatAgent, SessionManager
__all__ = ["BaseAgent", "ChatAgent", "SessionManager"]