An open-source Python library for building intent classification and execution systems that work with any AI backend.
Project description
intent-kit
A Python library for building intent-driven workflows with LLMs.
What is intent-kit?
intent-kit is a Python framework for building explicit, composable intent workflows. Works with any classifier—LLMs, rule-based, or your own. No forced dependencies. You define all possible intents and parameters up front, so you always stay in control.
- Zero required dependencies: Standard Python or plug in OpenAI, Anthropic, Google, Ollama, etc.
- Explicit and safe: No emergent "agent" magic.
- Supports multi-intent, context tracking, validation, and visualization.
Features
- Tree-based intent graphs: Compose hierarchical workflows using classifiers and actions.
- Any classifier: Rule-based, ML, LLM, or custom logic.
- Parameter extraction: Automatic, with type validation and custom validators.
- Context/state management: Dependency tracking and audit trail.
- Multi-intent: Split and route complex requests like "Greet Bob and show weather."
- Visualization: Interactive graph output (optional).
- Robust debugging: JSON/console output and error tracing.
Install
pip install intent-kit
# Or with extras:
pip install 'intent-kit[openai,anthropic,google,ollama,viz]'
# Or install all LLM providers plus visualization:
pip install 'intent-kit[all]'
# For visualization features only:
pip install 'intent-kit[viz]'
# For development (includes all providers + dev tools):
pip install 'intent-kit[dev]'
Quick Start
from intent_kit import IntentGraphBuilder, action, llm_classifier
greet = action(
name="greet",
description="Greet the user",
action_func=lambda name, **_: f"Hello {name}!",
param_schema={"name": str}
)
weather = action(
name="weather",
description="Get weather info",
action_func=lambda city, **_: f"Weather in {city} is sunny.",
param_schema={"city": str}
)
classifier = llm_classifier(
name="root",
children=[greet, weather],
llm_config={}
)
graph = IntentGraphBuilder().root(classifier).build()
result = graph.route("Hello Alice")
print(result.output) # → "Hello Alice!"
How it Works
- Define actions: Functions for each intent, with schemas.
- Build classifiers: Route input with rule-based, LLM, or custom logic.
- Build graphs: Combine everything into a tree.
- (Optional) Multi-intent: Use splitter nodes for "do X and Y" inputs.
- Context/state: Track session or app state in workflows.
See examples/ for more.
Eval API: Real-World, Dataset-Driven Testing
Test your intent graphs like real software, not just with unit tests.
intent-kit includes a first-class Eval API for benchmarking your workflows against real datasets—YAML or programmatic. It's built for LLM and intent pipeline evaluation, not just toy examples.
- Benchmark entire graphs or single nodes with real data and reproducible reports.
- Supports YAML or code datasets (inputs, expected outputs, optional context).
- Automatic reporting: Markdown, CSV, and JSON output—easy to share or integrate into CI.
- Mock mode for API-free, cheap testing.
- Tracks regressions over time with date-based and "latest" result archives.
Minimal eval example:
from intent_kit.evals import run_eval, load_dataset
from my_graph import my_node
dataset = load_dataset("intent_kit/evals/datasets/classifier_node_llm.yaml")
result = run_eval(dataset, my_node)
print(f"Accuracy: {result.accuracy():.1%}")
result.save_markdown("my_report.md")
Why care? Most "agent" and LLM frameworks are untestable black boxes. intent-kit is designed for serious, auditable workflow engineering.
API Highlights
action(...): Create a leaf node (executes your function, extracts arguments)llm_classifier(...): Classifier node using LLM or fallback rule-based logicIntentGraphBuilder(): Fluent graph assemblyrule_splitter_node(...),llm_splitter_node(...): Multi-intent inputIntentContext: Track and manage session/context stateevals: Run real dataset-driven benchmarks on your graph
Project Structure
intent-kit/
├── intent_kit/ # Library code
├── examples/ # Example scripts
├── tests/ # Unit tests
└── pyproject.toml # Build config
Development
git clone git@github.com:Stephen-Collins-tech/intent-kit.git
cd intent-kit
# Using pip:
pip install -e ".[dev]"
# Or using uv (recommended):
uv pip install -e ".[dev]"
pytest tests/
Documentation
License
MIT License
Project details
Release history Release notifications | RSS feed
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 intentkit_py-0.2.0.tar.gz.
File metadata
- Download URL: intentkit_py-0.2.0.tar.gz
- Upload date:
- Size: 88.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.7.20
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2a8bf611c3282fa55302f3792a561155bec6cb448f5054142e42af482995c42c
|
|
| MD5 |
f657dc1a380e748ec9baf750285b02a2
|
|
| BLAKE2b-256 |
fa5e8b35283afbefcf0626b4d98d60a9cc93e534ca6fcd82bb6660c462e088eb
|
File details
Details for the file intentkit_py-0.2.0-py3-none-any.whl.
File metadata
- Download URL: intentkit_py-0.2.0-py3-none-any.whl
- Upload date:
- Size: 102.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.7.20
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2189d87fc64720e613d7afdcd550b09c470e1b596144dfad17746e1df4dcc596
|
|
| MD5 |
aebf797868458c2cff45af9af4299d09
|
|
| BLAKE2b-256 |
c2f7795b8751398c549b45fd68b16d6c7fa716d7f366114f6ab031d9cbc8f591
|