Skip to main content

An open-source Python library for building intent classification and execution systems that work with any AI backend.

Project description

Intent Kit Logo

Intent Kit

Build intelligent workflows that understand what users want

CI Coverage Status Documentation PyPI


What is Intent Kit?

Intent Kit helps you build AI-powered applications that understand what users want and take the right actions. Think of it as a smart router that can:

  • Understand user requests using any AI model (OpenAI, Anthropic, Google, or your own)
  • Extract important details like names, dates, and preferences automatically
  • Take actions like sending messages, making calculations, or calling APIs
  • Handle complex requests that involve multiple steps
  • Keep track of conversations so your app remembers context

The best part? You stay in complete control. You define exactly what your app can do and how it should respond.


Why Intent Kit?

🎯 You're in Control

Define every possible action upfront. No surprises, no unexpected behavior.

🚀 Works with Any AI

Use OpenAI, Anthropic, Google, Ollama, or even simple rules. Mix and match as needed.

🔧 Easy to Build

Simple, clear API that feels natural to use. No complex abstractions to learn.

🧪 Testable & Reliable

Built-in testing tools let you verify your workflows work correctly before deploying.

📊 See What's Happening

Visualize your workflows and track exactly how decisions are made.


Quick Start

1. Install Intent Kit

pip install intentkit-py

For AI features, add your preferred provider:

pip install 'intentkit-py[openai]'    # OpenAI
pip install 'intentkit-py[anthropic]'  # Anthropic
pip install 'intentkit-py[all]'        # All providers

2. Build Your First Workflow

from intent_kit import IntentGraphBuilder, action, llm_classifier

# Define what your app can do
greet = action(
    name="greet",
    description="Greet the user by name",
    action_func=lambda name: f"Hello {name}!",
    param_schema={"name": str}
)

weather = action(
    name="weather",
    description="Get weather for a location",
    action_func=lambda city: f"Weather in {city}: 72°F, Sunny",
    param_schema={"city": str}
)

# Create a classifier to understand user requests
classifier = llm_classifier(
    name="main",
    children=[greet, weather],
    llm_config={"provider": "openai", "model": "gpt-3.5-turbo"}
)

# Build your workflow
graph = IntentGraphBuilder().root(classifier).build()

# Test it!
result = graph.route("Hello Alice")
print(result.output)  # → "Hello Alice!"

3. Try More Examples

# Get weather
result = graph.route("What's the weather in San Francisco?")
print(result.output)  # → "Weather in San Francisco: 72°F, Sunny"

# Handle multiple requests
result = graph.route("Greet Bob and check weather in NYC")
print(result.output)  # → Handles both requests!

How It Works

Intent Kit uses a simple but powerful pattern:

  1. Actions - Define what your app can do (send messages, make API calls, etc.)
  2. Classifiers - Understand what the user wants using AI or rules
  3. Graphs - Connect everything together into a workflow
  4. Context - Remember conversations and user preferences

The magic happens when a user sends a message:

  • The classifier figures out what they want
  • Intent Kit extracts the important details (names, locations, etc.)
  • The right action runs with those details
  • You get back a response

Real-World Testing

Most AI frameworks are black boxes that are hard to test. Intent Kit is different.

Test Your Workflows Like Real Software

from intent_kit.evals import run_eval, load_dataset

# Load test cases
dataset = load_dataset("tests/greeting_tests.yaml")

# Test your workflow
result = run_eval(dataset, graph)

print(f"Accuracy: {result.accuracy():.1%}")
result.save_report("test_results.md")

What You Can Test

  • Accuracy - Does your workflow understand requests correctly?
  • Performance - How fast does it respond?
  • Edge Cases - What happens with unusual inputs?
  • Regressions - Catch when changes break existing functionality

This means you can deploy with confidence, knowing your AI workflows work reliably.


Key Features

🧠 Smart Understanding

  • Works with any AI model (OpenAI, Anthropic, Google, Ollama)
  • Extracts parameters automatically (names, dates, preferences)
  • Handles complex, multi-step requests

🔄 Multi-Step Workflows

  • Chain actions together
  • Handle "do X and Y" requests
  • Remember context across conversations

🎨 Visualization

  • See your workflows as interactive diagrams
  • Track how decisions are made
  • Debug complex flows easily

🛠️ Developer Friendly

  • Simple, clear API
  • Comprehensive error handling
  • Built-in debugging tools
  • JSON configuration support

🧪 Testing & Evaluation

  • Test against real datasets
  • Measure accuracy and performance
  • Catch regressions automatically

Common Use Cases

🤖 Chatbots & Virtual Assistants

Build intelligent bots that understand natural language and take appropriate actions.

🔧 Task Automation

Automate complex workflows that require understanding user intent.

📊 Data Processing

Route and process information based on what users are asking for.

🎯 Decision Systems

Create systems that make smart decisions based on user requests.


Installation Options

# Basic installation (Python only)
pip install intentkit-py

# With specific AI providers
pip install 'intentkit-py[openai]'      # OpenAI
pip install 'intentkit-py[anthropic]'    # Anthropic
pip install 'intentkit-py[google]'       # Google AI
pip install 'intentkit-py[ollama]'       # Ollama

# Everything (all providers + tools)
pip install 'intentkit-py[all]'

# Development (includes testing tools)
pip install 'intentkit-py[dev]'

Project Structure

intent-kit/
├── intent_kit/        # Main library code
├── examples/          # Working examples
├── docs/             # Documentation
├── tests/            # Test suite
└── pyproject.toml    # Project configuration

Getting Help


Development & Contribution

Pre-commit Hooks & Version Management

This project uses pre-commit hooks to ensure code quality and version consistency:

  • Version Sync: The version in pyproject.toml is automatically synced to intent_kit/__init__.py on commit.
  • Changelog Check: Commits are blocked if the current version is not present in CHANGELOG.md.

To set up pre-commit hooks:

uv pip install pre-commit
uv run pre-commit install

Build, Test, and Lint

All development tasks use uv for fast, reproducible Python workflows.

  • Install dependencies:
    uv sync --group dev
    
  • Run tests:
    uv run pytest
    
  • Lint:
    uv run lint
    uv run black --check .
    uv run typecheck
    
  • Build package:
    uv build
    

GitHub Actions CI/CD

  • CI: Lint, typecheck, test, and evaluate using uv in GitHub Actions.
  • Deploy: On new tags, the package is built and published to PyPI, and documentation is deployed to Cloudflare Pages. (Publishing is handled by maintainers via CI/CD.)

Utility Scripts

See scripts/README.md for documentation on developer scripts, including automated changelog generation with intent-kit and LLMs.


Contributing

We welcome contributions! Here's how to get started:

git clone git@github.com:Stephen-Collins-tech/intent-kit.git
cd intent-kit
uv sync --group dev
uv run pytest

See our Contributing Guide for more details.


License

MIT License - feel free to use Intent Kit in your projects!

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

intentkit_py-0.4.0.tar.gz (95.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

intentkit_py-0.4.0-py3-none-any.whl (111.1 kB view details)

Uploaded Python 3

File details

Details for the file intentkit_py-0.4.0.tar.gz.

File metadata

  • Download URL: intentkit_py-0.4.0.tar.gz
  • Upload date:
  • Size: 95.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.8.3

File hashes

Hashes for intentkit_py-0.4.0.tar.gz
Algorithm Hash digest
SHA256 23385be8472935ceb2406b623263a9ebcb4d35c53a65522ee1a547f300535d2e
MD5 69595dd9421b08a7423ab8fa7152d47b
BLAKE2b-256 58f07f7610034e489580776ad11d6a05d5c24bcda5f45ec088e8b0569f66047e

See more details on using hashes here.

File details

Details for the file intentkit_py-0.4.0-py3-none-any.whl.

File metadata

File hashes

Hashes for intentkit_py-0.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d592af5388cf74716c55e2194b55c85c34d9fb132dad6592bfd6ed54bf9b24cc
MD5 12f9c680721272bfc3a9bbfd0a363ef8
BLAKE2b-256 a3ff8513f85443d2688fdd8046db521d5f106332665f1618dd7329ce211f85fe

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page