Skip to main content
The ReasoningDuo class implements a dual-agent reasoning system that combines a reasoning agent and a main agent to provide well-thought-out responses to complex tasks. This architecture separates the reasoning process from the final response generation.

Architecture

Parameters

reasoning_model_name defaults to "gpt-4o", so model_names[0] is ignored unless you set reasoning_model_name=None. Set reasoning_model_name to choose the reasoning agent’s model.

Methods

How a run works

Each run() starts from an empty conversation, so one task never leaks into the next and every batched_run result holds only its own task. After a run, duo.conversation holds that run’s messages. In each loop, the reasoning agent (named <agent_name>-reasoning) answers first, then the main agent (<agent_name>-main) answers with the reasoning in front of it. Both agents read the shared conversation as chat turns: an agent’s own earlier answers arrive as assistant turns and its partner’s as labelled user turns. The first loop sends your task. Each later loop sends “Continue reasoning and refining your analysis.”

Quick Start

Examples

Mathematical Analysis

Financial Analysis

Customizing Agent Behavior

Batch Processing

Best Practices

  1. Task Formulation: Be specific and clear in task descriptions. Include relevant context and constraints.
  2. Performance Optimization: Use batched_run for multiple related tasks. Monitor agent outputs for consistency.
  3. Model Selection: Adjust model parameters based on task complexity.