Skip to content

boli-del/ai-agent-creator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

44 Commits
 
 
 
 
 
 
 
 

Repository files navigation

AI Agent Generator

A PyTorch-based framework to automatically generate AI agents tailored to user needs. Provide a simple natural-language prompt, and the system constructs a transformer-based agent (with embeddings, attention, and slot-filling) ready to be deployed as a conversational assistant for industries, customer support, education, and more. (work in progress, starting with the transformers, have not built the agent workflow generating)


Table of Contents


Overview

This project lets you turn a one-line prompt (e.g., “Build a customer-support agent for the educational sector”) into a fully operational transformer-based AI agent. The pipeline:

  1. Prompt Parsing: Extract high-level intent and required details (industry, domain, slots).
  2. Agent Generation: Auto-assemble embeddings, encoder–decoder layers, and slot classifiers.
  3. Deployment Ready: Export the trained model and inference loop for integration into chat applications.

Features

  • Prompt-Driven Agent Creation
    Build a specialized chatbot by simply describing your use case.

  • Rich Embeddings
    Token + role + turn-index embeddings with scaling, normalization, and dropout.

  • Dynamic Slot-Filling
    Configurable slots (industry, urgency, product, etc.) extracted via classification and span prediction.

  • Prefix-Caching Decoder
    Efficient incremental generation of clarifying questions and final responses.

  • Modular Design
    Swap in new attention heads, embeddings, or slot schemas with minimal changes.


Architecture

  1. Prompt Parser

    • CLI or API to parse user prompt into intent + slot schema.
  2. Agent Builder

    • Programmatically instantiate TransformerChatbot with slot definitions.
  3. Embedding Layer

    • RichEmbeddings: tokens + roles + turns.
  4. Transformer Core

    • Encoder–decoder stacks with multi-head attention and feed-forward networks.
  5. Slot Classifier & Extractor

    • Heads to mark slots as filled/missing and retrieve values.
  6. Inference Engine

    • Dialogue manager to run multi-turn Q&A, fill slots, and finalize agent.

Getting Started

Prerequisites

  • Python 3.7+
  • PyTorch 1.7+
  • NumPy

Installation

git clone https://github.com/yourusername/ai-agent-generator.git
cd ai-agent-generator
python -m venv .venv
source .venv/bin/activate  # or .venv\Scripts\activate on Windows
pip install -r requirements.txt

Usage

Generating a New Agent

# Example: create an agent for educational customer support
python run_agent_generator.py \
  --prompt "Build an AI agent for answering student questions in the educational sector" \
  --output_dir ./agents/education_bot

This produces:

  • model.pth: trained weights
  • config.json: slot definitions and hyperparameters
  • inference.py: script to run the chat interface

Customizing Slots & Intents

Pass a JSON schema to define custom slots:

{
  "slots": ["industry", "department", "urgency"],
  "intents": ["support", "sales", "feedback"]
}

Use --schema my_schema.json when running run_agent_generator.py.


Data & Training

  1. Prepare Dialogues: Multi-turn conversations with slot annotations.
  2. Tokenize & Tag: Generate token, role, and turn tensors.
  3. Train: python train.py --data data/dialogues.json
  4. Evaluate: Slot accuracy, dialogue length, and response quality.

Project Structure

ai-agent-generator/
├── src/
│   ├── embeddings.py         # RichEmbeddings
│   ├── positional_encoding.py
│   ├── attention.py          # MultiHeadAttention & ScaledDotProduct
│   ├── transformer.py        # TransformerChatbot
│   ├── slot_classifier.py
│   ├── run_agent_generator.py
│   └── train.py
├── agents/                   # Saved generated agents
├── data/                     # Sample dialogue datasets
├── requirements.txt
└── README.md

Contributing

  1. Fork the repo
  2. Create a branch (git checkout -b feature/new-agent)
  3. Commit your changes
  4. Push to your fork and open a PR

Please add tests and update documentation for new features.


License

MIT License

Feel free to adapt and extend this framework to generate AI agents for any domain!

References & Further Reading

  • Vaswani, A. et al. (2017). Attention Is All You Need. NeurIPS.
  • “The Annotated Transformer” by Harvard NLP
  • “The Illustrated Transformer” by Jay Alammar
  • PyTorch’s official Transformer tutorial

About

A tool for creating ai-agents and workflows with ease - work in progress

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors