Skip to Content
ConceptsFAI Protocol Specification

FAI Protocol β€” v0.1 Specification

The declarative context-wiring standard for AI primitive orchestration.

Abstract

The FAI Protocol defines a JSON-based manifest format (fai-manifest.json) for declaring how AI primitives β€” agents, instructions, skills, hooks, workflows, plugins, tools, prompts, and guardrails β€” are wired together into a coherent, evaluated, deployable system. It provides the missing β€œglue layer” between isolated AI building blocks, enabling them to share context, enforce quality gates, and compose into reproducible solutions. The protocol is model-agnostic, framework-agnostic, and cloud-agnostic.

Status

FieldValue
Version0.1 (Draft)
Date2026-04-06
AuthorsFrootAI Contributors
LicenseMIT
Reference ImplementationFAI Engine
Validated AgainstSolution plays, AI primitives

This specification is at v0.1 (Draft). It is implemented by the FAI Engine reference implementation and validated across solution plays comprising agents, instructions, skills, and plugins.


1. Introduction

1.1 Problem

The AI tooling ecosystem has produced hundreds of capable building blocks β€” agents, retrieval pipelines, prompt templates, guardrails, evaluation harnesses, infrastructure modules β€” but no standard for wiring them together. Each framework (LangChain, Semantic Kernel, AutoGen, CrewAI) defines its own composition model, and each platform (Azure AI Foundry, AWS Bedrock, Vertex AI) adds its own orchestration layer. The result is fragmented, non-portable AI systems where changing one component requires rewiring everything manually.

Protocols like MCP (Model Context Protocol) standardize tool calling. A2A (Agent-to-Agent) standardizes delegation. AG-UI standardizes rendering. But none of them address the fundamental question: how do you declare which primitives a system uses, how they share context, and what quality thresholds they must meet?

1.2 Solution

The FAI Protocol introduces fai-manifest.json β€” a single declarative file that serves as the Dockerfile equivalent for AI systems. Just as a Dockerfile declares base images, dependencies, and build steps for a container, fai-manifest.json declares knowledge context, primitives, quality guardrails, infrastructure, and toolkit paths for an AI solution. A conformant runtime reads the manifest, resolves all paths, injects shared context into every primitive, and evaluates outputs against declared thresholds.

1.3 Scope

The FAI Protocol covers:

  • Declaration of the 9 primitive types and their file paths
  • Shared context wiring (knowledge modules + WAF pillars)
  • Quality guardrail thresholds (groundedness, coherence, relevance, safety, cost)
  • Infrastructure-as-Code references (Bicep, Terraform, Pulumi, Docker, Helm, Kubernetes)
  • Toolkit structure (DevKit, TuneKit, SpecKit)
  • Standalone primitive context via the companion fai-context.json format

The FAI Protocol delegates to other standards:

ConcernDelegated To
Tool invocationMCP (Model Context Protocol)
Agent-to-agent delegationA2A (Agent-to-Agent Protocol)
UI renderingAG-UI
Model inferenceProvider APIs (OpenAI, Azure OpenAI, Anthropic, etc.)
Infrastructure provisioningBicep, Terraform, Pulumi
Package distributionnpm, PyPI, Docker Hub

2. Terminology

TermDefinition
PrimitiveOne of 9 building block types: agent, instruction, skill, hook, workflow, plugin, tool, prompt, or guardrail. Each primitive is a file or folder following a defined naming convention.
ManifestA fai-manifest.json file that declares all primitives and their wiring for a play. Every conformant play MUST contain exactly one manifest at its root.
ContextShared knowledge and WAF alignment inherited by all primitives in a play. Context flows downward from the manifest to every loaded primitive.
PlayA self-contained, deployable AI solution composed of wired primitives. Identified by a two-digit number and kebab-case name (e.g., 01-enterprise-rag).
GuardrailA quality threshold enforced at the protocol level. Values are normalized to the 0–1 range (except safety, which MUST be 0 for production, and costPerQuery, which is a USD decimal).
WAF PillarOne of 6 Well-Architected Framework dimensions: security, reliability, cost-optimization, operational-excellence, performance-efficiency, responsible-ai.
Knowledge ModuleA unit of domain knowledge identified by a FROOT layer prefix and numeric ID (e.g., R2-RAG-Architecture). The runtime resolves module IDs to actual content.
Context InheritanceThe mechanism by which standalone primitives (declaring fai-context.json) receive context when embedded in a play’s manifest.
FAI EngineThe reference runtime that reads manifests, resolves paths, wires context, and evaluates guardrails.

3. Manifest Format

A manifest is a JSON file named fai-manifest.json located at the root of a play directory. It MUST conform to the JSON Schema at ../schemas/fai-manifest.schema.json.

3.1 Required Fields

Every manifest MUST include four top-level fields:

FieldTypeDescription
playstringPlay identifier matching ^[0-9]{2}-[a-z0-9-]+$
versionstringSemantic version matching ^[0-9]+\.[0-9]+\.[0-9]+(-[a-z0-9.]+)?$
contextobjectShared context (see Β§3.2)
primitivesobjectPrimitive declarations (see Β§3.3)

Example β€” Minimal manifest:

{ "play": "01-enterprise-rag", "version": "1.0.0", "context": { "knowledge": ["R2-RAG-Architecture", "O4-Azure-AI-Services"], "waf": ["security", "reliability", "cost-optimization"] }, "primitives": { "agents": [ "./agent.md", "./.github/agents/builder.agent.md" ], "instructions": [ "./.github/copilot-instructions.md" ], "skills": [ "./.github/skills/rag-indexer" ] } }

3.2 Context Section

The context object declares shared knowledge and governance that applies to every primitive loaded from this manifest. It is the mechanism that transforms isolated building blocks into a coherent system.

FieldTypeRequiredDescription
knowledgestring[]YesFROOT knowledge module IDs (min 1). See Β§4.1 for valid IDs.
wafstring[]YesWAF pillars to enforce (min 1, unique). See Β§4.2 for valid values.
scopestringNoScenario scope identifier for context isolation (e.g., enterprise-rag-qa).

Example:

{ "context": { "knowledge": [ "F1-GenAI-Foundations", "R2-RAG-Architecture", "O4-Azure-AI-Services", "T3-Production-Patterns" ], "waf": [ "security", "reliability", "cost-optimization", "responsible-ai" ], "scope": "enterprise-rag-qa" } }

When the FAI Engine loads a primitive, it injects the resolved knowledge content and WAF constraints into the primitive’s execution context. This ensures that an agent designed for RAG automatically receives RAG architecture knowledge and enforces the security pillar, without the agent needing to declare these dependencies itself.

3.3 Primitives Section

The primitives object maps each primitive type to an array of file or folder paths, relative to the manifest’s directory.

FieldTypePath TargetDescription
agentsstring[].agent.md filesAgent definitions with YAML frontmatter
instructionsstring[].instructions.md filesBehavioral instructions scoped by applyTo globs
skillsstring[]Folders containing SKILL.mdReusable, multi-step capability definitions
hooksstring[]Folders containing hooks.jsonEvent-driven scripts triggered by lifecycle events
workflowsstring[].yml filesMulti-agent orchestration workflows
guardrailsobjectInline thresholdsQuality gates (see Β§3.4)

Paths follow the resolution rules defined in Β§5.

3.4 Guardrails Section

Guardrails are inline quality thresholds declared within the primitives object. The FAI Engine evaluates every agent response against these thresholds and reports pass/fail per metric.

FieldTypeRangeDescription
groundednessnumber0–1Minimum groundedness score. Measures whether the response is supported by retrieved sources. Recommended: β‰₯ 0.95 for enterprise.
coherencenumber0–1Minimum coherence score. Measures logical consistency and readability. Recommended: β‰₯ 0.90.
relevancenumber0–1Minimum relevance score. Measures whether the response addresses the user’s query. Recommended: β‰₯ 0.85.
safetyinteger0Maximum allowed safety violations. MUST be 0 for production deployments.
costPerQuerynumberβ‰₯ 0Maximum cost per query in USD. Enforced by the cost-optimization WAF pillar.

Example:

{ "primitives": { "agents": ["./agent.md"], "guardrails": { "groundedness": 0.95, "coherence": 0.90, "relevance": 0.85, "safety": 0, "costPerQuery": 0.02 } } }

A conformant engine MUST evaluate at least groundedness and safety when guardrails are declared. Engines MAY skip metrics that require infrastructure not available in the runtime environment (e.g., costPerQuery requires a billing API).

3.5 Infrastructure Section (Optional)

The infrastructure object references Infrastructure-as-Code templates for provisioning cloud resources. This section is OPTIONAL β€” plays that are framework-only (no cloud resources) omit it.

FieldTypeDescription
bicepstringPath to Azure Bicep entry template (e.g., ./infra/main.bicep)
parametersstringPath to Bicep/ARM parameter file
terraformstringPath to Terraform configuration (e.g., ./infra/main.tf)
pulumistringPath to Pulumi program entry point
dockerstringPath to Docker Compose file
kubernetesstringPath to Kubernetes manifests directory
helmstringPath to Helm chart directory

A manifest MAY declare multiple infrastructure formats simultaneously, enabling multi-cloud deployment from a single play.

Example:

{ "infrastructure": { "bicep": "./infra/main.bicep", "parameters": "./infra/main.bicepparam", "docker": "./docker-compose.yml" } }

3.6 Toolkit Section (Optional)

The toolkit object declares paths to the three kits that equip every play. This section is OPTIONAL but RECOMMENDED for plays that follow the full FAI structure.

FieldTypeDescription
devkitstringPath to DevKit β€” contains agents, instructions, prompts, skills, hooks (typically ./.github/)
tunekitstringPath to TuneKit β€” contains customer-tunable AI parameters, evaluation configs, guardrails (typically ./config/)
speckitstringPath to SpecKit β€” contains architecture docs, WAF alignment records, the manifest itself (typically ./spec/)

Example:

{ "toolkit": { "devkit": "./.github", "tunekit": "./config", "speckit": "./spec" } }

4. Context Resolution

4.1 Knowledge Module IDs

Knowledge modules are identified by a layer prefix, numeric ID, and descriptive name, following the FROOT taxonomy:

LayerPrefixModules
FoundationsFF1-GenAI-Foundations, F2-LLMs, F3-Glossary, F4-Agentic-OS
ReasoningRR1-Prompts, R2-RAG-Architecture, R3-Deterministic-AI
OrchestrationOO1-Semantic-Kernel, O2-Agents, O3-MCP-Tools, O4-Azure-AI-Services, O5-Infrastructure, O6-Copilot
TransformationTT1-Fine-Tuning, T2-Responsible-AI, T3-Production-Patterns

A conformant engine MUST recognize all module IDs listed above. Engines MAY support additional custom module IDs prefixed with X (e.g., X1-Custom-Domain).

4.2 WAF Pillar Values

The following six values are the only valid entries in the context.waf and fai-context.json waf arrays:

ValuePillar
securityIdentity, network, data protection, AI-specific security
reliabilityRetry, circuit breaker, health checks, graceful degradation
cost-optimizationModel routing, token budgets, right-sizing, FinOps
operational-excellenceCI/CD, observability, IaC, incident management
performance-efficiencyCaching, streaming, async patterns, bundle optimization
responsible-aiContent safety, groundedness, fairness, transparency

4.3 Context Inheritance

When a primitive is loaded into a play, context flows as follows:

  1. The FAI Engine reads the manifest’s context.knowledge and resolves each module ID to content.
  2. The engine reads the manifest’s context.waf to determine which pillars are enforced.
  3. For each primitive path in primitives.*, the engine loads the primitive file.
  4. If the primitive has a sibling fai-context.json, the engine merges the standalone context with the play context. Play context takes precedence on conflict.
  5. The merged context is injected into the primitive’s runtime environment.

Precedence rules:

  • Play-level waf pillars are additive: a standalone primitive declaring ["security"] in its fai-context.json, loaded into a play declaring ["security", "reliability"], will have both pillars enforced.
  • Play-level knowledge modules replace standalone assumes: if the play declares knowledge, the engine resolves play-level modules, not the primitive’s assumed modules.
  • Play-level guardrails override any evaluation thresholds in fai-context.json.

5. Path Resolution

5.1 Relative Paths

All paths in the manifest are resolved relative to the directory containing fai-manifest.json.

PrefixResolution
./Play-local: resolved within the play’s directory tree
../../Catalog reference: resolved to the standalone primitive catalog
No prefixTreated as ./ (play-local)

Example β€” Mixed paths:

{ "primitives": { "agents": [ "./agent.md", "./.github/agents/builder.agent.md", "../../agents/fai-rag-architect.agent.md" ], "skills": [ "./.github/skills/rag-indexer", "../../skills/fai-play-initializer" ] } }

A conformant engine MUST resolve all paths and report an error if any path does not point to an existing file or directory.

5.2 Standalone vs Embedded

Primitives can be authored in two modes:

ModeLocationContext SourceUse Case
EmbeddedInside a play’s .github/ directoryInherits from the play’s manifestPlay-specific behavior
StandaloneIn the top-level agents/, skills/, instructions/ catalogsDeclares its own fai-context.jsonReusable across multiple plays

A standalone primitive becomes embedded when referenced from a play’s manifest. The FAI Engine handles context injection transparently β€” the primitive’s code does not need to change.

DRY Principle: If a primitive is used by 2 or more plays, it SHOULD be authored as standalone and referenced via ../../ paths. If it is specific to a single play, it SHOULD be embedded.


6. Companion Format: fai-context.json

The fai-context.json file is a lightweight context descriptor for standalone primitives. It is the β€œLEGO connector” that makes an isolated building block aware of the broader FAI ecosystem.

A fai-context.json file MUST conform to the JSON Schema at ../schemas/fai-context.schema.json.

6.1 Fields

FieldTypeDescription
assumesstring[]Knowledge module IDs this primitive assumes are available
wafstring[]WAF pillars this primitive respects or enforces
compatiblePlaysstring[]Play IDs this primitive is tested with (e.g., "01", "01-enterprise-rag")
evaluationobjectExpected quality thresholds when this primitive runs
requiresstring[]Other primitives this one depends on (relative paths)

6.2 Example

{ "assumes": ["R2-RAG-Architecture", "O3-MCP-Tools"], "waf": ["security", "reliability"], "compatiblePlays": ["01-enterprise-rag", "21-agentic-rag", "28-graphrag"], "evaluation": { "groundedness": 0.95, "coherence": 0.90, "relevance": 0.85, "costPerQuery": 0.01 }, "requires": [] }

6.3 Placement

The fai-context.json file MUST be placed as a sibling of the primitive it describes, or inside the primitive’s folder:

agents/ β”œβ”€β”€ fai-rag-architect.agent.md └── fai-rag-architect/ └── fai-context.json ← context for the agent above skills/ └── fai-play-initializer/ β”œβ”€β”€ SKILL.md └── fai-context.json ← context for this skill

7. Schemas

The FAI Protocol is formally defined by two JSON Schema files:

SchemaLocationPurpose
fai-manifest.schema.json../schemas/fai-manifest.schema.jsonValidates the full play manifest
fai-context.schema.json../schemas/fai-context.schema.jsonValidates standalone primitive context

Both schemas use JSON Schema Draft-07 and are published at:

  • https://frootai.dev/schemas/fai-manifest.schema.json
  • https://frootai.dev/schemas/fai-context.schema.json

Manifests SHOULD include a $schema reference for editor validation:

{ "$schema": "https://frootai.dev/schemas/fai-manifest.schema.json", "play": "01-enterprise-rag", "version": "1.0.0" }

8. Reference Implementation

The FAI Engine at ../engine/ implements this specification as six cooperating modules:

ModuleFileResponsibility
Manifest Readermanifest-reader.jsParses fai-manifest.json, validates against schema, extracts fields
Context Resolvercontext-resolver.jsResolves knowledge module IDs to content, merges WAF pillars
Primitive Wirerprimitive-wirer.jsResolves all primitive paths, loads files, injects context
Hook Runnerhook-runner.jsExecutes hooks at lifecycle events (SessionStart, Stop, etc.)
Evaluatorevaluator.jsEvaluates agent outputs against guardrail thresholds, reports pass/fail
MCP Bridgemcp-bridge.jsExposes manifest-wired primitives as MCP-compatible tools

8.1 Processing Pipeline

fai-manifest.json β”‚ β–Ό β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ Manifest │────▢│ Context │────▢│ Primitive β”‚ β”‚ Reader β”‚ β”‚ Resolver β”‚ β”‚ Wirer β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ β–Ό β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ Hook Runner β”‚ β”‚ (lifecycle) β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ β–Ό β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ Evaluator β”‚ β”‚ (guardrails) β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ β–Ό β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ MCP Bridge β”‚ β”‚ (tool export) β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

9. Conformance

9.1 Conformance Levels

LevelNameRequirements
Level 1ParserParse fai-manifest.json without error; validate against schema
Level 2ResolverLevel 1 + resolve all primitive paths to existing files
Level 3WirerLevel 2 + inject shared context into all loaded primitives
Level 4EvaluatorLevel 3 + evaluate outputs against declared guardrails
Level 5FullLevel 4 + report pass/fail per guardrail, support hooks, and export via MCP Bridge

9.2 Conformance Requirements

A conformant implementation MUST:

  1. Parse β€” Read fai-manifest.json and validate it against fai-manifest.schema.json. Report all validation errors with field paths.
  2. Resolve paths β€” Resolve every entry in primitives.agents, primitives.instructions, primitives.skills, primitives.hooks, and primitives.workflows to an existing file or directory. Report missing paths as errors.
  3. Inject context β€” Make context.knowledge module content and context.waf pillar list available to all loaded primitives during execution.
  4. Evaluate guardrails β€” After each agent response, evaluate the output against each declared guardrail threshold. A response with a score below the threshold MUST be flagged as a guardrail violation.
  5. Report results β€” Produce a structured report indicating pass/fail for each guardrail metric, including the measured score and the threshold.

A conformant implementation SHOULD:

  1. Merge context β€” When a loaded primitive has a sibling fai-context.json, merge its context with the play-level context following the precedence rules in Β§4.3.
  2. Run hooks β€” Execute hook scripts at the lifecycle events declared in hooks.json.
  3. Bridge to MCP β€” Expose wired primitives as MCP-compatible tools for external consumption.

9.3 Error Handling

Error ClassBehavior
Schema validation failureMUST halt and report all validation errors
Missing primitive pathMUST report as error; MAY continue loading remaining primitives
Unknown knowledge module IDSHOULD warn; MUST NOT halt
Guardrail violationMUST flag in report; MAY retry with fallback model
Missing fai-context.jsonMUST NOT error β€” context files are optional

10. Security Considerations

  • Manifests MUST NOT contain secrets, API keys, or connection strings. Use environment variables or secret managers.
  • Primitive paths MUST be confined to the play directory or the known catalog directories. Path traversal beyond the repository root MUST be rejected.
  • Hook scripts execute with the permissions of the runtime process. Conformant engines SHOULD sandbox hook execution.
  • Guardrail evaluation results SHOULD be logged for audit, but MUST NOT include PII from user queries.

11. Versioning

The FAI Protocol uses semantic versioning. The version field in the manifest refers to the play’s version, not the protocol version. The protocol version is identified by the $schema URI.

Protocol VersionSchema URIStatus
0.1https://frootai.dev/schemas/fai-manifest.schema.jsonDraft

Breaking changes to the schema (removing required fields, changing field types) will increment the major protocol version. Additive changes (new optional fields) will increment the minor version.


12. Full Example

A complete fai-manifest.json for an enterprise RAG solution:

{ "$schema": "https://frootai.dev/schemas/fai-manifest.schema.json", "play": "01-enterprise-rag", "version": "2.0.0", "context": { "knowledge": [ "F1-GenAI-Foundations", "F2-LLMs", "R2-RAG-Architecture", "O4-Azure-AI-Services", "T3-Production-Patterns" ], "waf": [ "security", "reliability", "cost-optimization", "performance-efficiency", "responsible-ai" ], "scope": "enterprise-rag-qa" }, "primitives": { "agents": [ "./agent.md", "./.github/agents/builder.agent.md", "./.github/agents/reviewer.agent.md", "./.github/agents/tuner.agent.md", "../../agents/fai-rag-architect.agent.md" ], "instructions": [ "./.github/copilot-instructions.md", "./.github/instructions/rag-domain.instructions.md" ], "skills": [ "./.github/skills/rag-indexer", "./.github/skills/rag-evaluator" ], "hooks": [ "./.github/hooks/rag-guardrails" ], "workflows": [ "./.github/workflows/rag-pipeline.yml" ], "guardrails": { "groundedness": 0.95, "coherence": 0.90, "relevance": 0.85, "safety": 0, "costPerQuery": 0.02 } }, "infrastructure": { "bicep": "./infra/main.bicep", "parameters": "./infra/main.bicepparam", "docker": "./docker-compose.yml" }, "toolkit": { "devkit": "./.github", "tunekit": "./config", "speckit": "./spec" } }

Appendix A: Relationship to Other Protocols

ProtocolRelationship to FAI
MCP (Model Context Protocol)FAI declares which tools to wire; MCP defines how to call them. The MCP Bridge module exports FAI-wired primitives as MCP tools.
A2A (Agent-to-Agent)FAI declares agent composition within a play; A2A handles delegation between plays or external agents.
AG-UIFAI is backend-only; AG-UI handles how agent outputs are rendered to users.
OpenAI Assistants APIFAI is a superset β€” it can wire OpenAI assistants as one of many agent types.
LangChain / LangGraphFramework-specific orchestration. FAI wraps these as implementation details inside agents.
Semantic KernelFAI can declare SK plugins as skills and SK planners as agents.

Appendix B: Primitive File Conventions

PrimitiveFile PatternNaming Rule
Agent*.agent.mdlowercase-hyphen (e.g., fai-rag-architect.agent.md)
Instruction*.instructions.mdlowercase-hyphen (e.g., rag-domain.instructions.md)
Skillfolder/SKILL.mdFolder name = kebab-case, must match name in SKILL.md frontmatter
Hookfolder/hooks.jsonFolder name = kebab-case
Workflow*.ymllowercase-hyphen
Pluginfolder/plugin.jsonFolder name = kebab-case, must match name in plugin.json
Prompt*.prompt.mdlowercase-hyphen

License

MIT β€” FrootAI Contributors

See LICENSE for the full license text.

Last updated on