K9X

For developers

Install K9-AIF, run it, and build your first application. No model needed to start.

K9-AIF is architecture first: you design with the framework's base classes (ABBs), then write your own classes (SBBs) that extend them. This page gets you from nothing to a running application.

What you need

Python 3.11 or laterWith virtual environments and pip.
Object-oriented programmingClasses, inheritance, abstract base classes. K9-AIF applies Factory, Strategy, Template Method and Observer as structure.
Agents and LLMsWhat a model call returns, and what an agent is: a component that takes input, reasons (usually through a model) and returns a structured result.
YAMLAgents and squads are defined in YAML, not hard-coded.
OptionalOllama for local models, PostgreSQL, Kafka and containers for production. None is needed to start: routing state goes to SQLite and a mock model runs the whole pipeline.

Install and run

pip install k9-aif
k9aif verify          # smoke test: the framework imports and wires up
k9aif init            # scaffold a project structure
python main.py
k9aif doctor          # check your environment

Or design the application in K9X Studio and generate the project there (pip install k9x && k9x studio runs it locally).

From source

git clone https://github.com/k9aif/k9-aif-framework.git
cd k9-aif-framework
python3.11 -m venv .venv && source .venv/bin/activate
pip install -r requirements.txt
pytest k9_aif_abb/tests/test_framework.py -v     # no model or database needed

Models

Ollama at localhost:11434 is the default provider; pull a model and name it in your configuration. OpenAI, Azure OpenAI and IBM watsonx are configuration changes, not code changes.

Working with Claude Code

The repository makes Claude Code framework-aware out of the box.

CLAUDE.mdThe architecture reference, loaded into every Claude Code session in the repository.
SKILLS.md17 step-by-step recipes: new agents, squads, providers, validation loops, HIL wiring and more.
Hooks8 checks that run on every edit, from Python and YAML syntax to blocking an orchestrator that names its agents.
Pluginclaude --plugin-dir ./k9aif-plugin adds commands such as /k9aif:add-agent, /k9aif:add-squad, /k9aif:add-validation-loop, /k9aif:add-router, /k9aif:add-adapter and /k9aif:inspect.

Before you write code

ABB and SBB. The framework's base classes live in k9_aif_abb/; you extend them and never edit them. Your classes live in your own application folder.

One path. Each layer knows only the layer below it:

Event → Router → Orchestrator → Squad → Agents → model

An orchestrator knows only squads, never agents; if a squad's agents change, the orchestrator does not. k9aif inspect and a hook check this for you.

Three rules every agent keeps

1Call models only through llm_invoke(), never a provider or the router directly.
2Let failures propagate. Never return a placeholder such as "[WARN] ..." in place of a result; the squad and orchestrator record the failure and decide what happens.
3Never reference squads, orchestrators or routing in agent code or agent YAML.

Governance needs nothing from you: every agent is checked before and after each step by construction.

Next steps

Developer guideAll 31 sections: patterns, governance, messaging, testing.Read
ExamplesWorking applications, including DAS, the flagship application.Browse
API referenceEvery base class, generated from the source.Open
Architecture graphEvery component and relationship, explorable.Open