Dual-agent collaborative system that separates reasoning and execution phases for more robust and reliable outputs
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
Task Input → Reasoning Agent → Structured Analysis → Main Agent → Final Output
Parameters
Parameter
Type
Default
Description
id
str
generate_id("reasoning-duo")
Unique identifier for the duo (<prefix>-<32 hex chars>)
agent_name
str
"reasoning-agent-01"
Base name for the two internal agents, which are suffixed -reasoning and -main
agent_description
str
"A highly intelligent..."
Description given to both internal agents as their agent_description
model_name
str
"gpt-5.4"
Model for the main agent when model_names is not given, and for the reasoning agent too unless reasoning_model_name is set
description
str
"A highly intelligent..."
Stored on the instance; not used by either internal agent
model_names
list[str]
["gpt-5.4", "gpt-5.4"]
model_names[1] is the main agent’s model. model_names[0] is used for the reasoning agent only when reasoning_model_name is None
system_prompt
str
"You are a helpful..."
System prompt for the main agent. The reasoning agent always uses the built-in REASONING_PROMPT
output_type
OutputType
"dict-all-except-first"
Format of the value returned by run()
reasoning_model_name
Optional[str]
None
Model used by the reasoning agent. None runs it on model_names[0], or on model_name when model_names is not given, so a duo built on one provider stays on it
max_loops
int
1
Number of reasoning/main-agent loop iterations in run()
*args, **kwargs
Extra Agent arguments applied to both internal agents
reasoning_model_name defaults to None, which runs the reasoning agent on model_names[0] (or on model_name when model_names is not given). Set it to put the reasoning agent on a different model.
Methods
Method
Parameters
Returns
Description
step
task: str, img: Optional[str] = None
None
Runs one reasoning-agent → main-agent cycle and appends to the conversation
run
task: str, img: Optional[str] = None
Formatted per output_type
Starts a new conversation, then processes the task through both agents for max_loops iterations
Processes multiple tasks sequentially. imgs pairs one image with each task and must be the same length as tasks, or ValueError is raised
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
from swarms import ReasoningDuoduo = ReasoningDuo( agent_name="reasoning-agent-01", reasoning_model_name="claude-sonnet-4-6", model_names=["claude-sonnet-4-6", "gpt-5.4"],)result = duo.run("Explain the concept of gravitational waves")
Examples
Mathematical Analysis
from swarms import ReasoningDuoduo = ReasoningDuo()math_task = """Solve the following differential equation:dy/dx + 2y = x^2, y(0) = 1"""solution = duo.run(math_task)
Financial Analysis
from swarms import ReasoningDuoduo = ReasoningDuo()finance_task = """Calculate the Net Present Value (NPV) of a project with:- Initial investment: $100,000- Annual cash flows: $25,000 for 5 years- Discount rate: 8%"""analysis = duo.run(finance_task)
Customizing Agent Behavior
from swarms import ReasoningDuoduo = ReasoningDuo( agent_name="custom-reasoning-agent", reasoning_model_name="claude-sonnet-4-6", model_names=["claude-sonnet-4-6", "gpt-5.4"], system_prompt="You are a financial expert AI assistant...", output_type="final",)
Batch Processing
from swarms import ReasoningDuoduo = ReasoningDuo()tasks = [ "Analyze market trends for tech stocks", "Calculate risk metrics for a portfolio", "Forecast revenue growth"]results = duo.batched_run(tasks)
Best Practices
Task Formulation: Be specific and clear in task descriptions. Include relevant context and constraints.
Performance Optimization: Use batched_run for multiple related tasks. Monitor agent outputs for consistency.
Model Selection: Adjust model parameters based on task complexity.
Was this page helpful?
{"docsConfig":{"theme":"mint","$schema":"https://mintlify.com/docs.json","name":"swarms","colors":{"primary":"#DC2626","light":"#FFFFFF","dark":"#000000"},"logo":{"light":"https://mintcdn.com/kyegomez-swarms-97/2Wfh9aBTbMWV_Lyz/logo/light.svg?fit=max\u0026auto=format\u0026n=2Wfh9aBTbMWV_Lyz\u0026q=85\u0026s=e3d664b8b8f6928c836776b54704d076","dark":"https://mintcdn.com/kyegomez-swarms-97/2Wfh9aBTbMWV_Lyz/logo/dark.svg?fit=max\u0026auto=format\u0026n=2Wfh9aBTbMWV_Lyz\u0026q=85\u0026s=d1f710292b2b40794b44a3168a6b09dc"},"favicon":"https://mintcdn.com/kyegomez-swarms-97/UEClO9jJGrigmMUe/logo.svg?fit=max\u0026auto=format\u0026n=UEClO9jJGrigmMUe\u0026q=85\u0026s=07dcb5f5b9bca5ec8fd6475dcc9b5484","navbar":{"primary":{"type":"github","href":"https://github.com/kyegomez/swarms"}},"footer":{"socials":{"twitter":"https://twitter.com/swarms_corp","github":"https://github.com/kyegomez/swarms","website":"https://swarms.ai","linkedin":"https://www.linkedin.com/company/the-swarm-corporation","discord":"https://discord.gg/EamjgSaEQf","youtube":"https://www.youtube.com/channel/UC9yXyitkbU_WSy7bd_41SqQ","medium":"https://medium.com/@kyeg"}},"contextual":{"options":["copy","view","chatgpt","claude","cursor","vscode"],"display":"header"},"styling":{"latex":true},"navigation":{"pages":[]}},"deployment":{"deploymentMetadataValue":{"subdomain":"kyegomez-swarms-97","hasAudioNarration":false,"actualSubdomain":"kyegomez-swarms-97","customDomains":["docs.swarms.world"],"gitSource":{"type":"github","owner":"the-swarm-corporation","repo":"swarms-framework-docs","deployBranch":"main","contentDirectory":"","isPrivate":true,"mountPath":"","label":""},"feedback":{"thumbs":true},"entitlements":{},"buildId":"6af623032605b19aec5ee06a","clientVersion":"0.0.4128","searchFilterCounts":[{"language":"default","tag":"Examples","count":121},{"language":"default","tag":"Documentation","count":60},{"language":"default","tag":"API Reference","count":60},{"language":"default","tag":"Multi-Agent Harnesses","count":36},{"language":"default","tag":"RouteHub","count":17},{"language":"default","tag":"Comms Channels","count":15},{"language":"default","tag":"MCP Tool Integrations","count":15},{"language":"default","tag":"Model Providers","count":14},{"language":"default","tag":"Community","count":13},{"language":"default","tag":"Multi-Agent Architectures","count":12}]},"assistantConfig":{"enableAskAiButton":false,"enableStarterQuestions":false,"enableContextualStarterQuestions":false,"enableAskAiSearchBar":true},"basePath":"","hasChatPermissions":false,"hasWebMcpPermissions":false,"toggles":[{"name":"kill-isr","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"custom-rbac-roles","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"agent-mintlify-slack","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"agent-integrations-settings","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"rbac-expansion","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automations-pr-grouping","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"custom-prefix","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"analytics-v7","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"user-flows-analytics","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"no-publish-flow","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-onboarding","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"snapshot-serving-live","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"stripTemperatureMiddleware","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"support-platform-pylon-zendesk","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"snapshot-serving","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"instant-rollback","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"granular-notifications-server","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"granular-notifications","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automations-fable","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"fixed-ai-action-pricing","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automation-resolve-merge-conflict","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"scoped-publishing","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"mintql","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"page-level-analytics","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-version-history-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"billing-page-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"full-page-search","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workspace-projects","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"assistant-v5","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"fork-pr-previews","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"revalidation-jwt","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-sso-scim","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"hobby-abuse-scan","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"dashboard-inbox","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-signup","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"turbopuffer-dual-write","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-enabled","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"approve-review-flow","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-metadata","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"sso-setup-deadline-banner","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"turbopuffer-serve","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"live-agents","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"llms-txt-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false}],"googleFontsInlined":false},"customCss":[],"page":{"pagePath":"agents/reasoning-duo","slug":"/agents/reasoning-duo","pageMetadata":{"title":"Reasoning Duo","description":"Dual-agent collaborative system that separates reasoning and execution phases for more robust and reliable outputs","icon":"people-arrows","href":"/agents/reasoning-duo"},"description":{"compiledSource":"\"use strict\";\nconst {jsx: _jsx} = arguments[0];\nconst {useMDXComponents: _provideComponents} = arguments[0];\nfunction _createMdxContent(props) {\n const _components = {\n p: \"p\",\n ..._provideComponents(),\n ...props.components\n };\n return _jsx(_components.p, {\n children: \"Dual-agent collaborative system that separates reasoning and execution phases for more robust and reliable outputs\"\n });\n}\nfunction MDXContent(props = {}) {\n const {wrapper: MDXLayout} = {\n ..._provideComponents(),\n ...props.components\n };\n return MDXLayout ? _jsx(MDXLayout, {\n ...props,\n children: _jsx(_createMdxContent, {\n ...props\n })\n }) : _createMdxContent(props);\n}\nreturn {\n default: MDXContent\n};\n","frontmatter":{},"scope":{}},"pageType":"default","mdx":{"mdxSource":{"compiledSource":"\"use strict\";const{Fragment:_Fragment,jsx:_jsx,jsxs:_jsxs}=arguments[0];const{useMDXComponents:_provideComponents}=arguments[0];function _createMdxContent(props){const _components={code:`code`,li:`li`,ol:`ol`,p:`p`,pre:`pre`,span:`span`,strong:`strong`,tbody:`tbody`,td:`td`,th:`th`,thead:`thead`,tr:`tr`,..._provideComponents(),...props.components},{CodeBlock,Heading,Table,Warning}=_components;if(!CodeBlock)_missingMdxReference(`CodeBlock`,true);if(!Heading)_missingMdxReference(`Heading`,true);if(!Table)_missingMdxReference(`Table`,true);if(!Warning)_missingMdxReference(`Warning`,true);return _jsxs(_Fragment,{children:[_jsxs(_components.p,{children:[`The `,_jsx(_components.code,{children:`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.`]}),`\n`,_jsx(Heading,{level:`2`,id:`architecture`,children:`Architecture`}),`\n`,_jsx(CodeBlock,{numberOfLines:`2`,language:`text`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`text`,children:_jsxs(_components.code,{language:`text`,numberOfLines:`2`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`Task Input → Reasoning Agent → Structured Analysis → Main Agent → Final Output`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{})})]})})}),`\n`,_jsx(Heading,{level:`2`,id:`parameters`,children:`Parameters`}),`\n`,_jsxs(Table,{children:[_jsx(_components.thead,{children:_jsxs(_components.tr,{children:[_jsx(_components.th,{children:`Parameter`}),_jsx(_components.th,{children:`Type`}),_jsx(_components.th,{children:`Default`}),_jsx(_components.th,{children:`Description`})]})}),_jsxs(_components.tbody,{children:[_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`id`})}),_jsx(_components.td,{children:_jsx(_components.code,{children:`str`})}),_jsx(_components.td,{children:_jsx(_components.code,{children:`generate_id(\"reasoning-duo\")`})}),_jsxs(_components.td,{children:[`Unique identifier for the duo (`,_jsx(_components.code,{children:`\u003cprefix>-\u003c32 hex chars>`}),`)`]})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`agent_name`})}),_jsx(_components.td,{children:_jsx(_components.code,{children:`str`})}),_jsx(_components.td,{children:_jsx(_components.code,{children:`\"reasoning-agent-01\"`})}),_jsxs(_components.td,{children:[`Base name for the two internal agents, which are suffixed `,_jsx(_components.code,{children:`-reasoning`}),` and `,_jsx(_components.code,{children:`-main`})]})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`agent_description`})}),_jsx(_components.td,{children:_jsx(_components.code,{children:`str`})}),_jsx(_components.td,{children:_jsx(_components.code,{children:`\"A highly intelligent...\"`})}),_jsxs(_components.td,{children:[`Description given to both internal agents as their `,_jsx(_components.code,{children:`agent_description`})]})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`model_name`})}),_jsx(_components.td,{children:_jsx(_components.code,{children:`str`})}),_jsx(_components.td,{children:_jsx(_components.code,{children:`\"gpt-5.4\"`})}),_jsxs(_components.td,{children:[`Model for the main agent when `,_jsx(_components.code,{children:`model_names`}),` is not given, and for the reasoning agent too unless `,_jsx(_components.code,{children:`reasoning_model_name`}),` is set`]})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`description`})}),_jsx(_components.td,{children:_jsx(_components.code,{children:`str`})}),_jsx(_components.td,{children:_jsx(_components.code,{children:`\"A highly intelligent...\"`})}),_jsx(_components.td,{children:`Stored on the instance; not used by either internal agent`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`model_names`})}),_jsx(_components.td,{children:_jsx(_components.code,{children:`list[str]`})}),_jsx(_components.td,{children:_jsx(_components.code,{children:`[\"gpt-5.4\", \"gpt-5.4\"]`})}),_jsxs(_components.td,{children:[_jsx(_components.code,{children:`model_names[1]`}),` is the main agent’s model. `,_jsx(_components.code,{children:`model_names[0]`}),` is used for the reasoning agent only when `,_jsx(_components.code,{children:`reasoning_model_name`}),` is `,_jsx(_components.code,{children:`None`})]})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`system_prompt`})}),_jsx(_components.td,{children:_jsx(_components.code,{children:`str`})}),_jsx(_components.td,{children:_jsx(_components.code,{children:`\"You are a helpful...\"`})}),_jsxs(_components.td,{children:[`System prompt for the main agent. The reasoning agent always uses the built-in `,_jsx(_components.code,{children:`REASONING_PROMPT`})]})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`output_type`})}),_jsx(_components.td,{children:_jsx(_components.code,{children:`OutputType`})}),_jsx(_components.td,{children:_jsx(_components.code,{children:`\"dict-all-except-first\"`})}),_jsxs(_components.td,{children:[`Format of the value returned by `,_jsx(_components.code,{children:`run()`})]})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`reasoning_model_name`})}),_jsx(_components.td,{children:_jsx(_components.code,{children:`Optional[str]`})}),_jsx(_components.td,{children:_jsx(_components.code,{children:`None`})}),_jsxs(_components.td,{children:[`Model used by the reasoning agent. `,_jsx(_components.code,{children:`None`}),` runs it on `,_jsx(_components.code,{children:`model_names[0]`}),`, or on `,_jsx(_components.code,{children:`model_name`}),` when `,_jsx(_components.code,{children:`model_names`}),` is not given, so a duo built on one provider stays on it`]})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`max_loops`})}),_jsx(_components.td,{children:_jsx(_components.code,{children:`int`})}),_jsx(_components.td,{\"data-numeric\":`true`,children:_jsx(_components.code,{children:`1`})}),_jsxs(_components.td,{children:[`Number of reasoning/main-agent loop iterations in `,_jsx(_components.code,{children:`run()`})]})]}),_jsxs(_components.tr,{children:[_jsxs(_components.td,{children:[_jsx(_components.code,{children:`*args`}),`, `,_jsx(_components.code,{children:`**kwargs`})]}),_jsx(_components.td,{}),_jsx(_components.td,{}),_jsxs(_components.td,{children:[`Extra `,_jsx(_components.code,{children:`Agent`}),` arguments applied to both internal agents`]})]})]})]}),`\n`,_jsx(Warning,{children:_jsxs(_components.p,{children:[_jsx(_components.code,{children:`reasoning_model_name`}),` defaults to `,_jsx(_components.code,{children:`None`}),`, which runs the reasoning agent on `,_jsx(_components.code,{children:`model_names[0]`}),` (or on `,_jsx(_components.code,{children:`model_name`}),` when `,_jsx(_components.code,{children:`model_names`}),` is not given). Set it to put the reasoning agent on a different model.`]})}),`\n`,_jsx(Heading,{level:`3`,id:`methods`,children:`Methods`}),`\n`,_jsxs(Table,{children:[_jsx(_components.thead,{children:_jsxs(_components.tr,{children:[_jsx(_components.th,{children:`Method`}),_jsx(_components.th,{children:`Parameters`}),_jsx(_components.th,{children:`Returns`}),_jsx(_components.th,{children:`Description`})]})}),_jsxs(_components.tbody,{children:[_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`step`})}),_jsx(_components.td,{children:_jsx(_components.code,{children:`task: str, img: Optional[str] = None`})}),_jsx(_components.td,{children:_jsx(_components.code,{children:`None`})}),_jsx(_components.td,{children:`Runs one reasoning-agent → main-agent cycle and appends to the conversation`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`run`})}),_jsx(_components.td,{children:_jsx(_components.code,{children:`task: str, img: Optional[str] = None`})}),_jsxs(_components.td,{children:[`Formatted per `,_jsx(_components.code,{children:`output_type`})]}),_jsxs(_components.td,{children:[`Starts a new conversation, then processes the task through both agents for `,_jsx(_components.code,{children:`max_loops`}),` iterations`]})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`batched_run`})}),_jsx(_components.td,{children:_jsx(_components.code,{children:`tasks: List[str], imgs: Optional[List[str]] = None`})}),_jsx(_components.td,{children:_jsx(_components.code,{children:`list`})}),_jsxs(_components.td,{children:[`Processes multiple tasks sequentially. `,_jsx(_components.code,{children:`imgs`}),` pairs one image with each task and must be the same length as `,_jsx(_components.code,{children:`tasks`}),`, or `,_jsx(_components.code,{children:`ValueError`}),` is raised`]})]})]})]}),`\n`,_jsx(Heading,{level:`2`,id:`how-a-run-works`,children:`How a run works`}),`\n`,_jsxs(_components.p,{children:[`Each `,_jsx(_components.code,{children:`run()`}),` starts from an empty conversation, so one task never leaks into the next and every `,_jsx(_components.code,{children:`batched_run`}),` result holds only its own task. After a run, `,_jsx(_components.code,{children:`duo.conversation`}),` holds that run’s messages.`]}),`\n`,_jsxs(_components.p,{children:[`In each loop, the reasoning agent (named `,_jsx(_components.code,{children:`\u003cagent_name>-reasoning`}),`) answers first, then the main agent (`,_jsx(_components.code,{children:`\u003cagent_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 `,_jsx(_components.code,{children:`assistant`}),` turns and its partner’s as labelled `,_jsx(_components.code,{children:`user`}),` turns. The first loop sends your task. Each later loop sends “Continue reasoning and refining your analysis.”`]}),`\n`,_jsx(Heading,{level:`2`,id:`quick-start`,children:`Quick Start`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`9`,language:`python`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`python`,children:_jsxs(_components.code,{language:`python`,numberOfLines:`9`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`from`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` swarms `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`import`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` ReasoningDuo`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`duo `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` ReasoningDuo(`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:` agent_name`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"reasoning-agent-01\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:` reasoning_model_name`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"claude-sonnet-4-6\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:` model_names`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`[`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"claude-sonnet-4-6\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"gpt-5.4\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`],`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`result `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` duo.run(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"Explain the concept of gravitational waves\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`]})})}),`\n`,_jsx(Heading,{level:`2`,id:`examples`,children:`Examples`}),`\n`,_jsx(Heading,{level:`3`,id:`mathematical-analysis`,children:`Mathematical Analysis`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`10`,language:`python`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`python`,children:_jsxs(_components.code,{language:`python`,numberOfLines:`10`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`from`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` swarms `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`import`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` ReasoningDuo`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`duo `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` ReasoningDuo()`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`math_task `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"\"\"`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`Solve the following differential equation:`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`dy/dx + 2y = x^2, y(0) = 1`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"\"\"`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`solution `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` duo.run(math_task)`})]}),`\n`]})})}),`\n`,_jsx(Heading,{level:`3`,id:`financial-analysis`,children:`Financial Analysis`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`12`,language:`python`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`python`,children:_jsxs(_components.code,{language:`python`,numberOfLines:`12`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`from`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` swarms `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`import`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` ReasoningDuo`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`duo `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` ReasoningDuo()`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`finance_task `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"\"\"`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`Calculate the Net Present Value (NPV) of a project with:`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`- Initial investment: $100,000`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`- Annual cash flows: $25,000 for 5 years`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`- Discount rate: 8%`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"\"\"`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`analysis `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` duo.run(finance_task)`})]}),`\n`]})})}),`\n`,_jsx(Heading,{level:`3`,id:`customizing-agent-behavior`,children:`Customizing Agent Behavior`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`9`,language:`python`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`python`,children:_jsxs(_components.code,{language:`python`,numberOfLines:`9`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`from`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` swarms `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`import`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` ReasoningDuo`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`duo `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` ReasoningDuo(`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:` agent_name`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"custom-reasoning-agent\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:` reasoning_model_name`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"claude-sonnet-4-6\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:` model_names`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`[`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"claude-sonnet-4-6\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"gpt-5.4\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`],`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:` system_prompt`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"You are a financial expert AI assistant...\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:` output_type`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"final\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})}),`\n`]})})}),`\n`,_jsx(Heading,{level:`3`,id:`batch-processing`,children:`Batch Processing`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`11`,language:`python`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`python`,children:_jsxs(_components.code,{language:`python`,numberOfLines:`11`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`from`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` swarms `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`import`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` ReasoningDuo`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`duo `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` ReasoningDuo()`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`tasks `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` [`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"Analyze market trends for tech stocks\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"Calculate risk metrics for a portfolio\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"Forecast revenue growth\"`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`]`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`results `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` duo.batched_run(tasks)`})]}),`\n`]})})}),`\n`,_jsx(Heading,{level:`2`,id:`best-practices`,children:`Best Practices`}),`\n`,_jsxs(_components.ol,{children:[`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`Task Formulation`}),`: Be specific and clear in task descriptions. Include relevant context and constraints.`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`Performance Optimization`}),`: Use `,_jsx(_components.code,{children:`batched_run`}),` for multiple related tasks. Monitor agent outputs for consistency.`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`Model Selection`}),`: Adjust model parameters based on task complexity.`]}),`\n`]})]})}function MDXContent(props={}){const{wrapper:MDXLayout}={..._provideComponents(),...props.components};return MDXLayout?_jsx(MDXLayout,{...props,children:_jsx(_createMdxContent,{...props})}):_createMdxContent(props)}return{default:MDXContent};function _missingMdxReference(id,component){throw new Error(`Expected `+(component?`component`:`object`)+\" `\"+id+\"` to be defined: you likely forgot to import, pass, or provide it.\")}","frontmatter":{},"scope":{"config":{},"pageMetadata":{"title":"Reasoning Duo","description":"Dual-agent collaborative system that separates reasoning and execution phases for more robust and reliable outputs","icon":"people-arrows","href":"/agents/reasoning-duo"}}},"mdxSourceWithNoJs":null},"mdxExtracts":{"tableOfContents":[{"title":"Architecture","slug":"architecture","depth":2,"children":[]},{"title":"Parameters","slug":"parameters","depth":2,"children":[{"title":"Methods","slug":"methods","depth":3,"children":[]}]},{"title":"How a run works","slug":"how-a-run-works","depth":2,"children":[]},{"title":"Quick Start","slug":"quick-start","depth":2,"children":[]},{"title":"Examples","slug":"examples","depth":2,"children":[{"title":"Mathematical Analysis","slug":"mathematical-analysis","depth":3,"children":[]},{"title":"Financial Analysis","slug":"financial-analysis","depth":3,"children":[]},{"title":"Customizing Agent Behavior","slug":"customizing-agent-behavior","depth":3,"children":[]},{"title":"Batch Processing","slug":"batch-processing","depth":3,"children":[]}]},{"title":"Best Practices","slug":"best-practices","depth":2,"children":[]}],"codeExamples":{}},"jsLinks":[],"subdomain":"kyegomez-swarms-97","siteName":"swarms","title":"Reasoning Duo - swarms","navMaps":{"firstHrefInVersion":{},"firstHrefInLanguage":{}},"lastModified":"2026-11-04T18:20:13.395Z","originalFileLocation":"agents/reasoning-duo.mdx"},"headHtml":"\u003cscript data-mint-head>(function(){var d=document.documentElement,p=null;if(!p){try{p=localStorage.getItem(\"isDarkMode\")}catch(e){}if(p==='true')p='dark';else if(p==='false')p='light';if(p!=='light'\u0026\u0026p!=='dark'\u0026\u0026p!=='system')p=\"system\"}var r=p==='system'?(matchMedia(\"(prefers-color-scheme: dark)\").matches?'dark':'light'):p;d.classList.remove(r==='dark'?'light':'dark');d.classList.add(r);d.setAttribute(\"data-theme-preference\",p)})();\u003c/script>\u003cmeta data-mint-head name=\"description\" content=\"Dual-agent collaborative system that separates reasoning and execution phases for more robust and reliable outputs\">\u003cmeta data-mint-head name=\"application-name\" content=\"swarms\">\u003cmeta data-mint-head name=\"generator\" content=\"Mintlify\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/mintlify-assets/_mintlify/favicons/kyegomez-swarms-97/Ctj8KAbEFcaygyNp/_generated/favicon/android-chrome-192x192.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"apple-touch-icon\" type=\"image/png\" sizes=\"180x180\" href=\"/mintlify-assets/_mintlify/favicons/kyegomez-swarms-97/Ctj8KAbEFcaygyNp/_generated/favicon/apple-touch-icon.png\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/mintlify-assets/_mintlify/favicons/kyegomez-swarms-97/Ctj8KAbEFcaygyNp/_generated/favicon/favicon-16x16.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/mintlify-assets/_mintlify/favicons/kyegomez-swarms-97/Ctj8KAbEFcaygyNp/_generated/favicon/favicon-32x32.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/mintlify-assets/_mintlify/favicons/kyegomez-swarms-97/Ctj8KAbEFcaygyNp/_generated/favicon/favicon.ico\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/mintlify-assets/_mintlify/favicons/kyegomez-swarms-97/Ctj8KAbEFcaygyNp/_generated/favicon-dark/android-chrome-192x192.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/mintlify-assets/_mintlify/favicons/kyegomez-swarms-97/Ctj8KAbEFcaygyNp/_generated/favicon-dark/favicon-16x16.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/mintlify-assets/_mintlify/favicons/kyegomez-swarms-97/Ctj8KAbEFcaygyNp/_generated/favicon-dark/favicon-32x32.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/mintlify-assets/_mintlify/favicons/kyegomez-swarms-97/Ctj8KAbEFcaygyNp/_generated/favicon-dark/favicon.ico\" media=\"(prefers-color-scheme: dark)\">\u003cmeta data-mint-head property=\"og:title\" content=\"Reasoning Duo - swarms\">\u003cmeta data-mint-head property=\"og:description\" content=\"Dual-agent collaborative system that separates reasoning and execution phases for more robust and reliable outputs\">\u003cmeta data-mint-head property=\"og:site_name\" content=\"swarms\">\u003cmeta data-mint-head property=\"og:url\" content=\"https://docs.swarms.world/agents/reasoning-duo\">\u003cmeta data-mint-head property=\"og:type\" content=\"website\">\u003cmeta data-mint-head property=\"og:image\" content=\"https://kyegomez-swarms-97.mintlify.site/_mintlify/api/og/v2?division=Reasoning+Agents\u0026amp;title=Reasoning+Duo\u0026amp;description=Dual-agent+collaborative+system+that+separates+reasoning+and+execution+phases+for+more+robust+and+reliable+outputs\u0026amp;theme=ba8c70c5ea28f09121ef6c53\u0026amp;signature=65301acaf345a969114cb3aa6efe117f50c5729cdc42a2fa191e315479248a69\">\u003cmeta data-mint-head property=\"og:image:width\" content=\"1200\">\u003cmeta data-mint-head property=\"og:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"twitter:card\" content=\"summary_large_image\">\u003cmeta data-mint-head name=\"twitter:title\" content=\"Reasoning Duo - swarms\">\u003cmeta data-mint-head name=\"twitter:description\" content=\"Dual-agent collaborative system that separates reasoning and execution phases for more robust and reliable outputs\">\u003cmeta data-mint-head name=\"twitter:image\" content=\"https://kyegomez-swarms-97.mintlify.site/_mintlify/api/og/v2?division=Reasoning+Agents\u0026amp;title=Reasoning+Duo\u0026amp;description=Dual-agent+collaborative+system+that+separates+reasoning+and+execution+phases+for+more+robust+and+reliable+outputs\u0026amp;theme=ba8c70c5ea28f09121ef6c53\u0026amp;signature=65301acaf345a969114cb3aa6efe117f50c5729cdc42a2fa191e315479248a69\">\u003cmeta data-mint-head name=\"twitter:image:width\" content=\"1200\">\u003cmeta data-mint-head name=\"twitter:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"msapplication-config\" content=\"/mintlify-assets/_mintlify/favicons/kyegomez-swarms-97/Ctj8KAbEFcaygyNp/_generated/favicon/browserconfig.xml\">\u003cmeta data-mint-head name=\"apple-mobile-web-app-title\" content=\"swarms\">\u003cmeta data-mint-head name=\"msapplication-TileColor\" content=\"#DC2626\">\u003clink data-mint-head rel=\"canonical\" href=\"https://docs.swarms.world/agents/reasoning-duo\">\u003clink data-mint-head rel=\"alternate\" type=\"application/xml\" href=\"/sitemap.xml\">\u003clink data-mint-head rel=\"alternate\" type=\"text/markdown\" href=\"/agents/reasoning-duo.md\">\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@graph\":[{\"@type\":\"Organization\",\"@id\":\"https://docs.swarms.world/#organization\",\"name\":\"swarms\",\"url\":\"https://docs.swarms.world\",\"logo\":{\"@type\":\"ImageObject\",\"url\":\"https://mintcdn.com/kyegomez-swarms-97/2Wfh9aBTbMWV_Lyz/logo/light.svg?fit=max\u0026auto=format\u0026n=2Wfh9aBTbMWV_Lyz\u0026q=85\u0026s=e3d664b8b8f6928c836776b54704d076\"}},{\"@type\":\"WebSite\",\"@id\":\"https://docs.swarms.world#website\",\"name\":\"swarms\",\"url\":\"https://docs.swarms.world\",\"publisher\":{\"@id\":\"https://docs.swarms.world/#organization\"}},{\"@type\":\"WebPage\",\"@id\":\"https://docs.swarms.world/agents/reasoning-duo#webpage\",\"url\":\"https://docs.swarms.world/agents/reasoning-duo\",\"name\":\"Reasoning Duo\",\"description\":\"Dual-agent collaborative system that separates reasoning and execution phases for more robust and reliable outputs\",\"dateModified\":\"2026-11-04T18:20:13.395Z\",\"isPartOf\":{\"@id\":\"https://docs.swarms.world#website\"},\"breadcrumb\":{\"@id\":\"https://docs.swarms.world/agents/reasoning-duo#breadcrumb\"}},{\"@type\":\"BreadcrumbList\",\"@id\":\"https://docs.swarms.world/agents/reasoning-duo#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Reasoning Agents\",\"item\":\"https://docs.swarms.world/agents/reasoning-agents-overview\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Reasoning Duo\",\"item\":\"https://docs.swarms.world/agents/reasoning-duo\"}]},{\"@type\":[\"Article\",\"TechArticle\"],\"@id\":\"https://docs.swarms.world/agents/reasoning-duo#article\",\"headline\":\"Reasoning Duo\",\"name\":\"Reasoning Duo\",\"description\":\"Dual-agent collaborative system that separates reasoning and execution phases for more robust and reliable outputs\",\"url\":\"https://docs.swarms.world/agents/reasoning-duo\",\"mainEntityOfPage\":{\"@id\":\"https://docs.swarms.world/agents/reasoning-duo#webpage\"},\"dateModified\":\"2026-11-04T18:20:13.395Z\",\"publisher\":{\"@id\":\"https://docs.swarms.world/#organization\"},\"isPartOf\":{\"@id\":\"https://docs.swarms.world#website\"}}]}\u003c/script>\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@type\":\"WebSite\",\"name\":\"swarms\",\"publisher\":{\"@type\":\"Organization\",\"name\":\"swarms\"},\"provider\":{\"@type\":\"Organization\",\"name\":\"Mintlify\",\"url\":\"https://mintlify.com\"}}\u003c/script>","agentPointerHref":"/agents/reasoning-duo.md","siteName":"swarms","nav":{"global":null,"tabs":[{"tab":"Documentation","groups":[{"group":"Getting Started","pages":[{"title":"Introduction to Swarms","href":"/introduction"},{"title":"Quickstart Guide","href":"/quickstart"},{"title":"Installation","href":"/installation"},{"title":"Environment Setup","href":"/environment-setup"}]},{"group":"Core Concepts","pages":[{"title":"Agents","href":"/concepts/agents"},{"title":"Swarms","href":"/concepts/swarms"},{"title":"Workflows","href":"/concepts/workflows"},{"title":"Tools","href":"/concepts/tools"},{"title":"Custom Multi-Agent Architectures","href":"/concepts/custom-architectures"}]},{"group":"Agent Development","pages":[{"title":"Creating Agents","icon":"robot","href":"/agents/creating-agents"},{"title":"Agent Configuration","icon":"sliders","href":"/agents/agent-configuration"},{"title":"Agent Memory","icon":"database","href":"/agents/agent-memory"},{"title":"Autonomous Mode","icon":"robot","href":"/agents/autonomous-mode"},{"title":"Agent Tools","icon":"wrench","href":"/agents/agent-tools"},{"title":"Dynamic Tool Loading","icon":"magnifying-glass-arrow-right","href":"/agents/dynamic-tools"},{"title":"Agent Skills","icon":"graduation-cap","href":"/agents/agent-skills"},{"title":"Structured Outputs","icon":"code","href":"/agents/structured-outputs"},{"title":"Prompt Caching","icon":"database","href":"/agents/prompt-caching"},{"title":"Token Usage","icon":"coins","href":"/agents/token-usage"}]},{"group":"Reasoning Agents","pages":[{"title":"Reasoning Agents Overview","icon":"brain","href":"/agents/reasoning-agents-overview"},{"title":"Self-Consistency Agent","icon":"check-double","href":"/agents/self-consistency-agent"},{"title":"IRE Agent (Iterative Reflective Expansion)","description":"Iterative hypothesis generation, simulation, and refinement through continuous cycles of testing and meta-cognitive reflection","icon":"arrows-spin","href":"/agents/iterative-agent"},{"title":"Reasoning Duo","icon":"people-arrows","href":"/agents/reasoning-duo"},{"title":"Reflexion Agent","description":"Self-reflective agent that improves through iterative acting, evaluating, and reflecting with experience memory","icon":"rotate","href":"/agents/reflexion-agent"},{"title":"GKP Agent (Generated Knowledge Prompting)","icon":"book-open","href":"/agents/gkp-agent"},{"title":"Tree of Thoughts","icon":"sitemap","href":"/agents/tree-of-thoughts"},{"title":"Agent Judge","icon":"gavel","href":"/agents/agent-judge"},{"title":"Reasoning Agent Router","icon":"route","href":"/agents/reasoning-agent-router"}]},{"group":"Multi-Agent Architectures","pages":[{"title":"Multi-Agent Architectures Overview","href":"/architectures/overview"},{"title":"Multi-Agent Structures Catalog","href":"/architectures/structures-catalog"},{"title":"Sequential Workflow","href":"/architectures/sequential-workflow"},{"title":"Concurrent Workflow","href":"/architectures/concurrent-workflow"},{"title":"Agent Rearrange","href":"/architectures/agent-rearrange"},{"title":"Mixture of Agents","href":"/architectures/mixture-of-agents"},{"title":"Swarm Router","href":"/architectures/swarm-router"},{"title":"Hierarchical Swarm","href":"/architectures/hierarchical-swarm"},{"title":"Heavy Swarm","href":"/architectures/heavy-swarm"},{"title":"Group Chat","href":"/architectures/group-chat"},{"title":"Graph Workflow","href":"/architectures/graph-workflow"},{"title":"Social Algorithms","href":"/architectures/social-algorithms"}]},{"group":"Deployment \u0026 Operations","pages":[{"title":"Production Best Practices","icon":"shield-check","href":"/deployment/production-best-practices"},{"title":"Scaling Swarms","icon":"chart-line","href":"/deployment/scaling"},{"title":"Monitoring \u0026 Observability","icon":"chart-mixed","href":"/deployment/monitoring"},{"title":"Telemetry","icon":"chart-line","href":"/deployment/telemetry"}]},{"group":"Integrations","pages":[{"title":"Model Providers","href":"/integrations/model-providers"},{"title":"Model Context Protocol (MCP)","href":"/integrations/mcp"},{"title":"Tools Integration","href":"/integrations/tools"},{"title":"Swarms Marketplace","href":"/integrations/marketplace"}]},{"group":"CLI Reference","pages":[{"title":"CLI Overview","icon":"terminal","href":"/cli/overview"},{"title":"Swarms CLI Tutorial","icon":"book-open","href":"/cli/tutorial"},{"title":"CLI Commands","icon":"terminal","href":"/cli/commands"},{"title":"CLI Configuration","icon":"gear","href":"/cli/configuration"},{"title":"CLI Examples","icon":"list","href":"/cli/examples"}]},{"group":"Changelog","pages":[{"title":"Changelog Overview","href":"/changelog/overview"},{"title":"Swarms v17","href":"/changelog/swarms-v17"},{"title":"Swarms v16","href":"/changelog/swarms-v16"},{"title":"Swarms v15","href":"/changelog/swarms-v15"},{"title":"Swarms v14","href":"/changelog/swarms-v14"},{"title":"Swarms v13","href":"/changelog/swarms-v13"},{"title":"Swarms v12","href":"/changelog/swarms-v12"}]}]},{"tab":"API Reference","pages":[{"title":"API Reference","href":"/api/agent"}]},{"tab":"RouteHub","pages":[{"title":"RouteHub","href":"/routehub/overview"}]},{"tab":"Swarms API","pages":[{"title":"Swarms API","href":"/swarms-api/overview"}]},{"tab":"Examples","pages":[{"title":"Examples","href":"/examples/overview"}]},{"tab":"Community","pages":[{"title":"Community","href":"/community/contributing"}]}]},"basePath":"","title":"Reasoning Duo - swarms","buildId":"dpl_5tKr6cUUeuVJdEZ9JAEY3h4soMJ8","deploymentId":"dpl_5tKr6cUUeuVJdEZ9JAEY3h4soMJ8","dynamics":[],"chunks":[]}