← Back to all products

AI Agent Framework

$29

Python framework for building AI agents with tool use, planning loops, memory, and multi-step reasoning.

📁 11 files
JSONMarkdownPythonReactLLMOpenAILangChain

📄 Product Preview

Try the interactive reader and demo tools below, or get the full product with all content unlocked.

📖 Interactive Reader (Free Preview) ⚙ Try Demo Tools 📦 Download Free Sample

📁 File Structure 11 files

ai-agent-framework/ ├── LICENSE ├── README.md ├── examples/ │ ├── basic_usage.py │ └── custom_tools.json ├── free-sample.zip ├── guide/ │ ├── 01_features.md │ ├── 02_project-structure.md │ ├── 03_usage-examples.md │ └── 04_license.md ├── index.html └── src/ └── ai_agent_framework.py

📖 Documentation Preview README excerpt

AI Agent Framework

Python framework for building AI agents with tool use, planning loops, memory management, multi-step reasoning, and structured output parsing. Zero dependencies.

Part of the AI Toolkit collection by [CodeVault](https://ai-toolkit.codevault.dev).

Features

  • ReAct loop — Thought → Action → Observation reasoning loop (same pattern as LangChain/AutoGPT)
  • Tool system — Register custom tools with parameter schemas and callable functions
  • Memory manager — Sliding-window context management with intelligent trimming
  • Output parser — Parses structured Thought/Action/Final Answer format from LLM responses
  • Built-in tools — Search, calculator, and JSON formatter included as examples
  • LLM-agnostic — Abstract LLMInterface — wire to OpenAI, Anthropic, or any API
  • Safety limits — Configurable max_steps prevents infinite loops
  • Full trace — Every step recorded with thought, action, observation
  • Config export — Export agent configuration as JSON

Quick Start


# Run the demo with a simulated agent
python src/ai_agent_framework.py --demo

# List all registered tools
python src/ai_agent_framework.py --list-tools

# Export agent config
python src/ai_agent_framework.py --export-config my_agent.json

# Run agent on a task (uses simulated LLM)
python src/ai_agent_framework.py --task "What is the population of Helsinki?"

Project Structure


ai-agent-framework/
├── README.md
├── LICENSE
├── src/
│   └── ai_agent_framework.py    # Core engine (~420 lines)
└── examples/
    ├── basic_usage.py             # Build a custom agent
    └── custom_tools.json          # Tool definition examples

CLI Reference

FlagDescription
--demoRun simulated agent demo
--list-toolsList all registered tools
--export-config FILEExport agent config to JSON
--task TEXTRun agent on a task (simulated LLM)

Usage Examples

Wire to a Real LLM

... continues with setup instructions, usage examples, and more.

📄 Code Sample .py preview

src/ai_agent_framework.py #!/usr/bin/env python3 """ AI Agent Framework — AI Toolkit (DataNest) A self-contained Python framework for building AI agents with tool use, planning loops, memory management, multi-step reasoning, and structured output parsing. Zero external dependencies — Python 3.10+ stdlib only. This framework provides the SKELETON that you wire to any LLM API. It handles the hard parts: tool dispatch, thought/action/observation loops, memory context windows, and output parsing. Usage: python ai_agent_framework.py --demo # run a simulated agent loop python ai_agent_framework.py --list-tools # show registered tools python ai_agent_framework.py --export-config agent.json """ from __future__ import annotations import argparse import json import logging import re import sys import time from abc import ABC, abstractmethod from dataclasses import dataclass, field from enum import Enum, auto from pathlib import Path from typing import Any, Callable # --------------------------------------------------------------------------- # Logging # --------------------------------------------------------------------------- logging.basicConfig( level=logging.INFO, format="%(asctime)s [%(levelname)s] %(name)s: %(message)s", ) logger = logging.getLogger("ai_agent_framework") # --------------------------------------------------------------------------- # Constants # --------------------------------------------------------------------------- MAX_STEPS: int = 10 # safety limit — agent can't loop forever MAX_MEMORY_TOKENS: int = 4000 # approximate context window for memory DEFAULT_AGENT_NAME: str = "Agent" THOUGHT_ACTION_PATTERN: str = ( r"Thought:\s*(.+?)(?:\n|$)" r".*?Action:\s*(.+?)(?:\n|$)" r".*?Action Input:\s*(.+?)(?:\n|$)" # ... 597 more lines ...
Buy Now — $29 Back to Products