Skip to main content

A comprehensive framework for building agents with Small Language Models

Project description

effGen

effGen

Build AI Agents with Small Language Models

Fast โ€ข Efficient โ€ข Powerful


CI arXiv PyPI Python License

Total Downloads Monthly Downloads Stars Forks Prompt Library Multimodal Cookbook

Paper Website Docs PyPI


๐Ÿ“ฐ News & Updates

Date Update
๐Ÿ–ผ๏ธ 21 May 2026 v0.2.8 Released: First-class multimodal input โ€” image, audio, and video across 6 providers (Gemini, OpenAI, Groq, Anthropic, Together, HF). New multimodal preset, MultimodalDescribeTool, unified Message content schema, 5 cookbook walkthroughs. See changelog
๐Ÿ“š 20 May 2026 v0.2.7 Released: 31 prompt templates across 7 domains โ€” research, coding, data/SQL, legal, medical, creative, business โ€” with golden eval harness, interactive playground, and auto-generated gallery. See changelog
๐Ÿš€ 19 May 2026 v0.2.6 Released: 14 new tools โ€” OCR, AudioTranscribe, ImageInfo, ImageCaption, PDF, DOCX, Excel, Weather, Geocode, Maps, EmailSMTP, EmailIMAP, SlackWebhook, DiscordWebhook. New presets: media, notify. 58+ built-in tools total. See changelog
๐Ÿš€ 18 May 2026 v0.2.5 Released: 13 new free tools โ€” PubMed, ArXiv, SemanticScholar, RSS, News, YouTubeTranscript, YouTubeMetadata, Reddit, HackerNews, Translate, LanguageDetect, QRGenerate, QRRead. 44+ built-in tools total. See changelog
๐Ÿš€ 14 May 2026 v0.2.4 Released: ModelRouter with CostBased/LatencyBased/FirstAvailable policies, transparent provider failover, cross-process SQLite rate-limit coordination, persistent cost tracker + effgen cost dashboard CLI. See changelog
๐Ÿš€ 4 May 2026 v0.2.3 Released: 5 new cloud backends (Groq, Together AI, Fireworks, Replicate, HuggingFace Inference) โ€” 9 providers total. Unified ProviderRegistry, effgen doctor auth check, backend parity matrix. See changelog
๐Ÿš€ 25 Apr 2026 v0.2.1 Released: Cerebras backend (4 free-tier models, streaming, native tool-calling, rate-limit coordinator, cost tracking) + OpenAI gpt-5/gpt-5.4-nano/o-series with reasoning_effort, prompt caching, structured outputs v2, and OpenAI native tools (web_search, code_interpreter, file_search). See changelog
๐Ÿš€ 9 Apr 2026 v0.2.0 Released: Major release โ€” native tool calling, guardrails, multi-agent orchestration, RAG pipeline, 31 tools, eval framework, production API server, MLX Apple Silicon support, Python & TypeScript SDKs. See changelog
๐ŸŽ 8 Apr 2026 MLX & Apple Silicon support merged (PR #4): Native Metal GPU acceleration via MLX & MLX-VLM backends. pip install effgen[mlx]
๐Ÿ”ง 25 Mar 2026 v0.1.3 Released: Verification hardening โ€” smarter loop detection, "skip the tool" prompting, model-aware token counting, sub-agent depth limits, circuit breaker persistence. See changelog
๐Ÿ”ง 12 Mar 2026 v0.1.2 Released: Test-driven hardening โ€” 10 example agents, 19 bug fixes, cross-model compatibility matrix (11 models, 73% pass rate). See changelog
๐Ÿ”’ 6 Mar 2026 v0.1.1 Released: Stabilization โ€” fixed license/metadata consistency, improved error handling, added 6 examples, expanded test suite. See changelog
๐ŸŽ‰ 1 Mar 2026 v0.1.0 Released: Major feature release โ€” 14 built-in tools, agent presets, plugin system, real streaming, memory integration, ACP/MCP protocols, CI/CD, and comprehensive test suite. See changelog
๐Ÿ”ง 3 Feb 2026 v0.0.2 Released: vLLM backend fixes with automatic chat template support, GPU memory control, improved OOM error handling, and multi-model family compatibility
๐Ÿ“„ 2 Feb 2026 Preprint available: EffGen: Enabling Small Language Models as Capable Autonomous Agents
๐Ÿš€ 31 Jan 2026 Initial release of effGen framework (v0.0.1)

๐Ÿค” What is effGen?

effGen transforms Small Language Models into powerful AI agents. While most frameworks require massive LLMs, effGen is optimized from the ground up for efficient, smaller models โ€” delivering fast, capable agents without the compute overhead.

from effgen import Agent, load_model
from effgen.core.agent import AgentConfig
from effgen.tools.builtin import Calculator, PythonREPL

# Load a small but mighty model
model = load_model("Qwen/Qwen2.5-1.5B-Instruct", quantization="4bit")

# Create agent with tools
config = AgentConfig(
    name="math_agent",
    model=model,
    tools=[Calculator(), PythonREPL()]
)
agent = Agent(config=config)

# Run computation
result = agent.run("What is 24344 * 334?")
print(f"Answer: {result.output}")

โšก Installation

Requires Python 3.10 or newer. Tested on Python 3.10, 3.11, 3.12, 3.13.

๐Ÿ“ฆ From PyPI (Recommended)

pip install effgen

๐ŸŽ Apple Silicon (MLX)

pip install effgen[mlx]          # Text models on Apple Silicon
pip install effgen[mlx-vlm]      # Vision-Language models on Apple Silicon

๐Ÿš€ With vLLM for Faster Inference

pip install effgen[vllm]

๐Ÿ“Š Optional Extras

pip install effgen[cerebras]  # Cerebras inference backend (cerebras-cloud-sdk)
pip install effgen[rag]       # RAG pipeline (sentence-transformers, faiss-cpu)
pip install effgen[finance]   # Finance tools (yfinance)
pip install effgen[data]      # Data science tools (matplotlib, plotly)
pip install effgen[eval]      # Evaluation (rouge-score, nltk)
pip install effgen[gguf]      # GGUF model support (llama-cpp-python)

๐Ÿ”ง From Source

git clone https://github.com/ctrl-gaurav/effGen.git
cd effGen

# Quick install
./install.sh

# Full install (includes vLLM + dev tools)
./install.sh --full

# Manual install
pip install -e .

๐Ÿš€ Quick Start

๐Ÿ’ป CLI Usage

# Run a task
effgen run "What is the capital of France?"

# Interactive chat
effgen chat

# Start API server
effgen serve --port 8000

# Interactive wizard
effgen

๐Ÿ Python API

from effgen import Agent, load_model
from effgen.core.agent import AgentConfig
from effgen.tools.builtin import Calculator

# Load model
model = load_model("Qwen/Qwen2.5-1.5B-Instruct", quantization="4bit")

# Configure agent
config = AgentConfig(
    name="calculator_agent",
    model=model,
    tools=[Calculator()],
    system_prompt="You are a helpful math assistant."
)

# Create and run
agent = Agent(config=config)
result = agent.run("Calculate 15% tip on $85.50")
print(result.output)

โœจ Features

๐Ÿง 
SLM Optimized
Small models

๐ŸŽ
Apple Silicon
MLX + Metal GPU

๐Ÿ›ก๏ธ
Guardrails
PII, injection, safety

๐Ÿ“š
RAG Pipeline
Ingest, search, cite

๐Ÿ‘ฅ
Multi-Agent
DAG workflows

๐Ÿ–ผ๏ธ
Multimodal
image/audio/video

๐Ÿญ
Production API
OpenAI-compat


๐Ÿ†• What's New in v0.2.8

effGen v0.2.8 makes multimodal input a first-class citizen. Send images, audio clips, and short video to any vision-capable provider through a unified Message schema โ€” the adapter handles the translation, not your code. No breaking API changes.

Image input โ€” Gemini, OpenAI gpt-4o, Groq, Anthropic (code-only), Together, HF. Automatic resize/MIME validation via image_pre.py. Raises CapabilityNotSupportedError cleanly when the provider doesn't support vision.

Audio input โ€” Gemini native inline audio, OpenAI Whisper transcription + gpt-4o audio, HF Inference ASR. Auto-downsamples to 16 kHz mono; chunks files over provider max duration. Anthropic raises CapabilityNotSupportedError.

Video input โ€” Gemini native video for providers that accept raw video; frame-sampling fallback (ffmpeg) for all others. MissingSystemDependency with install hints when ffmpeg is absent.

Unified message schema โ€” TextPart, ImagePart, AudioPart, VideoPart form a typed ContentPart union. Message.content is always a List[ContentPart]; backwards-compatible string constructor still works.

multimodal preset โ€” create_agent("multimodal", model) wires Gemini Flash-Lite (primary) + OpenAI gpt-4o-mini (fallback) with ImageInfo, ImageCaption, OCR, AudioTranscribe, MultimodalDescribeTool, and the full tool suite.

5 cookbook walkthroughs โ€” image Q&A, audio transcribe + reason, video summarize, OCR + LLM structured extraction, chart reading from an image.

from effgen import image_from, audio_from, video_from, load_model
from effgen.core.messages import Message, Role
from effgen.presets import create_agent

model = load_model("gemini-2.0-flash", provider="gemini")
agent = create_agent("multimodal", model)

# Image question
img = image_from("https://upload.wikimedia.org/wikipedia/commons/thumb/4/47/PNG_transparency_demonstration_1.png/240px-PNG_transparency_demonstration_1.png")
msg = Message(role=Role.USER, content=[img, "What is in this image?"])
result = agent.run_message(msg)
print(result.output)

# Audio transcription
aud = audio_from("/tmp/clip.mp3")
msg = Message(role=Role.USER, content=[aud, "Transcribe and summarize."])
result = agent.run_message(msg)
# Multimodal preset via CLI
effgen run --preset multimodal "Describe this image" --image /tmp/photo.jpg

See the multimodal overview and the cookbook index.


๐Ÿ†• What's New in v0.2.7

effGen v0.2.7 ships the Prompt Library โ€” a curated, domain-organized catalog of 31 reusable prompt templates across 7 domains, paired with a golden evaluation harness and an interactive playground CLI. No breaking API changes.

Research โ€” literature review (zero-shot + CoT), paper summary, citation extraction, methodology critique.

Coding โ€” code review, bug diagnosis, refactoring plan, test generation, docstring fill.

Data / SQL โ€” NL-to-SQL with JSON output + sqlglot validation, SQL explain, SQL optimize, data profile, ETL plan.

Legal โ€” contract summary, clause classify, research brief. Every template enforces a mandatory legal disclaimer verbatim.

Medical โ€” symptom triage, drug interaction, medical literature synthesis. Every template enforces a mandatory medical disclaimer verbatim.

Creative โ€” story continuation (ร—2), poetry forms, character bio, world building.

Business โ€” meeting summary, email draft (formal/casual), OKR generation, SWOT analysis, elevator pitch (โ‰ค150 words, word-count-verified).

# Discover templates
effgen prompts list
effgen prompts list --domain research --format markdown

# Evaluate (no model needed โ€” golden test)
effgen prompts eval

# Live eval (runs through a real model)
effgen prompts eval --domain coding --live --model llama3.1-8b

# Interactive playground
effgen prompts playground
from effgen.prompts.library import registry

p = registry.get("data.sql_from_nl.v1")
sql_prompt = p.template(
    schema_ddl="CREATE TABLE orders (id INT, total FLOAT, created_at DATE)",
    question="Total revenue this month",
    dialect="sqlite",
)

See the full prompt gallery for all 31 templates.


๐Ÿ†• What's New in v0.2.6

effGen v0.2.6 adds 14 new built-in tools across document, media, and communication categories โ€” bringing the total to 58+ โ€” plus two new presets (media, notify). No breaking API changes.

  1. OCR โ€” OCRTool (Tesseract local + OCR.space fallback). Raises a clear error with per-OS install hints when no backend is available.
  2. Audio Transcription โ€” AudioTranscribeTool (faster-whisper local; HF Inference fallback; GPU auto-detected).
  3. Image Analysis โ€” ImageInfoTool (Pillow metadata, zero network) + ImageCaptionTool (router-driven vision provider).
  4. Document Parsing โ€” PDFTool (pypdf + pdfplumber), DOCXTool (python-docx), ExcelTool (openpyxl + pandas). Added to research and general presets.
  5. Geo / Weather โ€” WeatherTool (Open-Meteo, free), GeocodeTool (Nominatim/OSM, 1 req/s), MapsTool (staticmap PNG).
  6. Email & Webhooks โ€” EmailSMTPTool, EmailIMAPTool, SlackWebhookTool, DiscordWebhookTool. All in the new notify preset. Webhook URLs are redacted in logs.
from effgen.tools.builtin.ocr import OCRTool
result = OCRTool().execute({"operation": "extract", "image_path": "/tmp/scan.png"})
print(result["data"]["text"])

See the full tool gallery for quickstart snippets for all 58+ tools.


๐Ÿ†• ModelRouter โ€” Smart Multi-Provider Routing (v0.2.4)

Route requests across 9 cloud providers automatically โ€” pick the cheapest, fastest, or first available:

from effgen import PolicyBasedRouter, RoutingContext, CostBasedPolicy, LatencyBasedPolicy
from effgen.models.capabilities import Capability

# Build a router: try fastest first, fall back to cheapest
router = PolicyBasedRouter(policies=[LatencyBasedPolicy(), CostBasedPolicy()])

ctx = RoutingContext(
    prompt_tokens_estimate=500,
    user_budget_usd=0.01,       # stay within $0.01
    latency_budget_ms=3000,     # need response in under 3s
    required_capabilities={Capability.chat},
)

decision = router.route(ctx)
print(decision.chosen)      # e.g., ProviderModelPair("cerebras", "llama3.1-8b")
print(decision.eliminated)  # [(pair, reason), ...] โ€” fully explainable

Transparent failover โ€” route_and_execute retries on rate-limits, 5xx errors, or timeouts and seamlessly moves to the next-best provider.

Cost dashboard โ€” track every API call:

effgen cost today          # per-provider per-model table
effgen cost week           # rolling 7-day view
effgen cost set-budget 1.0 # set $1/day cap

๐ŸŽฏ Agent Presets

Get started instantly with ready-to-use agent configurations:

from effgen import load_model
from effgen.presets import create_agent

model = load_model("Qwen/Qwen2.5-3B-Instruct", quantization="4bit")

# One-line agent creation
math_agent     = create_agent("math", model)       # Calculator + PythonREPL
research_agent = create_agent("research", model)   # WebSearch + URLFetch + Wikipedia + PubMed + ArXiv + PDF + DOCX + Excel
coding_agent   = create_agent("coding", model)     # CodeExecutor + PythonREPL + FileOps + Bash
general_agent  = create_agent("general", model)    # 64+ built-in tools
minimal_agent  = create_agent("minimal", model)    # Direct inference, no tools
media_agent    = create_agent("media", model)      # AudioTranscribe + ImageCaption
notify_agent   = create_agent("notify", model)     # EmailSMTP + EmailIMAP + Slack + Discord
multimodal_agent = create_agent("multimodal", model) # Image/Audio/Video + MultimodalDescribe
# CLI preset support
effgen run --preset math "What is sqrt(144)?"
effgen run --preset research "Tell me about quantum computing"

๐Ÿ› ๏ธ Built-in Tools (64+)

๐Ÿ”ข
Calculator
Math & Units

๐ŸŒ
WebSearch
DuckDuckGo

๐Ÿ’ป
CodeExecutor
Sandboxed

๐Ÿ
PythonREPL
Interactive

๐Ÿ“
FileOps
Read/Write

๐Ÿ”
Retrieval
RAG + BM25

๐ŸŽฏ
AgenticSearch
ripgrep

๐Ÿ–ฅ๏ธ
BashTool
Shell Cmds

๐ŸŒค๏ธ
WeatherTool
Open-Meteo

๐Ÿ“‹
JSONTool
Query/Validate

๐Ÿ•
DateTimeTool
Timezones

๐Ÿ“
TextProcessing
Regex/Count

๐Ÿ”—
URLFetch
Web Scrape

๐Ÿ“–
Wikipedia
Free API

๐Ÿ“ฐ
News & RSS
NewsAPI + feeds

๐Ÿ“š
PubMed/ArXiv
Academic search

๐ŸŽฌ
YouTube
Transcript+meta

๐Ÿ’ฌ
Reddit / HN
Social feeds

๐ŸŒ
Translate
LibreTranslate

๐Ÿ” 
LanguageDetect
55+ langs

โ–ฉ
QR Gen/Read
zbar fallback

๐Ÿ”
OCR
Tesseract + OCR.space

๐ŸŽ™๏ธ
AudioTranscribe
faster-whisper

๐Ÿ–ผ๏ธ
ImageInfo+Caption
Pillow + VLM

๐Ÿ“„
PDF/DOCX/Excel
Document parsing

๐Ÿ—บ๏ธ
Geocode + Maps
OSM/Nominatim

โœ‰๏ธ
Email SMTP/IMAP
Send + read

๐Ÿ“ฃ
Slack + Discord
Webhooks

See the full tool gallery for quickstart snippets for all 64+ tools.


๐Ÿ“š Examples

python examples/basic/basic_agent.py               # Basic agent (Transformers backend)

python examples/basic/basic_agent_vllm.py          # Basic agent (vLLM backend - 5-10x faster)

python examples/web_retrieval/web_agent.py         # Web search agent

python examples/web_retrieval/retrieval_agent.py   # RAG-based retrieval

python examples/web_retrieval/agentic_search_agent.py # Grep-based agentic search
๐Ÿ“– More Examples

Multi-Tool Agent

from effgen import Agent, load_model
from effgen.core.agent import AgentConfig
from effgen.tools.builtin import Calculator, WebSearch, PythonREPL

model = load_model("Qwen/Qwen2.5-3B-Instruct")

config = AgentConfig(
    name="research_agent",
    model=model,
    tools=[Calculator(), WebSearch(), PythonREPL()],
    system_prompt="You are a research assistant."
)

agent = Agent(config=config)
result = agent.run("Search for the population of Tokyo and calculate what percentage it is of Japan's total population")

Streaming

from effgen import Agent, load_model
from effgen.core.agent import AgentConfig
from effgen.tools.builtin import Calculator

model = load_model("Qwen/Qwen2.5-3B-Instruct", quantization="4bit")
agent = Agent(config=AgentConfig(
    name="stream_demo", model=model,
    tools=[Calculator()], enable_streaming=True
))

for token in agent.stream("What is 2 + 2?"):
    print(token, end="", flush=True)

Memory (Multi-Turn)

agent = Agent(config=AgentConfig(
    name="memory_demo", model=model,
    tools=[], enable_memory=True
))

agent.run("My name is Alice and I'm working on quantum computing.")
result = agent.run("What's my name and what am I working on?")
# โ†’ "Your name is Alice and you're working on quantum computing."

Retrieval Agent (RAG)

from effgen.tools.builtin import Retrieval

retrieval_tool = Retrieval(knowledge_base_path="./docs")
config = AgentConfig(name="qa_agent", model=model, tools=[retrieval_tool])
agent = Agent(config=config)
result = agent.run("What does the documentation say about configuration?")

๐Ÿ”’ Security

๐Ÿณ
Docker Sandbox
Isolated execution

๐Ÿ›ก๏ธ
Input Validation
Auto sanitization

โšก
Rate Limiting
Configurable limits

๐Ÿ“‹ For security policies and vulnerability reporting, see SECURITY.md


๐Ÿ“– Citation

If you use effGen in your research, please cite our paper:

@software{srivastava2026effgen,
      title={effGen: Enabling Small Language Models as Capable Autonomous Agents},
      author={Gaurav Srivastava and Aafiya Hussain and Chi Wang and Yingyan Celine Lin and Xuan Wang},
      year={2026},
      eprint={2602.00887},
      archivePrefix={arXiv},
      primaryClass={cs.CL},
      url={https://arxiv.org/abs/2602.00887},
}

๐Ÿ”— Links

Paper Website Docs PyPI Issues


๐Ÿ“„ License

Apache License 2.0 โ€” see LICENSE for details.


Get Started Examples Paper GitHub

Made with โค๏ธ for the AI community

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

effgen-0.2.8.tar.gz (896.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

effgen-0.2.8-py3-none-any.whl (1.1 MB view details)

Uploaded Python 3

File details

Details for the file effgen-0.2.8.tar.gz.

File metadata

  • Download URL: effgen-0.2.8.tar.gz
  • Upload date:
  • Size: 896.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.12

File hashes

Hashes for effgen-0.2.8.tar.gz
Algorithm Hash digest
SHA256 f181e0c04f60676b89c2220b8e814fd77805212b8765024484a99be49ee46c74
MD5 6f9dc76b954e08535cb9edf27a8886e0
BLAKE2b-256 2efb720bcbd3ce93ec59d1212b2e466c3ae2f18681fdb30c6263935e0b4428d0

See more details on using hashes here.

File details

Details for the file effgen-0.2.8-py3-none-any.whl.

File metadata

  • Download URL: effgen-0.2.8-py3-none-any.whl
  • Upload date:
  • Size: 1.1 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.12

File hashes

Hashes for effgen-0.2.8-py3-none-any.whl
Algorithm Hash digest
SHA256 de61f1baa1a2150f2f23e8b0e22c579cecd05330475b67a05077e5a774973359
MD5 e255e4ef8a3fea42e41ad74fee4bdc2b
BLAKE2b-256 69de742d03b12f941ddbeee79ba6d2151e1d0edf72c22ddf60cc67044f2113ee

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page