Skip to content

sangdth/ai-patterns

Repository files navigation

AI Patterns

Overview

A repository for learning and experimenting with AI patterns. Each folder represents a separate pattern implementation. Inspired from "AI Agentic Patterns: A Hands-On Guide to Building Intelligent Systems" by Antonio Gulli.

Note

This project is designed to run locally with no authentication required. It serves as a learning playground and not suitable for production.

Tech Stack

  • Framework: Next.js 16
  • ORM: Drizzle ORM
  • Database: PostgreSQL
  • Package Manager: pnpm

Pattern Status

Pattern Name Status
00-base-chat-template Base chat template ✅ Complete
01-prompt-chaining Prompt chaining ✅ Complete
02-routing Routing 🚧 WIP
03-parallelization Parallelization ⏳ Not implemented
04-reflection Reflection ⏳ Not implemented
05-tool-use Tool Use (Function Calling) ⏳ Not implemented
06-planning Planning ⏳ Not implemented
07-multi-agents Multi-agent Collaboration ⏳ Not implemented
08-memory Memory Management ⏳ Not implemented
09-learning-adaptation Learning and Adaptation ⏳ Not implemented
10-mcp Model Context Protocol ⏳ Not implemented
11-goal-setting-monitoring Goal Setting and Monitoring ⏳ Not implemented
12-exception-handling-recovery Exception Handling and Recovery ⏳ Not implemented
13-human-in-the-loop Human in the Loop ⏳ Not implemented
14-rag Knowledge Retrieval ⏳ Not implemented
15-a2a Inter-Agent Communication ⏳ Not implemented
16-resource-aware Resource-Aware Optimization ⏳ Not implemented
17-reasoning Reasoning ⏳ Not implemented
18-guardrails Guardrails/Safety ⏳ Not implemented
19-evaluation-monitoring Evaluation and Monitoring ⏳ Not implemented
20-prioritization Prioritization ⏳ Not implemented
21-exploration-discovery Exploration and Discovery ⏳ Not implemented

Setup

  1. Install dependencies:
pnpm install
  1. Set up the database:

    • Ensure PostgreSQL is running (or use Docker Compose)
    • Configure your DATABASE_URL in .env
  2. Generate and run migrations:

pnpm db:generate
pnpm db:migrate
  1. Start the development server:
pnpm dev:next

Project Structure

Each folder in this repository represents a separate AI pattern implementation. Patterns are organized independently to allow focused learning and experimentation.

Database Commands

  • pnpm db:generate - Generate migration files from schema changes
  • pnpm db:migrate - Run pending migrations
  • pnpm db:studio - Open Drizzle Studio for database inspection
  • pnpm db:push - Push schema changes directly to database (dev only)
  • pnpm db:pull - Introspect database and generate schema

Development

The project uses Docker Compose for local development. Run pnpm dev to start all services, or pnpm dev:next to run only the Next.js development server.

About

For learning and experimenting with AI patterns

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages