agentic_ai_basics

agent

Agent — an AI system that autonomously perceives, reasons, plans, and acts to achieve a goal, beyond simple question-answering.

agent.py

A budget-checking agent. Give it one goal (e.g. “do these purchases fit under my budget?”) and pursue_goal() runs unattended — deciding its own steps, tool calls, and when it’s done — until it produces a final answer or hits MAX_STEPS.

Concepts covered

Run

From the repo root:

pip install -r requirements.txt
export ANTHROPIC_API_KEY=your-key-here
python3 Core_Architecture/agent/agent.py

Try (or just press enter for the built-in default):

Goal: I want to buy 3 items priced at $12.50, $7.25, and $19.99. My budget is $50. Do they fit, and how much would I have left over?

[step 1] act: calculate({'expression': '12.50 + 7.25 + 19.99'})
[step 1] perceive: 12.50 + 7.25 + 19.99 = 39.74

[step 2] act: record_finding({'finding': 'total is 39.74, under the $50 budget'})
[step 2] perceive: Noted: total is 39.74, under the $50 budget

[step 3] agent finished on its own

Final answer: Yes, they fit under your $50 budget, with $10.26 left over.

Configuration

See also