Table of Contents

Chain of Thought Agents

Chain of Thought (CoT) agents are AI systems that explicitly decompose complex problems into intermediate reasoning steps before arriving at a final answer or action. By verbalizing their thought process, these agents achieve significantly improved performance on tasks requiring multi-step logic, arithmetic, and commonsense reasoning1). CoT prompting has become a foundational technique in modern agent design, enabling more transparent and reliable decision-making across autonomous agent systems.

Origins and Evolution

CoT prompting was introduced by Wei et al., 2022 at Google, demonstrating that prompting LLMs with “Let's think step-by-step” or providing few-shot examples with explicit reasoning chains dramatically improved performance on math and logic benchmarks. The technique evolved rapidly:

By 2025, CoT has evolved from simple prompting into a core architectural component of reasoning models.

Reasoning Models

The most significant evolution of CoT is its internalization within dedicated reasoning models:

These models demonstrate that CoT is not merely a prompting technique but a fundamental capability that can be trained into models through reinforcement learning.

CoT in Agent Systems

Within autonomous agent architectures, CoT serves multiple roles:

The combination of CoT with tool use, as in the ReAct pattern, produces agents that are both more capable and more interpretable than either pure reasoning or pure action approaches.

Code Example: CoT Agent with Step-by-Step Reasoning

from [[openai|openai]] import [[openai|OpenAI]]
 
client = [[openai|OpenAI]]()
 
COT_SYSTEM_PROMPT = """You are a reasoning agent. For every question:
1. Break the problem into explicit reasoning steps
2. Show your work for each step inside <step> tags
3. Verify your reasoning in a <verify> tag
4. Give your final answer in an <answer> tag
 
Example format:
<step>First, I identify that...</step>
<step>Next, I calculate...</step>
<verify>Checking: ...</verify>
<answer>The answer is...</answer>"""
 
 
def cot_agent(question: str) -> dict:
    """Run a chain-of-thought agent that shows explicit reasoning steps."""
    response = client.chat.completions.create(
        model="gpt-4o",
        messages=[
            {"role": "system", "content": COT_SYSTEM_PROMPT},
            {"role": "user", "content": question},
        ],
        temperature=0.2,
    )
    raw = response.choices[0].message.content
 
    # Parse structured reasoning output
    import re
    steps = re.findall(r"<step>(.*?)</step>", raw, re.DOTALL)
    verification = re.findall(r"<verify>(.*?)</verify>", raw, re.DOTALL)
    answer = re.findall(r"<answer>(.*?)</answer>", raw, re.DOTALL)
 
    return {
        "steps": [s.strip() for s in steps],
        "verification": verification[0].strip() if verification else None,
        "answer": answer[0].strip() if answer else raw,
        "raw": raw,
    }
 
 
result = cot_agent(
    "A store has 3 types of boxes. Small holds 4 items, medium holds 9, large holds 15. "
    "I need to pack exactly 58 items using the fewest boxes. What combination should I use?"
)
 
print("Reasoning steps:")
for i, step in enumerate(result["steps"], 1):
    print(f"  {i}. {step}")
if result["verification"]:
    print(f"\nVerification: {result['verification']}")
print(f"\nFinal answer: {result['answer']}")

Multimodal and Structured CoT

Recent advances extend CoT beyond text:

See Also

References

8)
cursor-just-turned-its-agent-workflow|Rohan's Bytes “Action Chain-of-Thought” (2026]]