Lab 15: AI Agents — ReAct & Tool Use

Objective

Build a functional AI agent that uses the ReAct (Reasoning + Acting) pattern to autonomously research security topics, query tools, and synthesise findings. Understand how modern AI agents like Claude Code and AutoGPT work under the hood.

Time: 50 minutes | Level: Practitioner | Docker Image: zchencow/innozverse-ai:latest


Background

An AI agent differs from a chatbot by having tools and autonomy:

Chatbot:   User asks → LLM answers (one shot)

Agent:     User gives goal → Agent plans → Agent uses tools → Agent reflects
           → Agent uses more tools → Agent synthesises → Agent answers

ReAct loop:
  Thought:  "I need to find CVEs for Apache Log4j"
  Action:   search_cve(product="log4j")
  Observation: ["CVE-2021-44228", "CVE-2021-45046", ...]
  Thought:  "Now I need severity scores for these"
  Action:   get_cvss(cve="CVE-2021-44228")
  Observation: {"score": 10.0, "vector": "AV:N/AC:L/PR:N/UI:N"}
  Thought:  "I have enough to answer"
  Final Answer: "Log4j has 2 critical CVEs, the worst being..."

Step 1: Environment Setup

📸 Verified Output:


Step 2: Define Agent Tools

📸 Verified Output:


Step 3: Implement the ReAct Agent Loop

📸 Verified Output:


Step 4: Memory-Enhanced Agent

📸 Verified Output:


Step 5: Multi-Step Research Pipeline

📸 Verified Output:


Step 6: Tool Selection with Scoring

📸 Verified Output:


Step 7: Parallel Tool Execution

📸 Verified Output:


Step 8: Real-World Capstone — Autonomous Threat Intelligence Agent

📸 Verified Output:


Summary

Agent Component
Purpose
Production Implementation

Tools

External actions

APIs, databases, file system

ReAct loop

Plan → Act → Observe → Repeat

LLM generates Thought/Action

Memory

Recall prior findings

Vector DB + conversation history

Tool selection

Pick right tool for query

LLM function calling / semantic similarity

Parallel execution

Speed up independent tasks

Threading / async

Key Takeaways:

  • Agents = LLM + tools + loop; the LLM provides the reasoning

  • B=0 init in LoRA and careful tool definitions prevent hallucination

  • Memory allows multi-session research and context accumulation

  • Parallel tool execution dramatically speeds up multi-step research

Further Reading

Last updated