Agent Architectures
~3 min read
Concept & How It Works
Why Does It Exist?
Without explicit reasoning, agents jump to tool calls based on surface patterns — calling the wrong API, misinterpreting results, or skipping necessary steps. Reasoning forces the LLM to articulate its logic, dramatically improving accuracy on complex, multi-hop tasks.
Real-World Analogy
Reasoning is the agent showing its work on a math test — the final answer matters, but the step-by-step logic is what prevents careless errors and makes mistakes debuggable.
Visual Workflows
What is Agent Architectures?
Example
Scenario
Question: 'Is our AWS spend trending up or down compared to last quarter?' Agent reasons: need current quarter spend → need last quarter spend → calculate delta → check if increase is across all services or one outlier → then answer with evidence.
Solution
In Agent Foundations, apply Agent Architectures to this scenario: Question: 'Is our AWS spend trending up or down compared to last quarter?' Agent reasons: need current quarter spend → need last quarter spend → calculate delta → check if increase is across all services or one outlier → then answer with evidence. Identify the inputs, run the technique, validate the output, and note one thing you would monitor in production.
Practice Task
Do this before moving to the next module — reading alone is not enough.
Open the Code Walkthrough below and run it locally. Change one parameter related to Agent Architectures (e.g. model, temperature, top_k, or tool name), observe the difference in output, and write 2–3 sentences explaining what changed.
Code Walkthrough
Highlighted lines show where Agent Architectures happens in the code.
1REASONING_PROMPT = """Solve this task step by step.2
3Before each action, write your reasoning:4Thought: [analyze current state, what you know, what you need]5Action: [tool_name]6Action Input: [parameters]7
8After seeing results:9Observation: [what you learned]10Thought: [updated reasoning]11
12Task: {task}"""13
14messages = [15 {"role": "system", "content": REASONING_PROMPT.format(task=user_task)},16 {"role": "user", "content": user_task},17]Commands to Remember
Commands to Remember
pip install openai # minimal agent = LLM API + Python looppython agent.py # run your agent scriptpip install python-dotenv # load API keys from .env
Common Mistakes
- No reasoning step — agent jumps to wrong tool calls
- Unbounded reasoning consuming entire context window
- Not logging reasoning traces — failures are opaque
- Using expensive reasoning models for simple tool selection
- Free-form reasoning without structured format
Cheat Sheet
Quick recap — the most important points from this module.
Cheat Sheet
quick ref- •Think before acting
- •Thought → Action → Observation
- •CoT in system prompt
- •o1/o3 for hard reasoning
- •Budget reasoning tokens
- •Log all reasoning traces