K9X

Open source · Apache 2.0 · Python 3.11+

Not just agents. Architecture.

K9-AIF gives multi-agent AI an architecture: one path for every request, and a policy check before every action. The K9X Ecosystem works with it to design, test and run your systems.

# no model needed to start
$ pip install k9-aif
$ k9aif init
Scaffolding K9-AIF project structure...
$ python main.py
Squad initialized. Agents registered. Pipeline running.
$ k9aif doctor
✓ All checks passed

# or design it visually
$ pip install k9x && k9x studio
K9X

The framework

K9-AIF

A Python library. Every request takes one path, Router to Orchestrator to Squad to Agent, and every agent is checked against policy before it acts. Works with any agent framework; out of the box with the OpenAI and Claude agent SDKs, LangGraph and CrewAI.

Get started
$pip install k9-aif

The ecosystem

K9X Ecosystem

Applications for the rest of an AI system's life: design it in Studio, check it with Inspector, attack it with SATAN, watch for new threats with Sentinel, and bring people in with HIL. Together they keep the framework current as new attacks appear.

Where it fits

Around the agent framework you already use. K9-AIF doesn't replace it. It adds the architecture and the governance around it, whether your application is new or already built.

Your applicationNew on K9-AIF, or already built with an agent framework
K9-AIFArchitecture and governance: one path for every request (Router, Orchestrator, Squad, Agent), a policy check before every action, a record of every decision
Agent frameworksHow agents collaborate: OpenAI Agents SDK, Claude Agent SDK, LangGraph, CrewAI, or K9-AIF native
ModelsOllama, OpenAI, Azure OpenAI, IBM watsonx, picked per request by the K9 Model Router
InfrastructureAWS, Azure, IBM Cloud or your own servers; Kafka, PostgreSQL, Redis, vector stores, MCP servers, OIDC, Vault

K9X Ecosystem

Applications that work across every layer

DesignStudio CheckInspector AttackSATAN WatchSentinel ReviewHIL

Already have an agentic application?

Keep it. K9-AIF wraps it and adds the architecture and governance around it.

Adapters out of the box for the OpenAI Agents SDK, the Claude Agent SDK, LangGraph and CrewAI. Using another framework? Build your own adapter on the same base class.

Starting a new one?

Build on K9-AIF from the start. Design it in K9X Studio from a spec or BPMN file, pick an agent framework or K9-AIF native, and generate the project.

Your agent framework handlesK9-AIF adds around it
  • How an agent reasons and plans
  • Calling tools
  • Handing work from one agent to another
  • Prompts and memory
  • One path for every request: Router, Orchestrator, Squad, Agent
  • A policy check before and after every agent step
  • The K9 Model Router: only models cleared for the request, learning which does best
  • Human review through K9X HIL, resuming on the decision
  • The caller's identity checked at the door, and carried to tools when you turn it on
  • A record of every routing decision
  • k9aif inspect: the code keeps matching the design

Start here

Learn the frameworkWhat the six layers do, why the checks live in the base classes, and how an application extends them. Watch the 3-minute video, then read the docs.Read the docs
Build somethingpip install k9-aif, then k9aif init. No model needed to start. Or design the architecture in K9X Studio and generate the project. Current release: k9-aif 1.36.0, 25 Nov 2026Getting started
Explore the ecosystemSee the K9X applications running: design in Studio, conformance in Inspector, attacks in SATAN, threat watch in Sentinel, human review in HIL. Most have a live demo login.See the K9X Ecosystem

One path for every request

Each layer has one job and talks only to the layer next to it. That is what makes the system readable a year from now. Hover over a step for more.

01

Event

A chat message, an API call, a file.

Anything that starts work: a message typed in a chat window, an API call, a Kafka message, a document upload. Large files travel as links to object storage, so the event itself stays small.
02

Router

Admits the caller and sends the event to the right orchestrator.

The single entry point. It checks who is calling first: an API key, or OIDC through Keycloak, Entra ID or Okta. Then it routes deterministically: a known event type, such as a submitted claim, goes straight to its orchestrator through a fixed routing table, with no model involved. Anything else, like a free-text chat message, goes to the Intent Orchestrator, which works out the intent and passes it on.
03

Orchestrator

Owns one domain and chooses the squad.

Owns one business domain and knows only its squads. When a step needs a person, it opens a task in K9X HIL and resumes when the decision comes back. Existing SDK agents, LangGraph graphs and CrewAI crews plug in here through adapters.
04

Squad

Runs the steps in order.

A team of one or more agents, run in the order its YAML sets. Each agent's output enriches the shared context the next agent receives. Change the team in YAML.
05

Agent or adapter

Does one step. Adapters call APIs, rules and data.

An agent can be native K9-AIF or built with the OpenAI Agents SDK, the Claude Agent SDK, LangGraph or CrewAI, all under the same governance. Ready-made patterns: validation loops, critic-actor, planning loops. Adapters take the steps that need no model: REST APIs, SQL, business rules.
06

Model

Only agents reach it, through the model router.

Agents never call a model directly. The K9 Model Router keeps only the models cleared for the request (a confidential prompt never reaches an uncleared model), then picks the one that has scored best on similar prompts, learning from graded results such as K9X Arena. Ollama, OpenAI, Azure OpenAI, IBM watsonx.
Under every layer: GovernanceZero TrustModel routingObservabilityPersistenceMessaging

The framework ships the base classes for each layer (Architecture Building Blocks). Your application extends them (Solution Building Blocks). The checks come with the base class, so no agent can skip them.

K9X Studio

From a spec or BPMN file to a working project. Upload a requirements doc or a process diagram (Blueworks, Camunda, Bizagi). Studio lays out the architecture and generates the project.

Open K9X Studio $pip install k9x

K9X Studio · CanvasFinancial Analysis template
K9X Studio canvas in light theme: a router, two orchestrators, two squads and five agents for a financial analysis application
  1. 1

    Choose your agent framework

    OpenAI Agents SDK, Claude Agent SDK, LangGraph or CrewAI. Or K9-AIF native, the default.

  2. 2

    Design visually

    From a spec, a BPMN file or a template. Router, Orchestrators, Squads and Agents appear on the canvas.

  3. 3

    Generate the code

    A Python project whose classes extend the framework's base classes. Ready for your logic.

  4. 4

    Stay compliant

    k9aif inspect checks the code still matches the design.

The 2 a.m. problem

It's 2 a.m., and an agent just approved a $40,000 reimbursement that should have gone to a person for review.

Nobody wrote bad code. The agent did what its prompt said. The orchestration ran every step on schedule. The demo went well three weeks ago.

What was missing was the architecture between "the agent decided" and "the agent acted": a policy check before the action, a record of why, and a contract saying what this agent may and may not do.

Contracts

Every Router, Orchestrator, Squad and Agent extends a framework base class. The class diagram is the compliance report.

Checks first

Governance runs at every agent boundary, before the action. Operators can lock config keys that no application can override.

A record of why

Every routing decision is stored. "The model decided" is not an answer that survives an audit.

No drift

k9aif inspect checks that the code still matches the design, every time you run it.

K9-AIF doesn't make your agents smarter. It makes the system around them accountable.

Because when that whistle blows at 2 a.m., you'll hear it 100 miles away.

Go deeper

Your agents deserve an architecture.