Enable LLMs to solve complex problems through multi-turn agentic reasoning with tool-assisted verification and iterative refinement loops. Trigger: improve reasoning reliability on long-horizon tasks by combining RL with verification.
Instalar com Codex ou Claude Copie este prompt, cole no Codex, Claude ou outro assistente e deixe que ele revise a página da skill e instale para você.
Um comando direto ignora o prompt de revisão. Verifique a origem antes de executá-lo.
Enable LLMs to solve complex problems through multi-turn agentic reasoning with tool-assisted verification and iterative refinement loops. Trigger: improve reasoning reliability on long-horizon tasks by combining RL with verification.
AlphaApollo: Orchestrating Models and Tools for Reliable Reasoning
Core Concept
AlphaApollo frames complex problem-solving as a multi-turn agentic process with three integrated levels: reasoning (multi-turn interactions), learning (turn-level RL), and evolution (multi-round refinement with verification). By separating actions from tool responses during RL training and implementing a propose-judge-update loop, the system achieves reliable reasoning on tasks requiring tool use, verification, and iterative correction.
The key insight: Decoupling actions from responses and learning from turn-level feedback enables models to build strategies that outlast individual tool failures.
Architecture Overview
Multi-Turn Agentic Reasoning: Model reasons in turns, calling tools and receiving responses
Turn-Level RL Training: Optimize tool-use decisions at each turn, not just final outcome
Tool-Response Separation: Distinguish between model actions and external tool results
Propose-Judge-Update Loop: Generate solution → verify with tools → refine based on feedback
Long-Horizon Memory: Track prior attempts and insights across refinement rounds
Implementation Steps
1. Design the Agentic Interface
Define how the model interacts with tools and receives feedback.
classAgentAction:
"""Represents a single turn's action."""def__init__(self, action_type, content, tool_call=None):
self.action_type = action_type # "reason", "call_tool", "output"self.content = content # Text of reasoning or tool nameself.tool_call = tool_call # Tool parameters if applicabledefto_prompt(self):
ifself.action_type == "call_tool":
returnf"TOOL_CALL: ()"
:
:
():
.tool_name = tool_name
.status = status
.result = result
.error = error
():
.status == :
:
:
():
.problem = problem
.turns = []
.turn_rewards = []
.final_reward =
.solution =
():
.turns.append((action, response))
.turn_rewards.append(immediate_reward)
():
.final_reward = final_reward
.solution = solution
{self.tool_call['name']}
{self.tool_call['args']}
else
return
f"{self.action_type.upper()}: {self.content}"
class
ToolResponse
"""Represents tool execution result."""
def
__init__
self, tool_name, status, result, error=None
self
self
# "success", "error", "timeout"
self
self
def
to_prompt
self
if
self
"success"
return
f"Tool {self.tool_name} returned: {self.result}"
else
return
f"Tool {self.tool_name} error: {self.error}"
class
MultiTurnTrajectory
"""Tracks a complete problem-solving episode."""
def
__init__
self, problem
self
self
# List of (action, response) pairs
self
# Reward per turn
self
None
self
None
def
add_turn
self, action, response, immediate_reward=0
self
self
def
finalize
self, final_reward, solution
self
self
2. Implement Multi-Turn Reasoning Loop
The agent reasons iteratively, calling tools when needed and refining based on responses.