Skip to content

fireflyframework/fireflyframework-genai

fireflyframework-genai

The production-grade GenAI metaframework built on Pydantic AI.

CI Python 3.13+ License: Apache 2.0 Tests Ruff

Copyright 2026 Firefly Software Solutions Inc. Licensed under the Apache License 2.0.


Table of Contents


Why fireflyframework-genai?

Pydantic AI provides an excellent foundation: type-safe, model-agnostic agents with structured output. But a production GenAI system demands far more than a single agent call. You need to orchestrate multi-step reasoning, validate and retry LLM outputs against schemas, manage conversation memory across turns, observe every call with traces and metrics, run A/B experiments to compare models, and expose the whole thing over REST or message queues β€” all without coupling your domain logic to infrastructure concerns.

fireflyframework-genai is the production framework built on top of Pydantic AI. It extends the engine with six composable layers β€” from core configuration through agent management, intelligent reasoning, experimentation, pipeline orchestration, and service exposure β€” so that every concern has a dedicated, protocol-driven module. You write your business logic; the framework provides the architecture.

What "metaframework" means in practice:

  • You keep Pydantic AI's familiar Agent, Tool, and RunContext APIs unchanged.
  • The framework wraps them with lifecycle hooks, registries, delegation routers, memory managers, reasoning patterns, validation loops, DAG pipelines, and exposure endpoints β€” all optional, all composable, all swappable through Python protocols.
  • No vendor lock-in: switch models, swap memory backends, or replace the REST layer without touching your agent code.

Key Principles

  1. Protocol-driven contracts β€” Every extension point is defined as a @runtime_checkable Protocol or abstract base class. The framework ships eleven protocols (AgentLike, ToolProtocol, GuardProtocol, ReasoningPattern, DelegationStrategy, StepExecutor, CompressionStrategy, MemoryStore, ValidationRule, Chunker, QueueConsumer / QueueProducer) so you can swap or extend any component without modifying framework internals.

  2. Convention over configuration β€” Sensible defaults everywhere. FireflyGenAIConfig is a Pydantic Settings singleton that reads from environment variables prefixed with FIREFLY_GENAI_ and .env files. One config object governs model defaults, retry counts, token limits, observability endpoints, memory backends, and validation thresholds β€” override only what you need.

  3. Layered composition β€” Six layers with strict top-down dependency flow: Core β†’ Agent β†’ Intelligence β†’ Experimentation β†’ Orchestration β†’ Exposure. Higher layers depend on lower layers but never the reverse, keeping the dependency graph acyclic and each module independently testable.

  4. Optional dependencies β€” Heavy libraries (fastapi, aiokafka, aio-pika, redis) are declared as pip extras ([rest], [studio], [kafka], [rabbitmq], [redis], [all]). The core framework imports them lazily inside factory functions so that you install only what your deployment requires.


Architecture at a Glance

graph TD
    subgraph Exposure Layer
        REST["REST API<br/><small>create_genai_app Β· SSE streaming<br/>health Β· middleware Β· router</small>"]
        QUEUES["Message Queues<br/><small>Kafka Β· RabbitMQ Β· Redis<br/>consumers Β· producers Β· QueueRouter</small>"]
    end

    subgraph Orchestration Layer
        PIPE["Pipeline / DAG Engine<br/><small>DAG Β· DAGNode Β· DAGEdge<br/>PipelineEngine Β· PipelineBuilder<br/>AgentStep Β· ReasoningStep Β· CallableStep<br/>FanOutStep Β· FanInStep</small>"]
    end

    subgraph Experimentation Layer
        EXP["Experiments<br/><small>Experiment Β· Variant<br/>ExperimentRunner Β· VariantComparator<br/>ExperimentTracker</small>"]
        LAB["Lab<br/><small>LabSession Β· Benchmark<br/>EvalOrchestrator Β· EvalDataset<br/>ModelComparison</small>"]
    end

    subgraph Intelligence Layer
        REASON["Reasoning Patterns<br/><small>ReAct Β· CoT Β· PlanAndExecute<br/>Reflexion Β· ToT Β· GoalDecomposition<br/>ReasoningPipeline</small>"]
        VAL["Validation & QoS<br/><small>OutputReviewer Β· OutputValidator<br/>ConfidenceScorer Β· ConsistencyChecker<br/>GroundingChecker Β· 5 rule types</small>"]
        OBS["Observability<br/><small>FireflyTracer Β· FireflyMetrics<br/>FireflyEvents Β· UsageTracker<br/>CostCalculator Β· @traced Β· @metered<br/>configure_exporters</small>"]
        EXPL["Explainability<br/><small>TraceRecorder Β· ExplanationGenerator<br/>AuditTrail Β· ReportBuilder</small>"]
    end

    subgraph Agent Layer
        AGT["Agents<br/><small>FireflyAgent Β· AgentRegistry<br/>DelegationRouter Β· AgentLifecycle<br/>@firefly_agent Β· 5 templates</small>"]
        TOOLS["Tools<br/><small>BaseTool Β· ToolBuilder Β· ToolKit<br/>5 guards Β· 3 composers<br/>ToolRegistry Β· 9 built-ins</small>"]
        PROMPTS["Prompts<br/><small>PromptTemplate Β· PromptRegistry<br/>3 composers Β· PromptValidator<br/>PromptLoader</small>"]
        CONTENT["Content<br/><small>TextChunker Β· DocumentSplitter<br/>ImageTiler Β· BatchProcessor<br/>ContextCompressor Β· SlidingWindowManager</small>"]
        MEM["Memory<br/><small>MemoryManager Β· ConversationMemory<br/>WorkingMemory Β· TokenEstimator<br/>InMemoryStore Β· FileStore</small>"]
    end

    subgraph Core Layer
        CFG["Config<br/><small>FireflyGenAIConfig<br/>get_config Β· reset_config</small>"]
        TYPES["Types & Protocols<br/><small>AgentLike Β· 10 protocols<br/>TypeVars Β· type aliases</small>"]
        EXC["Exceptions<br/><small>FireflyGenAIError hierarchy<br/>18 exception classes</small>"]
        PLUG["Plugin System<br/><small>PluginDiscovery<br/>3 entry-point groups</small>"]
    end

    REST --> PIPE
    QUEUES --> PIPE
    PIPE --> AGT
    PIPE --> REASON
    PIPE --> VAL
    EXP --> AGT
    LAB --> EXP
    REASON --> AGT
    OBS --> AGT
    EXPL --> OBS
    VAL --> AGT
    AGT --> TOOLS
    AGT --> PROMPTS
    AGT --> CONTENT
    AGT --> MEM
    AGT --> CFG
    TOOLS --> CFG
    PROMPTS --> CFG
    CONTENT --> CFG
    MEM --> CFG
    REASON --> CFG
    VAL --> CFG
Loading

Protocol Hierarchy

Every extension point is a @runtime_checkable protocol. Implement the protocol to create your own components; the framework discovers them via duck typing.

classDiagram
    class AgentLike {
        <<Protocol>>
        +run(prompt, **kwargs) Any
    }
    class ToolProtocol {
        <<Protocol>>
        +name: str
        +description: str
        +execute(**kwargs) Any
    }
    class GuardProtocol {
        <<Protocol>>
        +check(tool_name, kwargs) GuardResult
    }
    class ReasoningPattern {
        <<Protocol>>
        +execute(agent, input, **kwargs) ReasoningResult
    }
    class StepExecutor {
        <<Protocol>>
        +execute(context, inputs) Any
    }
    class DelegationStrategy {
        <<Protocol>>
        +select(agents, prompt, **kwargs) Any
    }
    class CompressionStrategy {
        <<Protocol>>
        +compress(text, max_tokens) str
    }
    class MemoryStore {
        <<Protocol>>
        +save(namespace, entry)
        +load(namespace) list
        +delete(namespace, entry_id)
        +clear(namespace)
    }
    class ValidationRule {
        <<Protocol>>
        +name: str
        +validate(value) ValidationRuleResult
    }
    class QueueConsumer {
        <<Protocol>>
        +start()
        +stop()
    }
    class QueueProducer {
        <<Protocol>>
        +publish(message)
    }

    AgentLike <|.. FireflyAgent
    AgentLike <|.. pydantic_ai.Agent
    ToolProtocol <|.. BaseTool
    ToolProtocol <|.. SequentialComposer
    ToolProtocol <|.. FallbackComposer
    ToolProtocol <|.. ConditionalComposer
    GuardProtocol <|.. ValidationGuard
    GuardProtocol <|.. RateLimitGuard
    GuardProtocol <|.. ApprovalGuard
    GuardProtocol <|.. SandboxGuard
    GuardProtocol <|.. CompositeGuard
    ReasoningPattern <|.. AbstractReasoningPattern
    ReasoningPattern <|.. ReasoningPipeline
    StepExecutor <|.. AgentStep
    StepExecutor <|.. ReasoningStep
    StepExecutor <|.. CallableStep
    StepExecutor <|.. FanOutStep
    StepExecutor <|.. FanInStep
    DelegationStrategy <|.. RoundRobinStrategy
    DelegationStrategy <|.. CapabilityStrategy
    CompressionStrategy <|.. TruncationStrategy
    CompressionStrategy <|.. SummarizationStrategy
    CompressionStrategy <|.. MapReduceStrategy
    MemoryStore <|.. InMemoryStore
    MemoryStore <|.. FileStore
    ValidationRule <|.. RegexRule
    ValidationRule <|.. FormatRule
    ValidationRule <|.. RangeRule
    ValidationRule <|.. EnumRule
    ValidationRule <|.. CustomRule
    QueueConsumer <|.. KafkaAgentConsumer
    QueueConsumer <|.. RabbitMQAgentConsumer
    QueueConsumer <|.. RedisAgentConsumer
    QueueProducer <|.. KafkaAgentProducer
    QueueProducer <|.. RabbitMQAgentProducer
    QueueProducer <|.. RedisAgentProducer
Loading

Feature Highlights

  • Agents β€” FireflyAgent wraps pydantic_ai.Agent with metadata, lifecycle hooks, and automatic registration. AgentRegistry provides singleton name-based discovery. DelegationRouter routes prompts across agent pools via RoundRobinStrategy or CapabilityStrategy. The @firefly_agent decorator defines an agent in one statement. Five template factories (create_summarizer_agent, create_classifier_agent, create_extractor_agent, create_conversational_agent, create_router_agent) cover common use cases out of the box.

  • Tools β€” ToolProtocol (duck-typed) and BaseTool (inheritance) let you choose your extensibility style. ToolBuilder provides a fluent API for building tools without subclassing. Five guard types (ValidationGuard, RateLimitGuard, ApprovalGuard, SandboxGuard, CompositeGuard) intercept calls before execution. Three composition patterns (SequentialComposer, FallbackComposer, ConditionalComposer) build higher-order tools. ToolKit groups tools for bulk registration. Nine built-in tools (calculator, datetime, filesystem, HTTP, JSON, search, shell, text, database) are ready to attach to any agent.

  • Prompts β€” PromptTemplate renders Jinja2 templates with variable validation and token estimation. PromptRegistry maps names to versioned templates. Three composers (SequentialComposer, ConditionalComposer, MergeComposer) combine templates at render time. PromptValidator enforces token limits and required sections. PromptLoader loads templates from strings, files, or entire directories.

  • Reasoning β€” Six pluggable patterns implement AbstractReasoningPattern's template-method loop (_reason β†’ _act β†’ _observe β†’ _should_continue): ReAct (observe-think-act), Chain of Thought (step-by-step), Plan-and-Execute (goal β†’ plan β†’ steps with optional replanning), Reflexion (execute β†’ critique β†’ retry), Tree of Thoughts (branch β†’ evaluate β†’ select), and Goal Decomposition (goal β†’ phases β†’ tasks). All produce structured ReasoningResult with ReasoningTrace. Prompts are slot-overridable. OutputReviewer can validate final outputs. ReasoningPipeline chains patterns sequentially.

  • Content β€” TextChunker splits by tokens, sentences, or paragraphs with configurable overlap. DocumentSplitter detects page breaks and section separators. ImageTiler computes tile coordinates for VLM processing. BatchProcessor runs chunks through an agent concurrently with a semaphore. ContextCompressor delegates to pluggable strategies (TruncationStrategy, SummarizationStrategy, MapReduceStrategy). SlidingWindowManager maintains a rolling token-budgeted context window.

  • Memory β€” ConversationMemory stores per-conversation turn history with token-budget enforcement (newest-first FIFO eviction). WorkingMemory provides a scoped key-value scratchpad backed by MemoryStore (InMemoryStore or FileStore). MemoryManager composes both behind a unified API and supports fork() for isolating working memory in delegated agents or pipeline branches while sharing conversation context.

  • Validation β€” Five composable rules (RegexRule, FormatRule, RangeRule, EnumRule, CustomRule) feed into FieldValidator and OutputValidator. OutputReviewer wraps agent calls with parse-then-validate retry logic: on failure it builds a feedback prompt and retries up to N times. QoS guards (ConfidenceScorer, ConsistencyChecker, GroundingChecker) detect hallucinations and low-quality extractions before they propagate downstream.

  • Pipeline β€” DAG holds DAGNode and DAGEdge objects with cycle detection and topological sort. PipelineEngine executes nodes level-by-level via asyncio.gather for maximum concurrency, with per-node condition gates, retries, and timeouts. PipelineBuilder offers a fluent API (add_node / add_edge / chain). Five step types (AgentStep, ReasoningStep, CallableStep, FanOutStep, FanInStep) adapt agents, patterns, and functions to DAG nodes.

  • Observability β€” FireflyTracer creates OpenTelemetry spans scoped to agents, tools, and reasoning steps. FireflyMetrics records tokens (total, prompt, completion), latency, cost, errors, and reasoning depth via the OTel metrics API. FireflyEvents emits structured log records. @traced and @metered decorators instrument any function with one line. configure_exporters sets up OTLP or console exporters. UsageTracker automatically records token usage, cost estimates, and latency for every agent run, reasoning step, and pipeline execution. CostCalculator supports a built-in static price table and optional genai-prices integration. Budget enforcement logs warnings when configurable thresholds are exceeded.

  • Explainability β€” TraceRecorder captures every LLM call, tool invocation, and reasoning step as DecisionRecord objects. ExplanationGenerator turns records into human-readable narratives. AuditTrail provides an append-only, immutable log with JSON export for compliance. ReportBuilder produces Markdown and JSON reports with statistics.

  • Experiments β€” Experiment defines variants with model, temperature, and prompt overrides. ExperimentRunner executes all variants against a dataset. ExperimentTracker persists results with optional JSON export. VariantComparator computes latency, output length, and comparison summaries.

  • Lab β€” LabSession manages interactive agent sessions with history. Benchmark runs agents against standardised inputs and reports p95 latency. EvalOrchestrator scores agent outputs with pluggable Scorer functions. EvalDataset loads/saves test cases from JSON. ModelComparison runs the same prompts across multiple agents for side-by-side analysis.

  • Exposure β€” create_genai_app() produces a FastAPI application with auto-generated POST /agents/{name}/run endpoints, SSE streaming via sse_stream, health/readiness/liveness checks, CORS and request-ID middleware, and multimodal input support. Queue consumers (KafkaAgentConsumer, RabbitMQAgentConsumer, RedisAgentConsumer) route messages to agents. Queue producers (KafkaAgentProducer, RabbitMQAgentProducer, RedisAgentProducer) publish results back. QueueRouter provides pattern-based message routing across agents.

  • Studio β€” firefly studio launches a browser-based visual IDE for building agent pipelines. Drag and connect Agent, Tool, Reasoning, and Condition nodes on an interactive canvas. The Code tab generates Python code from your graph in real time. An AI assistant (via WebSocket) helps you build pipelines through natural language. Project management persists graphs to disk. Checkpoints enable time-travel debugging. The frontend is a SvelteKit 5 SPA bundled inside the Python package β€” no Node.js needed. Install with pip install "fireflyframework-genai[studio]".


Requirements

Runtime:

  • Python 3.13 or later
  • Git for cloning the repository
  • UV package manager (recommended) or pip

Core dependencies (installed automatically):

Optional dependencies (installed via extras):

  • [rest] β€” FastAPI >=0.115.0, Uvicorn >=0.34.0, sse-starlette >=2.0.0
  • [kafka] β€” aiokafka >=0.12.0
  • [rabbitmq] β€” aio-pika >=9.5.0
  • [redis] β€” redis-py >=5.2.0
  • [costs] β€” genai-prices for up-to-date LLM pricing data
  • [queues] β€” All queue backends (Kafka + RabbitMQ + Redis)
  • [all] β€” Everything (REST + all queues + costs + security + HTTP)

LLM provider keys (at least one):

  • OPENAI_API_KEY for OpenAI models
  • ANTHROPIC_API_KEY for Anthropic models
  • GEMINI_API_KEY for Google Gemini models
  • GROQ_API_KEY for Groq models
  • Or any Pydantic AI-supported provider

Installation

One-Line Installer (Recommended)

The interactive installer detects your platform, checks Python and UV, lets you choose extras, and installs everything with progress indicators and verification.

macOS / Linux:

curl -fsSL https://raw.githubusercontent.com/fireflyframework/fireflyframework-genai/main/install.sh | bash

Windows (PowerShell):

irm https://raw.githubusercontent.com/fireflyframework/fireflyframework-genai/main/install.ps1 | iex

Both installers support non-interactive mode for CI/CD:

# macOS / Linux β€” install with all extras, no prompts
curl -fsSL https://raw.githubusercontent.com/fireflyframework/fireflyframework-genai/main/install.sh | bash
# Windows β€” install with all extras, no prompts
.\install.ps1 -NonInteractive -Extras all

Install from Source

git clone https://github.com/fireflyframework/fireflyframework-genai.git
cd fireflyframework-genai
uv sync --all-extras # or: pip install -e ".[all]"

Optional Extras

Extra What it adds When you need it
rest FastAPI, Uvicorn, SSE Exposing agents as REST endpoints
studio FastAPI, Uvicorn, httpx Visual Studio IDE (firefly studio)
kafka aiokafka Consuming/producing via Apache Kafka
rabbitmq aio-pika Consuming/producing via RabbitMQ
redis redis-py Consuming/producing via Redis Pub/Sub
queues All of the above Any message queue integration
postgres asyncpg, SQLAlchemy PostgreSQL memory persistence
mongodb motor, pymongo MongoDB memory persistence
security PyJWT, cryptography RBAC, encryption, JWT auth
http httpx HTTP connection pooling for tools
costs genai-prices Up-to-date LLM pricing data
all Everything above Full deployment with all integrations

Verify Installation

python -c "import fireflyframework_genai; print(fireflyframework_genai.__version__)"
# 26.02.07

If you installed with [studio], verify the CLI:

firefly --help

Uninstall

macOS / Linux:

curl -fsSL https://raw.githubusercontent.com/fireflyframework/fireflyframework-genai/main/uninstall.sh | bash

Windows (PowerShell):

irm https://raw.githubusercontent.com/fireflyframework/fireflyframework-genai/main/uninstall.ps1 | iex

Or manually remove the cloned directory and its virtual environment.


5-Minute Quick Start

1. Configure

Create a .env file (or set environment variables):

# Provider API key (Pydantic AI reads these automatically)
OPENAI_API_KEY=sk-...
# ANTHROPIC_API_KEY=sk-ant-...
# GEMINI_API_KEY=...
# GROQ_API_KEY=gsk_...

# Framework settings
FIREFLY_GENAI_DEFAULT_MODEL=openai:gpt-4o
FIREFLY_GENAI_DEFAULT_TEMPERATURE=0.3

The model string format is "provider:model_name" β€” e.g. "openai:gpt-4o", "anthropic:claude-sonnet-4-20250514", "google:gemini-2.0-flash". Pydantic AI resolves the matching API key from environment variables automatically. For programmatic credential management (Azure, Bedrock, custom endpoints), pass a Pydantic AI Model object directly to FireflyAgent(model=...) β€” see the tutorial.

2. Define an Agent

from fireflyframework_genai.agents import firefly_agent

@firefly_agent(name="assistant", model="openai:gpt-4o")
def assistant_instructions(ctx):
    return "You are a helpful conversational assistant."

3. Register a Tool

from fireflyframework_genai.tools import firefly_tool

@firefly_tool(name="lookup", description="Look up a term")
async def lookup(query: str) -> str:
    return f"Result for {query}"

4. Add Memory for Multi-Turn Conversations

from fireflyframework_genai.agents import FireflyAgent
from fireflyframework_genai.memory import MemoryManager

memory = MemoryManager(max_conversation_tokens=32_000)
agent = FireflyAgent(name="bot", model="openai:gpt-4o", memory=memory)

cid = memory.new_conversation()
result = await agent.run("Hello!", conversation_id=cid)
result = await agent.run("What did I just say?", conversation_id=cid)

5. Apply a Reasoning Pattern

from fireflyframework_genai.reasoning import ReActPattern

react = ReActPattern(max_steps=5)
result = await react.execute(agent, "What is the weather in London?")
print(result.output)

6. Validate Output

from pydantic import BaseModel
from fireflyframework_genai.validation import OutputReviewer

class Answer(BaseModel):
    answer: str
    confidence: float

reviewer = OutputReviewer(output_type=Answer, max_retries=2)
result = await reviewer.review(agent, "What is 2+2?")
print(result.output) # Answer(answer="4", confidence=0.99)

7. Wire a Pipeline

from fireflyframework_genai.pipeline.builder import PipelineBuilder
from fireflyframework_genai.pipeline.steps import AgentStep, CallableStep

pipeline = (
    PipelineBuilder("my-pipeline")
    .add_node("classify", AgentStep(classifier_agent))
    .add_node("extract", AgentStep(extractor_agent))
    .add_node("validate", CallableStep(validate_fn))
    .chain("classify", "extract", "validate")
    .build()
)
result = await pipeline.run(inputs="Process this document")

8. Expose via REST

from fireflyframework_genai.exposure.rest import create_genai_app

app = create_genai_app(title="My GenAI Service")
# uvicorn myapp:app --reload

9. Expose via Queues (Consumer)

from fireflyframework_genai.exposure.queues.kafka import KafkaAgentConsumer

consumer = KafkaAgentConsumer("assistant", topic="requests", bootstrap_servers="localhost:9092")
await consumer.start()

10. Publish via Queues (Producer)

from fireflyframework_genai.exposure.queues.kafka import KafkaAgentProducer

producer = KafkaAgentProducer(topic="results", bootstrap_servers="localhost:9092")
await producer.publish({"agent": "assistant", "output": "Done processing."})
await producer.close()

Using in Jupyter Notebooks

firefly-genai works seamlessly in Jupyter notebooks and JupyterLab. Since the framework is async-first, use await directly in notebook cells (Jupyter provides a running event loop automatically).

Setup

# From your clone directory
cd fireflyframework-genai
source .venv/bin/activate # activate the venv created by the installer
pip install ipykernel # install Jupyter kernel support
python -m ipykernel install --user --name fireflygenai --display-name "Firefly GenAI"
jupyter lab # or: jupyter notebook

Then select the Firefly GenAI kernel when creating a new notebook.

Example Notebook

# Cell 1 β€” configure
import os
os.environ["OPENAI_API_KEY"] = "sk-..." # or set in .env
os.environ["FIREFLY_GENAI_DEFAULT_MODEL"] = "openai:gpt-4o"
# Cell 2 β€” create an agent
from fireflyframework_genai.agents import FireflyAgent

agent = FireflyAgent(name="notebook-bot", model="openai:gpt-4o")
result = await agent.run("Explain quantum entanglement in two sentences.")
print(result.output)
# Cell 3 β€” use memory for multi-turn conversations
from fireflyframework_genai.memory import MemoryManager

memory = MemoryManager(max_conversation_tokens=32_000)
agent_with_mem = FireflyAgent(name="chat", model="openai:gpt-4o", memory=memory)

cid = memory.new_conversation()
result = await agent_with_mem.run("My name is Alice.", conversation_id=cid)
print(result.output)

result = await agent_with_mem.run("What is my name?", conversation_id=cid)
print(result.output) # Alice
# Cell 4 β€” reasoning patterns
from fireflyframework_genai.reasoning import ReActPattern

react = ReActPattern(max_steps=5)
result = await react.execute(agent, "What are the top 3 uses of Python in 2026?")
print(result.output)
# Cell 5 β€” structured output with validation
from pydantic import BaseModel
from fireflyframework_genai.validation import OutputReviewer

class Summary(BaseModel):
    title: str
    bullet_points: list[str]
    confidence: float

reviewer = OutputReviewer(output_type=Summary, max_retries=2)
result = await reviewer.review(agent, "Summarize the benefits of async Python.")
result.output # displays the structured Summary object in the notebook

Tip: You do not need asyncio.run() or nest_asyncio in Jupyter β€” await works at the top level of any cell because Jupyter runs its own event loop.


Learn the Framework

The Complete Tutorial ("The Bible")

docs/tutorial.md is a 20-chapter, hands-on guide that teaches every concept from zero to expert through a real-world Intelligent Document Processing pipeline. Start here if you want to learn the framework thoroughly.

Use Case: IDP Pipeline

docs/use-case-idp.md is a focused walkthrough of building a 7-phase IDP pipeline that ingests, splits, classifies, extracts, validates, assembles, and explains data from corporate documents β€” using agents, reasoning, document splitting, content processing, validation, explainability, pipelines, and REST exposure.

Module Reference

Detailed guides for each module:

  • Architecture β€” Design principles and layer diagram
  • Agents β€” Lifecycle, registry, delegation, decorators
  • Template Agents β€” Summarizer, classifier, extractor, conversational, router
  • Tools β€” Protocol, builder, guards, composition, built-ins
  • Prompts β€” Templates, versioning, composition, validation
  • Reasoning Patterns β€” 6 patterns, structured outputs, custom patterns
  • Content β€” Chunking, compression, batch processing
  • Memory β€” Conversation history, working memory, storage backends
  • Validation β€” Rules, QoS guards, output reviewer
  • Pipeline β€” DAG orchestrator, parallel execution, retries
  • Observability β€” Tracing, metrics, events
  • Explainability β€” Decision recording, audit trails, reports
  • Experiments β€” A/B testing, variant comparison
  • Lab β€” Benchmarks, datasets, evaluators
  • Exposure REST β€” FastAPI integration, SSE streaming
  • Exposure Queues β€” Kafka, RabbitMQ, Redis integration
  • Studio β€” Visual IDE, canvas, code generation, AI assistant, CLI

Development

git clone https://github.com/fireflyframework/fireflyframework-genai.git
cd fireflyframework-genai
uv sync --all-extras
uv run pytest # Run 367+ tests
uv run ruff check src/ tests/ # Lint
uv run pyright src/ # Type check

Dev dependencies (installed with uv sync): pytest >=8.3.0, pytest-asyncio >=0.24.0, pytest-cov >=6.0.0, ruff >=0.9.0, pyright >=1.1.0, httpx >=0.28.0.

Contributing

See CONTRIBUTING.md for guidelines.

Changelog

See CHANGELOG.md for notable changes.

License

Apache License 2.0. See LICENSE for the full text.

About

Production-grade GenAI metaframework on Pydantic AI

Resources

License

Code of conduct

Contributing

Security policy

Stars

Watchers

Forks

Packages

No packages published

Contributors 2

  •  
  •