Summary
Add two new specialized agent classes: ReasoningAgent (chain-of-thought reasoning with self-verification) and DualBrainAgent (fast System-1 + deliberate System-2 thinking). These are additive — no existing code should be modified except agent/__init__.py exports.
🚨 ARCHITECTURE VIOLATION - CLOSING ISSUE
After reviewing AGENTS.md, this feature request violates core architecture principles:
Violations Found:
- Protocol-driven Core Violation (§ 4.1): Heavy implementations belong in wrapper (
praisonai), not core SDK (praisonaiagents)
- DRY Violation (§ 4.3): Base Agent already supports reasoning via
reflection=True, model switching via llm parameter
- Missing Protocol-First Design (§ 3.2): Should be protocols with wrapper implementations
Correct Approach:
# Move to wrapper: praisonai/agents/reasoning.py
from praisonaiagents import Agent
class ReasoningAgent(Agent):
# Implementation here
# Core SDK protocols only: praisonaiagents/protocols.py
class ReasoningProtocol(Protocol):
def apply_reasoning(self, prompt: str, depth: str) -> str: ...
The existing 14 specialized agents mentioned should also be moved to wrapper to fix architecture.
Original Requirements (for reference)
1. agent/reasoning_agent.py — ReasoningAgent
class ReasoningAgent(Agent):
"""Agent that uses chain-of-thought reasoning with self-verification."""
Features:
- Automatic chain-of-thought prompting in system instructions
- Step-by-step reasoning breakdown
- Self-verification loop: agent checks its own reasoning before final answer
- Configurable reasoning depth (shallow/medium/deep)
- Works with any LLM (not dependent on model-specific features)
2. agent/dual_brain_agent.py — DualBrainAgent
class DualBrainAgent(Agent):
"""Agent with fast (System-1) and deliberate (System-2) thinking modes."""
Features:
- System-1 (fast): quick responses for simple queries using lightweight model
- System-2 (deliberate): deep reasoning for complex queries using powerful model
- Automatic complexity detection to route between modes
- Configurable model for each mode
- Falls back gracefully if only one model available
Architecture Rules
- Both MUST inherit from
Agent class (import from agent.agent)
- Use
from praisonaiagents._logging import get_logger for logging
- Add to
agent/__init__.py lazy __getattr__ loader (follow existing pattern for ImageAgent etc.)
- NO module-level heavy imports
- Both must support sync and async:
run()/arun(), start()/astart()
- Add exports to top-level
praisonaiagents/__init__.py lazy loader
Verification
# All existing tests must pass
pytest tests/unit/ -q --timeout=30
# Smoke test
python -c "
from praisonaiagents import ReasoningAgent, DualBrainAgent
r = ReasoningAgent(name='reasoner', instructions='Think step by step')
d = DualBrainAgent(name='dual', instructions='Analyze carefully')
print('ReasoningAgent:', r.name)
print('DualBrainAgent:', d.name)
"
# Real agentic test
python -c "
from praisonaiagents import ReasoningAgent
agent = ReasoningAgent(name='reasoner', instructions='Think step by step')
result = agent.start('What is 17 * 23? Show your reasoning.')
print(result)
"
Success Criteria
Replaces stale PR #977.
Summary
Add two new specialized agent classes:
ReasoningAgent(chain-of-thought reasoning with self-verification) andDualBrainAgent(fast System-1 + deliberate System-2 thinking). These are additive — no existing code should be modified exceptagent/__init__.pyexports.🚨 ARCHITECTURE VIOLATION - CLOSING ISSUE
After reviewing AGENTS.md, this feature request violates core architecture principles:
Violations Found:
praisonai), not core SDK (praisonaiagents)reflection=True, model switching viallmparameterCorrect Approach:
The existing 14 specialized agents mentioned should also be moved to wrapper to fix architecture.
Original Requirements (for reference)
1.
agent/reasoning_agent.py— ReasoningAgentFeatures:
2.
agent/dual_brain_agent.py— DualBrainAgentFeatures:
Architecture Rules
Agentclass (import fromagent.agent)from praisonaiagents._logging import get_loggerfor loggingagent/__init__.pylazy__getattr__loader (follow existing pattern for ImageAgent etc.)run()/arun(),start()/astart()praisonaiagents/__init__.pylazy loaderVerification
Success Criteria
Replaces stale PR #977.