🤖

AI Agents

👨‍🍳👑 Master Chef

Autonomous AI Agents

An agent = LLM + tools + reasoning loop to complete complex tasks.


Agent vs Chatbot

ChatbotAgent
One responseMultiple steps
No toolsUses tools
ReactiveProactive
You controlIt decides

Agent architecture

              ┌─────────────────────────────────┐
              │            AGENT                │
              │  ┌─────────────────────────┐    │
              │  │       Reasoning         │    │
   Task  ───→ │  │  (ReAct, CoT, ToT)      │ ───→ Result
              │  └───────────┬─────────────┘    │
              │              ↓                  │
              │  ┌─────────────────────────┐    │
              │  │        Tools            │    │
              │  │  [Web] [Code] [Files]   │    │
              │  └─────────────────────────┘    │
              └─────────────────────────────────┘

ReAct pattern

Thought: I need to search Madrid's weather
Action: search_weather("Madrid")
Observation: 22°C, sunny
Thought: I have the info now
Action: respond("The weather in Madrid is 22°C...")

Common tools

ToolUse
web_searchSearch information
read_fileRead documents
write_fileCreate files
run_codeExecute Python
ask_userRequest clarification

Basic agent with OpenAI

tools = [
    {
        "type": "function",
        "function": {
            "name": "search",
            "description": "Search the web",
            "parameters": {
                "type": "object",
                "properties": {
                    "query": {"type": "string"}
                }
            }
        }
    }
]

# Agent loop
while True:
    response = client.chat.completions.create(
        model="gpt-4o",
        messages=messages,
        tools=tools
    )

    if response.choices[0].finish_reason == "tool_calls":
        # Execute tool
        tool_call = response.choices[0].message.tool_calls[0]
        result = execute_tool(tool_call)
        messages.append({"role": "tool", "content": result})
    else:
        # Final response
        break

Agent frameworks

FrameworkFocus
LangChainChains and agents
LangGraphState graphs
CrewAIMulti-agent
AutoGenConversation
Claude CodeCoding agent

🏦 Real Case: Bank Reconciliation Agent

Agents excel at financial tasks requiring multiple steps and decisions.

Example: Reconciliation Agent

tools = [
    {"name": "fetch_bank_transactions", "description": "Get transactions from bank"},
    {"name": "fetch_internal_records", "description": "Get internal records"},
    {"name": "compare_records", "description": "Compare and find differences"},
    {"name": "generate_report", "description": "Create reconciliation report"},
    {"name": "flag_discrepancy", "description": "Flag discrepancy for review"},
]

# The agent decides what to do
system_prompt = """
You are a bank reconciliation agent. Your job:
1. Get bank transactions (last 24h)
2. Get internal records for the same period
3. Compare and find discrepancies
4. If differences > $100, flag for human review
5. Generate final report

Be meticulous. An error here costs real money.
"""

Agent Flow

Task: "Reconcile yesterday's transactions"
    ↓
Thought: First I get bank transactions
Action: fetch_bank_transactions("2024-01-15")
Observation: 847 transactions, total $1,234,567
    ↓
Thought: Now internal records
Action: fetch_internal_records("2024-01-15")
Observation: 845 transactions, total $1,234,123
    ↓
Thought: There's a difference. Compare in detail
Action: compare_records(bank, internal)
Observation: 2 missing transactions, difference $444
    ↓
Thought: Difference > $100, flag for review
Action: flag_discrepancy({amount: 444, txns: [...]})
    ↓
Action: generate_report() → ✅ Report sent

Other Fintech Use Cases

CaseToolsValue
Risk analysisCredit bureau APIs, calculatorsAutomated credit decision
Fraud detectionDatabases, rules, MLReal-time blocking
KYC onboardingOCR, verification, PEP databasesHours → minutes
Customer supportCRM, knowledge baseResolution without humans

💡 Agents are ideal when the task has multiple steps and requires intermediate decisions.


Practice

Autonomous AI Agent

© 2026 luxIA.us - All rights reserved

Created by Alann Reyes