Synaptic SkillsSynapticSkills
MarketplaceSkill GraphCriar SkillMCP ServerPlataformaEnterprise
v0.1.0-beta
Voltar ao Marketplace
AgentsAvançadoAuto-Sync

Reasoning Loop

porTHIAGONOMA·THIAGONOMA· v1.0.3 · atualizado em 2026-04-12T22:48:36.093Z
91
Score

Implementa loops de raciocínio iterativo (ReAct, Chain-of-Thought, Tree of Thoughts) para agentes resolver problemas complexos com múltiplos passos, ferramentas e auto-correção de erros.

reasoningreact-patternchain-of-thoughtagentstool-usellmagentic
Linguagens
multi-language
3.2KStars
389Forks
37.2KUsos
Fork

Documento do Skill

SKILL.mdreasoning-loop/workflow
Passo-a-passo detalhado do skill, referenciando as fases cognitivas:
1
SENSE — Definir tarefa e ferramentas
```python
# Exemplo: agente que responde perguntas sobre dados de negócio
TOOLS = {
"sql_query": lambda q: execute_sql(q),
"calculate": lambda expr: eval(expr), # usar com sandbox
"search_web": lambda query: web_search(query),
}
TASK = "Qual foi o crescimento de receita MoM de janeiro a março de 2026?"
```
2
RECOMMEND — Implementar ReAct loop
```python
import re
from anthropic import Anthropic
client = Anthropic()
SYSTEM_PROMPT = '''Você é um agente analítico. Para cada passo, siga o formato:
Thought: raciocine sobre o que precisa fazer
Action: tool_name(args)
Ferramentas disponíveis:
sql_query(query: str) -> str: executa SQL no banco de dados
calculate(expression: str) -> float: calcula expressão matemática
'''
def react_loop(task: str, max_iterations: int = 10) -> str:
messages = [{"role": "user", "content": f"Tarefa: {task}"}]
for iteration in range(max_iterations):
response = client.messages.create(
model="claude-opus-4",
max_tokens=2000,
system=SYSTEM_PROMPT,
messages=messages,
)
content = response.content[0].text
messages.append({"role": "assistant", "content": content})
# Extrair Action
action_match = re.search(r'Action: (\w+)\((.*)\)', content, re.DOTALL)
if "Final Answer:" in content:
return content.split("Final Answer:")[1].strip()
if not action_match:
return content # sem ação, resposta direta
tool_name, tool_args = action_match.group(1), action_match.group(2).strip()
# Executar ferramenta
if tool_name in TOOLS:
try:
result = TOOLS[tool_name](tool_args.strip('"'))
observation = f"Observation: {result}"
except Exception as e:
observation = f"Observation: Error — {e}. Try a different approach."
else:
observation = f"Observation: Tool '{tool_name}' not found."
messages.append({"role": "user", "content": observation})
print(f"[Iteration {iteration + 1}] {tool_name}({tool_args[:50]}) → {str(result)[:100]}")
return "Max iterations reached without final answer."
```
3
RECOMMEND — Extended Thinking (Claude)
```python
# Para problemas muito complexos, ativar raciocínio interno do Claude
response = client.messages.create(
model="claude-opus-4",
max_tokens=16000,
thinking={"type": "enabled", "budget_tokens": 10000},
messages=[{"role": "user", "content": complex_task}],
)
# thinking_block conterá o raciocínio interno, text_block a resposta final
```
4
EVALUATE — Detectar e tratar loops
```python
# Detectar ação repetida
action_history = []
if action in action_history[-3:]:
return "Loop detectado: encerrando com melhor resultado disponível"
action_history.append(action)
```
5
REFLECT — Log estruturado para observabilidade
```python
# Salvar trace completo para debugging
trace = {
"task": task,
"iterations": len(messages) // 2,
"steps": [{"thought": ..., "action": ..., "observation": ...}],
"result": final_answer,
"tokens_used": response.usage.input_tokens + response.usage.output_tokens,
}
```
Reportar telemetria via mcp-skillschain

Telemetria de Agentes

Execuções
0
total
Taxa de Sucesso
0%
últimos 30d
Latência Média
0.0s
p50
Alucinação
0.0%
detecção
Tokens Entrada
0
avg 0/exec
Tokens Saída
0
avg 0/exec

Uso por Plataforma

Skills Relacionados

Depende deToken Counter
24%
Hebbian Synapse
Composite0.240
w = 0.3·α + 0.5·β + 0.2·γ
84
Compõe comPrompt Optimizer
21%
Hebbian Synapse
Composite0.210
w = 0.3·α + 0.5·β + 0.2·γ
60
Compõe com ←Prompt Optimizer
21%
Hebbian Synapse
Composite0.210
w = 0.3·α + 0.5·β + 0.2·γ
60
Co-executed ←Prompt Optimizer
26%
Hebbian Synapse
Composite0.262
w = 0.3·α + 0.5·β + 0.2·γ
60
Co-executed ←Markdown to Docs
26%
Hebbian Synapse
Composite0.262
w = 0.3·α + 0.5·β + 0.2·γ
78

Árvore do Skill

Reasoning Loop
reasoning-loop
Fases Cognitivas6
1.SENSE: Percepção
2.CONTEXTUALIZE: Contextualização
3.HYPOTHESIZE: Hipótese
4.EVALUATE: Avaliação
5.RECOMMEND: Recomendação
6.REFLECT: Reflexão
Triggers15
implement reasoning loopcriar loop de raciocínioreact patternagentic workflowchain of thought reasoningtool use agentmulti-step reasoningautonomous agentagent loopself reflectiontree of thoughtsimplement agentagente com ferramentasreasoning agentauto-correction loop

Avaliar este Skill

Score Breakdown

⭐Avaliação Humana0%
🤖Sucesso de Agentes0%
🕐Atualidade100%
🔗Saúde de Dependências100%
🕸️Centralidade no Grafo0%
🛡️Segurança50%
CompositeScore = α·Humano + β·Agente + γ·Recência + δ·Deps + ε·Centralidade + ζ·Segurança

Instalação

$ synaptic mcp download reasoning-loop
$ synaptic skills detail reasoning-loop
$ synaptic skills live reasoning-loop

Links

GitHub Repository