Skip to main content

Multi-agent framework that trains and orchestrates specialized Expert Agents on-demand via In-Context Reinforcement Learning.

Project description

FastICLE

FastICLE is a multi-agent AI framework implementing the ICLE (In-Context Learning Experts) paradigm: it dynamically trains and orchestrates specialized Expert Agents to solve complex, multi-step tasks. Experts are trained on-demand using In-Context Reinforcement Learning (ICRL) and persist across runs, accumulating refined strategies over time.

Framework Architecture


How It Works

FastICLE decomposes any task into a four-stage pipeline:

User Input
    │
    ▼
┌─────────────┐     ┌──────────────┐     ┌───────────────┐     ┌─────────────┐
│  Dispatcher │────▶│    Caster    │────▶│    Runtime    │────▶│  Assembler  │
│             │     │              │     │               │     │             │
│ Breaks task │     │ Assigns the  │     │ Executes all  │     │ Synthesizes │
│ into a DAG  │     │ right expert │     │ tasks in      │     │ outputs into│
│ of sub-tasks│     │ to each task │     │ parallel      │     │ final answer│
└─────────────┘     └──────────────┘     └───────────────┘     └─────────────┘

Pipeline Stages

Stage Agent Responsibility
Dispatch DispatcherAgent Decomposes the user's request into an ordered, dependency-aware task graph
Cast CasterAgent Assigns the best-fit Expert Agent(s) to each sub-task; trains new experts on-demand
Runtime Runtime Resolves the task DAG topologically; runs independent tasks in parallel via a thread pool; injects each task's declared dependency outputs as context into its prompt
Assemble Assembler Collects all sub-agent outputs and synthesizes a single coherent final response

The Campus — Expert Training & Storage

The Campus is where Expert Agents are born. When the Caster determines no suitable expert exists for a sub-task, it calls train_new_expert, which:

  1. Generates a training curriculum — a synthetic sequence of progressively harder tasks tailored to the required domain
  2. Runs ICRL training via FastICRL — the agent iterates through tasks using an explore/exploit loop guided by reward signals
  3. Distills a strategy — the agent's learned strategy is saved alongside its experience buffer as a .yaml file in the expert save directory

Saved experts are loaded automatically on future runs, so the pool of available specialists grows over time.

Expert Assignment Modes

The CasterAgent supports two modes:

  • Single-Expert Mode — assigns exactly one highly specialized expert per task
  • Multi-Expert Mode (MoE) — assigns a thematically relevant general expert as coordinator plus one or more specialists per sub-task, following a Mixture-of-Experts architecture

Installation

Requires Python ≥ 3.13 and uv.

git clone https://github.com/makoeta/FastICLE.git
cd FastICLE
make install        # runtime dependencies only
make install-dev    # + test dependencies (pytest, openai test client)

Copy the environment template and fill in your API key:

cp .env.example .env
# .env
OPENAI_API_KEY=sk-...

Quick Start

from agno.models.openai import OpenAIChat
from fasticle import FastICLE

model = OpenAIChat(id="gpt-4o")

pipeline = FastICLE(
    model=model,
    global_task="Write poems.",
    expert_save_dir="./experts",
    multi_expert_mode=True,
)

result = pipeline.run("Write three poems: one about black holes, one about the deep ocean, and one about autumn.")
print(result.content)

On the first run the Caster will train any missing experts before executing. On subsequent runs, saved experts are reused immediately.

Verbose Mode

Pass verbose=True to log every pipeline step — dispatched task graph, expert assignments, per-task runtime outputs, expert training, and the final synthesis — to the console and a log file:

pipeline = FastICLE(..., verbose=True)                       # logs to console + ./fasticle.log
pipeline = FastICLE(..., verbose=True, log_file="run.log")   # custom log file
pipeline = FastICLE(..., verbose=True, log_file=None)        # console only

Step summaries are logged at INFO; full step contents (system prompts — including each expert's learned strategy and experience buffer —, input prompts, task outputs, final answer) at DEBUG. Outside the pipeline you can enable the same logging directly:

from fasticle.log_setup import enable_verbose_logging

enable_verbose_logging("fasticle.log")

Project Structure

src/fasticle/
├── __init__.py           # Top-level FastICLE workflow (exports FastICLE)
├── dispatcher/           # Decomposes input into a task graph
├── caster/               # Expert assignment & on-demand training
├── campus/               # Expert training via ICRL
│   └── models/           # ExpertConfig, TrainingTaskList
├── runtime/              # Parallel task execution engine
├── assembler/            # Output synthesis
└── models/               # Shared task models (DAG nodes)
tests/
├── data/                 # Example saved expert YAML files
└── {component}/          # Per-component test suites

Dependencies

Package Role
agno Agent, Team, and Workflow orchestration
fasticrl In-Context Reinforcement Learning engine
openai LLM backend
pydantic Structured outputs and data models
python-dotenv Environment configuration

Running Tests

make test          # unit tests only (no API calls)
make test-api      # full suite including live API calls

Tests require make install-dev to be run first.

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

fasticle-1.0.2.tar.gz (22.8 kB view details)

Uploaded Source

Built Distribution

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

fasticle-1.0.2-py3-none-any.whl (28.8 kB view details)

Uploaded Python 3

File details

Details for the file fasticle-1.0.2.tar.gz.

File metadata

  • Download URL: fasticle-1.0.2.tar.gz
  • Upload date:
  • Size: 22.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for fasticle-1.0.2.tar.gz
Algorithm Hash digest
SHA256 246536f604a568bab4f42290a95cd02a05af881bc9fc370307e4078927e103a8
MD5 3bdaf82e9f38a03a78e3f84b9e6bdca8
BLAKE2b-256 12e82c52e9ef417b0eecda729766384f01afb13fae3b0dbaf0fd458417ec31d9

See more details on using hashes here.

Provenance

The following attestation bundles were made for fasticle-1.0.2.tar.gz:

Publisher: python-publish.yml on makoeta/FastICLE

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file fasticle-1.0.2-py3-none-any.whl.

File metadata

  • Download URL: fasticle-1.0.2-py3-none-any.whl
  • Upload date:
  • Size: 28.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for fasticle-1.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 5d1f5602231a866c94cce5175745fa5bfc32a3fd272678dbbd1ad3e368219ca8
MD5 ad34dedc5f58997d035dff6052f7976e
BLAKE2b-256 977b2cd3508278f9a1e2d23c51004f9d380ab1bed34008c7a491c0c49eb3c38d

See more details on using hashes here.

Provenance

The following attestation bundles were made for fasticle-1.0.2-py3-none-any.whl:

Publisher: python-publish.yml on makoeta/FastICLE

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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