flare-ai-kit icon indicating copy to clipboard operation
flare-ai-kit copied to clipboard

🚧 SDK for building verifiable AI Agents on Flare using Confidential Space

Flare AI Kit

SDK for building verifiable AI Agents on Flare using Confidential Space Trusted Execution Environments (TEEs).

[!WARNING]

Flare AI Kit is currently under active development (alpha stage).

Interfaces, APIs, and functionalities may change frequently and potentially in backward-incompatible ways before a stable release. Use with caution.

✨ Features

🏗️ Architecture

The kit is composed of modular engines for agents, social feeds, onchain data, and consensus.

flowchart TD
    A["Flare AI Kit"]

    %% Agent Framework subgraph
    subgraph AgentFramework["Agent Framework"]
        B["Google ADK"]
        B --o LLM["Gemini<br>GPT<br>Grok<br>+200 models"]
    end

    %% VectorRAG Engine subgraph
    subgraph VectorRAG["VectorRAG Engine"]
        C["Qdrant"]
        C --o SOURCE[DevHub<br>Flare News<br>Flare Governance]
    end

    %% Secure Enclave subgraph
    subgraph SecureEnclave["Secure Enclave"]
        E["Confidential Space"]
        E --> HW[Intel TDX]
        HW --o RA[RA-verify<br>RA-TLS]
    end

    %% Ecosystem Engine subgraph
    subgraph EcosystemEngine["Ecosystem Engine"]
        F[Ecosystem Engine]
        F --> PR[Protocols]
        PR --o PROTOS["FTSO<br>FDC<br>FAssets"]
        F --> AP[Applications]
        AP --o APPS[SparkDEX<br>OpenOcean<br>Kinetic<br>Cyclo]
    end

    %% Social Engine subgraph
    subgraph SocialEngine["Social Engine"]
        G["Social"]
        G --o SOC["X<br>Telegram<br>Farcaster<br>Slack"]
    end

    %% Consensus Engine subgraph
    subgraph ConsensusEngine["Consensus Engine"]
        H["Consensus"]
        H --o ALGOS[Majority<br>Tournament<br>Clustering]
    end

    %% Connections to Flare AI Kit central node
    A --> B
    A --> C
    A --> E
    A --> F
    A --> G
    A --> H

📦 Getting Started

Prerequisites

  1. Clone & configure:

    git clone --recursive https://github.com/flare-foundation/flare-ai-kit.git
    cd flare-ai-kit
    cp .env.example .env  # add API keys and settings
    
  2. Install:

    uv sync --all-extras
    

✅ Development Checks

Run the following commands to format, lint, type-check, and test your code before committing.

# Format, lint, type-check, test
uv run ruff format && uv run ruff check --fix && uv run pyright && uv run pytest

🐳 Docker

Running the Full SDK

docker build -t flare-ai-kit .
docker run --rm --env-file .env flare-ai-kit

Running Individual Scripts

The repository includes a parametric Dockerfile for running specific scripts with only the dependencies they need:

# Build and run PDF ingestion script
docker build -t fai-script-pdf \
  --build-arg EXTRAS=pdf \
  --build-arg SCRIPT=ingest_pdf.py .

docker run --rm -it \
  -v "$PWD/scripts/data:/app/scripts/data" \
  --env-file .env \
  fai-script-pdf

Available EXTRAS: pdf, rag, a2a, ftso, da, fassets, social, tee, wallet, ingestion

See Docker Scripts Guide for detailed usage instructions.

☁️ Deploy to Confidential Space

Prerequisites: Authenticated gcloud CLI.

  1. Configure GCP: Set all GCP__* variables in your .env file.

  2. Deploy:

    chmod +x gcloud-deploy.sh
    ./gcloud-deploy.sh # verbose: ./gcloud-deploy.sh -v
    

🤝 Contributing

See CONTRIBUTING.md. We use Conventional Commits, Ruff/Pyright gates, and pytest. Please include tests and update docs for any user-visible changes.

📜 License

This project is open-source and licensed under the Apache License 2.0. See LICENSE file.