Skip to content

Adaptive Optimization Framework for AI Agents using Reinforcement Learning. Automatically optimize agent behaviors, reduce costs by 30%, and improve performance through Q-learning and data-driven prompt engineering.

License

Notifications You must be signed in to change notification settings

adaptiq-ai/adaptiq

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

71 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

AdaptIQ โ€” Adaptive Optimization Framework for AI Agents

Made with Python PyPI Cost Saving COโ‚‚ Aware License AdaptiQ Score

AdaptIQ โ€” Adaptive Optimization Framework for AI Agents โ€“ Optimize behaviors, reduce resource usage, and accelerate learning with low-cognitive reinforcement tuning.


๐Ÿš€ Quick Overview

AdaptIQ uses reinforcement learning to automatically optimize your AI agents. Point it at your agent's logs, and it learns which actions work best in different situations, reducing costs by 30% while improving performance.

Key Benefits: Lower costs, better performance, data-driven optimization
Current Support: CrewAI (only supported framework) + OpenAI (more coming soon)


๐Ÿ“‹ Table of Contents

  1. ๐Ÿค” Why AdaptiQ?
  2. โšก Quick Start
  3. โœจ Features
  4. ๐Ÿง  How It Works (RL + Q-table)
  5. ๐Ÿ—๏ธ Architecture
  6. ๐Ÿ“Š Reporting Mode
  7. ๐Ÿ† Leaderboard (agents)
  8. ๐ŸŽฏ Bench my agent
  9. ๐Ÿ–ผ๏ธ AdaptIQ Image Generation Benchmark
  10. ๐Ÿ”ฎ What's Next
  11. โ˜๏ธ Upgrade Path โ†’ AdaptiQ FinOps Cloud
  12. ๐Ÿ—บ๏ธ Roadmap
  13. ๐Ÿค Community & Contributing
  14. ๐Ÿ“„ License

๐Ÿค” Why AdaptiQ?

AdaptIQ addresses the critical challenge of optimizing AI agent performance through intelligent, data-driven approaches. Our framework transforms the traditionally manual and error-prone process of agent tuning into a systematic, reinforcement learning-powered optimization workflow that learns from execution patterns and continuously improves agent behavior while reducing costs and resource consumption.

Pain point Traditional workaround AdaptiQ advantage
Prompt/agent errors discovered after expensive runs Manual review, trialโ€‘andโ€‘error Detects & fixes issues before execution
GPU/LLM cost spikes Spreadsheet audits Predicts โ‚ฌ & COโ‚‚ inline
No common prompt style Word/PDF guidelines Enforced by lint rules, autofixable
Dev โ†” FinOps gap Slack + eโ€‘mails Same CLI / dashboard for both teams

โšก Quick Start

๐Ÿ“‹ Prerequisites

Before installing AdaptIQ, ensure you have:

  • Python 3.12+ - Required for AdaptIQ framework
  • CrewAI framework - Set up and configured for your agents (only supported framework)
  • OpenAI API key - For LLM provider access
  • Windows OS - Linux and Mac support not tested yet

๐Ÿ“ฆ Installation

First, install UV package manager:

# Windows (PowerShell)
powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"

โš ๏ธ Note: Linux and Mac support is not tested yet. We recommend using Windows for now.

Then activate your virtual environment and install AdaptIQ:

uv pip install adaptiq

For development mode:

uv pip install -e .

๐Ÿช„ Quick Setup

Initialize a new project:

adaptiq init --name name_project --template framework_template --path ./my_project

๐Ÿ“ Note: Only CrewAI is supported as the framework template currently.

This will initialize a project with adaptiq_config.yml that you should configure.

๐Ÿ”ง Configuration Validation

Validate your configuration:

adaptiq validate --config_path adaptiq_yml_path --template framework_template

๐ŸŽฎ Running AdaptIQ

AdaptIQ will run the optimization process automatically once the agent is in execution.

๐Ÿ“ Important: AdaptIQ currently supports only CrewAI as the agentic framework, OpenAI as the provider, and GPT-4.1 and GPT-4.1-mini as the LLMs for the workflow. Other models and frameworks have not been tested yet.


โœจ Features

Category Free Cloud (SaaS)
๐Ÿง™ YAML validation โœ… โœ…
๐Ÿ” Prompt & agent lint rules โœ… โœ…
๐Ÿ’ฐ Preโ€‘run cost โœ… โœ…
๐Ÿค– RLโ€‘powered optimisation suggestions โœ… โœ…
๐Ÿญ Automatic optimisation at scale โ€” โœ…
๐Ÿ’š GPUโ€‘spot arbitrage, ESG ledger โ€” โœ…
๐Ÿ“Š Multiโ€‘tenant FinOps dashboard โ€” โœ…

๐Ÿง  How It Works (RL + Q-table)

๐ŸŽฏ ADAPTIQ - Agent Development & Prompt Tuning Iteratively with Q-Learning

ADAPTIQ is a framework designed for the iterative improvement of AI agent performance through offline Reinforcement Learning (RL). Its primary goal is to systematically enhance an agent's guiding Configuration, focusing mainly on its Task Description (Prompt), by learning from the agent's past execution behaviors and incorporating user validation. It provides a structured, data-driven alternative to purely manual prompt engineering.

๐Ÿš€ Vision and Goal

Adaptiq's mission is to optimize agent behavior by refining its core instructions (prompts/task descriptions). It achieves this by analyzing what an agent intended to do (from its prompt), what it actually did (from execution logs), and how effective those actions were (via a multi-faceted reward system). It is especially suited for agents using frameworks like CrewAI, LangChain, etc., where direct, real-time RL control is often impractical.

๐Ÿ”ง Key Concepts in Adaptiq

๐Ÿงฉ State (s)

Represents the agent's situation at a specific step, defined by features like:

  • Current_SubTask: The immediate objective
  • Last_Action_Taken: The previous validated ARIC strategic action
  • Last_Outcome: The validated result of the previous action
  • Key_Context: Accumulated relevant information (validated flags/data)

States are transformed into consistent, hashable representations for Q-table storage, potentially using generalization techniques.

๐ŸŽฏ Action (a)

A selection from a predefined menu of discrete, strategic actions (e.g., Use_Tool_X, Action_Write_Content). Adaptiq maps observed log events to these predefined actions.

๐Ÿ“Š Q-Table

The core knowledge base: Q(state_representation, action) โ†’ value. It stores the learned long-term value of taking an action in a specific state, refined through the Adaptiq loop.

๐Ÿ† Reward (R)

Calculated offline during/after trace reconciliation. It incorporates:

  • Plan Adherence: How well the actual execution matched the intended plan from prompt parsing
  • Execution Success (R_execution/internal): Based on tool outcomes, task progress, constraint adherence, and output quality from the logs
  • External Feedback (R_external - Optional): Real-world impact metrics (e.g., email open rates, conversions). To be implemented soon (now as external feedback only human feedback of user's evaluation of the agent after adaptiq optimization)

๐Ÿ› ๏ธ Trace Analysis & Reconciliation Strategy

Adaptiq employs a multi-stage approach:

  1. Prompt Parsing: An LLM-powered module analyzes the agent's task description to extract the intended sequence of sub-tasks and actions

  2. Hypothetical State Generation: Uses the prompt parser's output to define idealized states and actions for heuristic Q-table initialization

  3. Log Parsing: Module parses raw execution logs to identify actual agent thoughts, tool calls, and outcomes

  4. Reconciliation: A central facilitates the alignment of the intended plan with actual execution. It allows the user to:

    • Validate/correct inferred states and actions
    • Confirm/override calculated rewards
    • Refine the understanding of the agent's behavior

    This produces the mapping data.

Lightweight Qโ€‘table examples:

State Action Qโ€‘value
('InformationRetrieval_Company', 'None', 'None', 'company info') FileReadTool 0.6
('InformationRetrieval_Lead', 'FileReadTool', 'Success_DataFound', 'company info lead name') LeadNameTool 0.7
('ActionExecution_SendEmail', 'Write_Email_Body', 'Success_ActionCompleted', 'email sent lead') SendEmailTool 0.7
('ResultFinalization', 'SendEmailTool', 'Success_ActionCompleted', 'email content final answer') Formulate_Final_Answer 0.8

๐Ÿ—๏ธ Architecture

AdaptIQ Architecture


๐Ÿ“Š Reporting Mode

AdaptIQ offers flexible reporting options:

๐Ÿ’พ Local Reporting

  • Save optimization reports locally as Markdown
  • Detailed performance metrics and recommendations
  • Offline analysis capabilities

๐Ÿ“ง Email Reports

  • Send comprehensive reports to your email
  • URL-based report sharing
  • Real-time optimization insights (multiple)

๐Ÿ“ Privacy Note: When you provide your email in the YAML config, you acknowledge that we can process your data according to our privacy policy.

UI Screenshot


๐Ÿ† Leaderboard (agents) - Coming Soon

A comprehensive evaluation system to benchmark your agents based on specific KPIs (Health Learning Index HLI). Agents working on the same tasks can anonymously compare their performance, fostering continuous improvement and healthy competition in the AI agent community. This system helps maintain agent quality in production environments through continuous monitoring and benchmarking.


๐ŸŽฏ Bench my agent

๐Ÿš€ Build better AI agents. Use AdaptiQ and see your Agent Learning Health Index

โš™๏ธ Benefit Description
๐Ÿ… Social proof Public badge increases repo trust
๐Ÿ’ฐ FinOps insight Cost โ‚ฌ/k-token & COโ‚‚/tkn surfaced instantly
๐Ÿ”’ Security gate Evaluator flags jailbreaks & PII leaks before prod
โ™ป๏ธ Continuous learning LHI tracks the agent's health across versions

๐ŸŽฌ See the leaderboard in action

Live demo: carrousel, live-feed et tri du leaderboard


๐Ÿ–ผ๏ธ AdaptIQ Image Generation Benchmark

The AdaptIQ Image Generation Benchmark is a comprehensive evaluation suite designed to measure and optimize image generation agents using reinforcement learning. This benchmark demonstrates AdaptIQ's effectiveness in reducing costs while maintaining quality across creative AI tasks.

๐ŸŽฏ Benchmark Overview

Given target synthetic images, agents must reproduce them with maximum fidelity at minimum cost. Our benchmark uses a paired design comparing baseline CrewAI + GPT-4.1 agents against AdaptIQ-optimized versions using the same technology stack enhanced with runtime RL optimization.

๐Ÿ“Š Current Results

Metric Baseline AdaptIQ Improvement p-value
Latency (s) 13.94 11.85 -15.0% < 0.001
Cost (USD/img) 0.0099 0.0086 -13.6% < 0.001
Tokens (count) 8347 7459 -10.6% 0.366 (ns)
Quality (CLIP) 91.18 91.01 -0.17 target โ‰ฅ 0
Efficiency Score 658.87 895.44 +35.9% -

๐Ÿ”ง Technical Implementation

  • Models: OpenAI GPT-4.1 + FLUX-1.1-pro (image generation)
  • Quality Metric: CLIP ViT-B/32 similarity scoring
  • Test Images: Curated dataset from Pinterest (research use)
  • RL Architecture: Q-learning with state-action optimization

๐Ÿ“ˆ Key Achievements

  • Cost Reduction: 13.6% savings per image generation
  • Speed Improvement: 15% faster execution with 2.09s average reduction
  • Stability: 2.8ร— lower token usage variance for predictable performance
  • Quality Preservation: Near-parity quality with minimal CLIP score difference

Check out our benchmark repository: https://github.com/adaptiq-ai/adaptiq-benchmark

๐Ÿ“ Note: Additional benchmarks for RAG systems, coding agents, knowledge graphs, and other optimization capabilities will be added as new features are implemented.


๐Ÿ”ฎ What's Next

๐ŸŽฏ Upcoming Features

  • ๐Ÿ”„ Support for More Models and Providers: Expanding compatibility beyond OpenAI to include other LLM providers and models
  • ๐Ÿ”„ Context Engineering Optimization: Advanced prompt and context management through Q-learning
    • ๐Ÿ“ Prompt Optimization Workflow: Implementing external rewards data type and tool tracking and evaluation
    • ๐Ÿ“š Q-Table Strategy for RAG Systems: Learn which effective chunks reduce cost and increase speed
    • ๐Ÿ’ป Coding Agent Enhancement: Enhancing coding capabilities by using Q-learning for code generation patterns, debugging workflows, and repository context management
    • ๐Ÿง  Memory Layer Integration: Q-table learns optimal context retention patterns - storing frequently accessed information states and reducing redundant retrievals through intelligent caching strategies
    • ๐Ÿ“Š Knowledge Graph Integration: Dynamic relationship mapping between entities and concepts for contextually-aware agent decisions
    • ๐Ÿ”Œ External Context Integration APIs: Seamless integration with CRM, databases, and third-party tools for enriched contextual understanding
    • ๐Ÿ›ก๏ธ Governance & Constraints:
      • ๐Ÿšง Guardrails: Q-learning enforced safety boundaries and compliance rules
      • ๐Ÿ” Access Control: Context-aware permission management
      • ๐Ÿ“‹ Policy Enforcement: Automated adherence to organizational guidelines and industry standards
  • ๐Ÿ“ฑ Q-Table for Edge Devices: Optimizing AI models performance to work better on resource-constrained devices
  • ๐Ÿ“Š Additional Benchmarks: Expanding evaluation coverage with new benchmark suites for text generation, code generation, data analysis, and multi-modal tasks

โ˜๏ธ Upgrade Path โ†’ AdaptiQ FinOps Cloud

Need handsโ€‘free optimisation across hundreds of projects? ๐Ÿข
AdaptiQ FinOps Cloud adds:

  • ๐Ÿค– Autoโ€‘tuning RL in production
  • ๐Ÿ’Ž GPUโ€‘spot arbitrage
  • ๐ŸŒฑ ESG & carbon ledger
  • ๐Ÿ‘ฅ Roleโ€‘based dashboards (Dev / FinOps / Cโ€‘suite)

๐Ÿ†“ 30โ€‘day free trial โ€” migrate in one CLI command.

Contact us for more information via email


๐Ÿ—บ๏ธ Roadmap

Quarter Milestone
Q3 2025 ๐Ÿ”„ Support for More Models and Providers & Cost optimization via LLM routing
Q4 2025 ๐Ÿ”„ Context Engineering Optimization: Memory Layer, Knowledge Graphs, External API Integration
2026 ๐Ÿ“ฑ Edge SDK (quantised Qโ€‘table <16 MB), ๐Ÿ›ก๏ธ Governance & Constraints framework, GPUโ€‘Spot optimiser

Vote or propose features in discussions/. ๐Ÿ—ณ๏ธ


๐Ÿค Community & Contributing

We โค๏ธ PRs: bug fixes, lint rules, language support.
See CONTRIBUTING.md.


๐Ÿงช Beta Version Notice

AdaptIQ is currently in beta version. We welcome any issues, bug reports, or contributions to improve the framework! Your feedback helps us build a better tool for the AI agent community. ๐Ÿ™

Please feel free to:

  • ๐Ÿ› Report bugs via GitHub Issues
  • ๐Ÿ’ก Suggest new features
  • ๐Ÿค Contribute code improvements
  • ๐Ÿ“ Improve documentation

Together, we can make AdaptIQ the best optimization framework for AI agents! ๐Ÿš€

๐Ÿ“š Citation

If you use AdaptIQ in your research, project, or commercial application, please cite us:

๐Ÿ“– BibTeX

@software{adaptiq2025,
  title={AdaptIQ: Adaptive Optimization Framework for AI Agents},
  author={AdaptIQ AI Team},
  year={2025},
  url={https://github.com/adaptiq-ai/adaptiq},
  note={Adaptive Optimization Framework for AI Agents with Reinforcement Learning}
}

๐Ÿ”— MLA Format

AdaptIQ AI Team. "AdaptIQ: Adaptive Optimization Framework for AI Agents." GitHub, 2025, https://github.com/adaptiq-ai/adaptiq.

๐Ÿ“Š Research Papers

If you publish research using AdaptIQ, we'd love to hear about it! Please:


๐Ÿ“„ License

  • Code: Apache 2.0 License ๐Ÿ†“
  • RL weights & FinOps Cloud components: proprietary

ยฉ 2025 AdaptiQ AI. All trademarks belong to their respective owners.