Skip to content

Python framework for building AI Agents -> CLI & Quart-SSE UIs, Toolsmith RAG plug-ins, full Assistant-API workflows via the OpenAI SDK (OpenAI / Azure today). Support for DeepSeek & Qwen is pending Assistant endpoint access.

License

Notifications You must be signed in to change notification settings

SavinRazvan/flexiai-toolsmith

Repository files navigation

FlexiAI Toolsmith

FlexiAI Toolsmith is a flexible, multi-channel Python framework for building AI-powered chat assistants. It supports both CLI and web (Quart + SSE) interfaces, integrates with multiple AI providers via the OpenAI Python SDK, and enables assistants to invoke powerful tool plug-ins—including CSV / spreadsheet processing, YouTube search, security audits, dynamic forms, and (soon) OCR.

Provider Support Overview

  • OpenAI and Azure OpenAI — full Assistant-API support
  • 🟡 DeepSeek and Qwen — OpenAI SDK, but chat-completions only for now
  • GitHub Azure Inference — chat-completions only

⚙️ When any SDK-backed provider adds Assistant-API support, FlexiAI Toolsmith will pick it up automatically—no code changes required.


Table of Contents

  1. Features
  2. Tutorials / Quick Demos
  3. Architecture
  4. Prerequisites
  5. Installation
  6. Configuration
  7. Usage
  8. Contributing
  9. License

Features

Multi-Channel Publishing

Chat events can be streamed to:

  • CLI (CLIChannel)
  • Redis Pub/Sub (RedisChannel)
  • SSE Web clients via Quart (QuartChannel + SSEManager)

Tutorials / Quick Demos

▶ Quick Test: Quart channel demo    ▶ Quick Test: CLI channel demo


AI Provider Support

  • OpenAI & Azure OpenAI — full Assistant-API (threads, deltas, tool calls)
  • DeepSeek & Qwen — chat-completions via OpenAI SDK (Assistant-API pending)
  • GitHub Azure Inference — chat-completions only

Streaming Assistant API

  • Thread life-cycle management (create → queue → in-progress → complete)
  • Event routing via in-memory EventBus + EventDispatcher
  • Delta-based message streaming with MessageDeltaEvent

Dynamic RAG & Multi-Agent Tool Orchestration (via Toolsmith)

Toolsmith lets assistants invoke dynamic tools via tool calls, giving you a hybrid RAG + MAS system:

  • Agent coordination & delegation
    • save_processed_content / load_processed_content
    • initialize_agent / communicate_with_assistant

Built-in Tool Plug-ins

  • YouTube Searchsearch_youtube, search_on_youtube
  • Product Filteringfilter_products (ai_custom_products)
  • CSV Operationscsv_operations (CRUD)
  • Subscriber Managementidentify_subscriber, retrieve_billing_details, manage_services
  • Spreadsheet Operationsfile_operations, sheet_operations, data_entry_operations, …
  • Security Auditssecurity_audit (recon, port scans, defenses, updates)
  • Web Forms (Experimental) — Generates interactive forms as Markdown in the Quart/SSE chat UI; submissions are sent via a POST to /submit_user_info and persisted to CSV
  • OCR (Coming Soon)flexiai/toolsmith/_recycle/OCR.py

Configurable & Extensible

  • Pydantic-based .env for credentials, channels, logging, …
  • Modular factories for channels, credentials, handlers, tools
  • Structured logging with rotating file + console outputs

Architecture

📦 flexiai-toolsmith
 ┣ 📂 flexiai
 ┃ ┣ 📂 channels
 ┃ ┣ 📂 config
 ┃ ┣ 📂 controllers
 ┃ ┣ 📂 core
 ┃ ┃ ┣ 📂 events
 ┃ ┃ ┗ 📂 handlers
 ┃ ┣ 📂 credentials
 ┃ ┣ 📂 database
 ┃ ┣ 📂 toolsmith
 ┃ ┗ 📂 utils
 ┣ 📂 static
 ┣ 📂 templates
 ┣ 📜 .env
 ┣ 📜 .env.template
 ┣ 📜 .gitignore
 ┣ 📜 app.py
 ┣ 📜 chat.py
 ┣ 📜 environment.yml
 ┣ 📜 requirements.in
 ┗ 📜 requirements.txt

Prerequisites

  • Python 3.12+
  • Redis (if redis in ACTIVE_CHANNELS)
  • Conda (Miniconda/Anaconda) or pip + venv

Installation

  1. Clone the repository

    git clone https://github.com/SavinRazvan/flexiai-toolsmith.git
  2. Set up the environment (Conda recommended)

    conda env create -f environment.yml
    conda activate .conda_flexiai

    Or use venv + pip:

    python -m venv .venv
    source .venv/bin/activate
    pip install -r requirements.txt

Configuration

Copy .env.template.env, then edit:

Variable Description Example
CREDENTIAL_TYPE openai, azure, deepseek, qwen, github_models openai
OPENAI_API_KEY, … Provider credentials sk-…
ACTIVE_CHANNELS cli, redis, quart (comma-separated) cli,quart
USER_PROJECT_ROOT_DIR Absolute project root path /home/user/code
YOUTUBE_API_KEY (opt.) Needed for YouTube search tool AIza…

ℹ️ Assistant-API features currently work on OpenAI & Azure OpenAI only; DeepSeek & Qwen auto-enable once their endpoints support it.


Usage

CLI Chat (WSL or Linux)

python chat.py
  • Prompts show as 👤 You
  • Assistant messages stream as 🌺 Assistant

Web Chat (Quart + SSE)

hypercorn app:app --bind 127.0.0.1:8000 --workers 1
  1. Browse to http://127.0.0.1:8000/chat/
  2. Start chatting in the live SSE UI

Contributing

  1. Fork ➜ create a feature branch

    git checkout -b feature/my-feature
  2. Commit with clear messages

  3. Open a pull request explaining context & purpose


License

Released under the MIT License — see LICENSE for full terms.

About

Python framework for building AI Agents -> CLI & Quart-SSE UIs, Toolsmith RAG plug-ins, full Assistant-API workflows via the OpenAI SDK (OpenAI / Azure today). Support for DeepSeek & Qwen is pending Assistant endpoint access.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published