FrootAI
Python SDK
From the Roots to the Fruits. It's simply Frootful.
An open ecosystem where Infra, Platform, and App teams build AI — Frootfully.
A uniFAIng glue for the GenAI ecosystem, enabling deterministic and reliable AI solutions.
The Philosophy Behind FrootAI — The Essence of the FAI Engine
FrootAI is an intelligent way of packaging skills, knowledge, and the essential components of the GenAI ecosystem — all synced, not standalone. Infrastructure, platform, and application layers are woven together so that every piece understands and builds on the others. That's what "from the roots to the fruits" means: a fully connected ecosystem where Infra, Platform, and App teams build AI — Frootfully.
The FROOT Framework
FROOT = Foundations · Reasoning · Orchestration · Operations · Transformation
| Layer | What You Learn |
|---|---|
| F | Tokens, models, glossary, Agentic OS |
| R | Prompts, RAG, grounding, deterministic AI |
| O | Semantic Kernel, agents, MCP, tools |
| O | Azure AI Foundry, GPU infra, Copilot ecosystem |
| T | Fine-tuning, responsible AI, production patterns |
The FAI Ecosystem
Install
pip install frootai
Quick Start
from frootai import FrootAI, SolutionPlay, Evaluator
client = FrootAI()
# Search knowledge
results = client.search("RAG architecture")
# Get a module
module = client.get_module("R2") # RAG Architecture
# Browse solution plays
plays = SolutionPlay.all()
# Estimate Azure costs
cost = client.estimate_cost("01-enterprise-rag", scale="prod")
# Run evaluation
evaluator = Evaluator()
scores = {"groundedness": 4.5, "relevance": 3.8}
results = evaluator.check_thresholds(scores)
CLI
frootai plays # List all solution plays
frootai search "embeddings" # BM25 search across knowledge
frootai modules # List FROOT modules
frootai glossary temperature # Look up a term
frootai cost 01-enterprise-rag # Azure cost estimate
frootai scaffold 01 --dry-run # Preview scaffold output
frootai wire 01 # Generate fai-manifest.json
frootai validate manifest.json # Validate FAI manifest
frootai evaluate groundedness=4.5 relevance=3.8 # Run quality check
frootai waf security # WAF pillar guidance
frootai primitives # Browse AI primitives
frootai learning-path rag # Curated learning path
Features
| Feature | Description |
|---|---|
| BM25 Search | Full-text search (358 docs × 8,627 terms), falls back to keyword |
| Solution Plays | Pre-architected Azure AI patterns with filtering |
| FAI Protocol | Wire, validate, inspect fai-manifest.json |
| Scaffold | Bootstrap projects with DevKit structure |
| WAF Guidance | 6-pillar Well-Architected Framework advice |
| Evaluation | Threshold-based quality gates with JSON export |
| A/B Testing | Prompt experiment framework with scoring |
| Agentic Loop | Ralph Loop — autonomous task execution |
| Cost Estimation | Itemized Azure cost estimates by play |
| AI Glossary | Comprehensive glossary extracted from knowledge modules |
| CLI | 13 commands for browsing, searching, scaffolding |
| Zero Dependencies | Pure Python stdlib, works anywhere |
Testing
pip install pytest
python -m pytest tests/ -v
# 123 tests
Federation
The SDK ships an asyncio-based FederationClient that wraps the FAI MCP federation kernel — discover marketplace areas, attach a trusted area, list its tools, invoke them, and detach when done. The client is lazy (importing FrootAI does not spawn a kernel subprocess) and offline-first (every method dispatches through an injectable transport so unit tests can drive the client without a live kernel). The Python public surface is byte-for-byte parity with the npm-sdk twin (snake_case method names per PEP 8; the cross-language scripts/sdk-parity-check.mjs enforces drift detection in CI).
Constructor opts
from frootai import FrootAI
fai = FrootAI(
federation={
"pre_attach": ["azure", "playwright"], # areas to pre-attach on kernel spawn
"trust_file": "/etc/frootai/trust.json", # path to the trust manifest
"idle_disconnect_minutes": 30, # auto-detach after N minutes idle (1..1440)
},
)
mcp = fai.mcp # lazy — kernel transport spins up on first access
attach → list_tools → invoke → detach (canonical flow)
import asyncio
from frootai import FrootAI
from frootai.federation import FederationError
async def main() -> None:
fai = FrootAI(federation={"pre_attach": ["azure"]})
mcp = fai.mcp
try:
handle = await mcp.attach({"name": "azure", "trustOverride": True})
if handle.get("blocked"):
print(f"trust gate refused: {handle.get('humanMessage')}")
return
tools = await mcp.list_tools(handle)
for tool in tools:
print(tool["qualifiedName"], tool.get("description"))
result = await mcp.invoke("azure.list_subscriptions", {"tier": "verified"})
print(result)
await mcp.detach(handle) # resolves None; raises FederationError on explicit kernel failure
except FederationError as e:
if e.code == FederationError.ATTACH_TIMEOUT:
# canonical UPPER_SNAKE class attributes cover the 8-code taxonomy
print("attach timed out")
raise
asyncio.run(main())
chain — sequential federated calls with prev-mapping
final_result = await mcp.chain([
{"tool": "azure.list_subs", "args": {"tier": "verified"}},
{"tool": "azure.list_vms", "mapPrev": lambda prev: {"subId": prev["id"]}},
{"tool": "azure.show_vm", "mapPrev": lambda prev: {"vmName": prev["name"]}},
])
chain() is SDK-side composition over invoke() — there is no fai_chain kernel method. Each step dispatches as a regular fai_invoke_tool round-trip; mapPrev extracts the previous step's result into the next step's args. Capped at 32 steps (MAX_CHAIN_STEPS).
Forward-compatibility: typed helpers are OPTIONAL
The Tier-1 typed helpers (build_tier1_accessors(client), e.g. tier1.azure.subscription_list(args)) are an ergonomic layer on top of invoke(). They are NEVER required:
# Forward-compatible direct invocation — works for ANY tool the
# kernel exposes, including ones not yet in the typed-helper
# snapshot (or kernel-only tools that intentionally bypass the
# typed surface).
result = await mcp.invoke("azure.subscription_list", {"tier": "verified"})
new_area_result = await mcp.invoke("future_area.future_tool", { ... })
The canonical wire-literal is the snake_case <area>.<tool> form. The typed helpers exist purely for IDE autocomplete + compile-time-checkable args; consumers who add a NEW federated area do NOT have to wait for a typed-helper codegen pass before invoking it. This keeps the SDK forward-compatible with kernel-side tool additions and Tier-2/3 areas that will never get bespoke wrappers.
Error taxonomy
FederationError.code is one of 8 canonical codes (byte-for-byte mirrored from the npm-sdk twin):
| Code | Meaning |
|---|---|
kernel_connection_pending |
Wire transport not yet connected (PIN_ONE_AHEAD default) |
user_error |
Invalid args / handle / tool name (caller bug) |
detach_failed |
Kernel explicitly reported detached: False |
trust_blocked |
Trust gate refused; surfaces in AttachHandle["blocked"] (rarely raised) |
tool_error |
Underlying tool raised; payload in humanMessage |
transport_error |
Wire-level failure (process / I/O) |
attach_timeout |
Kernel didn't ack attach within deadline |
namespace_collision |
Two attached areas exposed the same bare tool name |
For static type-checking, import the codegen-emitted FederationErrorCode Literal alias from frootai.federation.types.
Links
| Resource | Link |
|---|---|
| Website | frootai.dev |
| Setup Guide | FAI Packages Setup |
| Python MCP Server | PyPI — frootai-mcp |
| Node MCP Server | npm — frootai-mcp |
| VS Code Extension | Marketplace |
| Docker Image | GitHub Container Registry |
| GitHub | frootai/frootai |
| Contact | info@frootai.dev |
© 2026 FrootAI — MIT License
AI architecture · Python · SDK · Azure · RAG · agents · copilot · evaluation · cost-estimation · offline-first · zero-dependencies · open-source · frootai
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file frootai-5.1.0.tar.gz.
File metadata
- Download URL: frootai-5.1.0.tar.gz
- Upload date:
- Size: 509.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.15
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f0c52dc46f10a8974c47b8591090c61276e26c98b2c7df159b786c337c07a7fa
|
|
| MD5 |
268e054d09565b032150b783d9d630ad
|
|
| BLAKE2b-256 |
6b2ad7be08d131ee958d870474e64c853c63e34b1e1d92001557095044f3d2b3
|
File details
Details for the file frootai-5.1.0-py3-none-any.whl.
File metadata
- Download URL: frootai-5.1.0-py3-none-any.whl
- Upload date:
- Size: 504.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.15
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2b8cd15128443a88e4f29f0934ca24aeff89b869f0e0e7a226a91b32e954af91
|
|
| MD5 |
ed5a653b82d18838a9a736e3ddc65bbe
|
|
| BLAKE2b-256 |
0a131b6395b2dfca97295cbc1f8407913515a4a0b0ea983acf751424a5083107
|