Skip to content

Welcome to Intent Kit

Intent Kit is a Python framework that helps you build intelligent applications using Directed Acyclic Graphs (DAGs) to understand what users want and take the right actions.

๐Ÿš€ Quick Start

Get up and running in minutes with our Quickstart Guide.

๐Ÿ“š Documentation

Core Concepts

Examples

Configuration

Services

Development

Utilities

  • Utilities - Type coercion, text processing, performance monitoring, logging, and reporting

API Reference

๐Ÿ› ๏ธ Installation

pip install intentkit-py  # Basic installation
pip install intentkit-py[openai]  # With OpenAI support
pip install intentkit-py[all]  # All AI providers

๐Ÿ’ก What Makes Intent Kit Special

  • ๐ŸŽฏ You're in Control - Define exactly what your app can do, no surprises
  • ๐Ÿง  Works with Any AI - OpenAI, Anthropic, Google, Ollama, or your own models
  • ๐Ÿ”ง Easy to Build - Simple, clear API that feels natural to use
  • ๐Ÿงช Testable & Reliable - Built-in testing tools for confidence
  • ๐Ÿ“Š See What's Happening - Visualize workflows and track decisions
  • ๐Ÿ”„ DAG Architecture - Flexible, scalable workflow design

๐ŸŽฏ Common Use Cases

๐Ÿค– Chatbots & Virtual Assistants

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

Example:

from intent_kit import DAGBuilder

# Create a chatbot that can greet users and answer questions
builder = DAGBuilder()
builder.add_node("classifier", "classifier",
                 output_labels=["greet", "question"],
                 description="Understand user intent")

# Add actions for different intents
builder.add_node("greet_action", "action",
                 action=lambda name: f"Hello {name}!",
                 description="Greet the user")

builder.add_node("answer_action", "action",
                 action=lambda question: f"I can help with: {question}",
                 description="Answer user questions")

๐Ÿ”ง Task Automation

Automate complex workflows that require understanding user intent.

Example:

# Automate customer support ticket routing
builder.add_node("ticket_classifier", "classifier",
                 output_labels=["bug", "feature", "billing"],
                 description="Classify support tickets")

builder.add_node("bug_handler", "action",
                 action=lambda details: f"Bug ticket created: {details}",
                 description="Handle bug reports")

๐Ÿ“Š Data Processing

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

Example:

# Process different types of data requests
builder.add_node("data_classifier", "classifier",
                 output_labels=["analytics", "export", "search"],
                 description="Classify data requests")

builder.add_node("analytics_action", "action",
                 action=lambda query: f"Analytics for: {query}",
                 description="Generate analytics")

๐ŸŽฏ Decision Systems

Create systems that make smart decisions based on user requests.

Example:

# Smart recommendation system
builder.add_node("preference_classifier", "classifier",
                 output_labels=["product", "service", "content"],
                 description="Understand user preferences")

builder.add_node("recommend_action", "action",
                 action=lambda category: f"Recommendations for {category}",
                 description="Generate recommendations")

๐Ÿš€ Key Features

Smart Understanding

  • Multi-Provider Support - Works with OpenAI, Anthropic, Google, Ollama, and more
  • Automatic Parameter Extraction - Extract names, dates, numbers, and complex objects
  • Intent Classification - Route requests to the right actions
  • Context Awareness - Remember previous interactions

DAG Configuration

  • JSON Definitions - Define complex workflows in JSON for easy management
  • Visual Workflows - Clear, understandable workflow structure
  • Flexible Routing - Support for conditional logic and error handling
  • Reusable Components - Share nodes across different workflows

Context Management

  • State Persistence - Maintain data across multiple interactions
  • Type Safety - Validate and coerce data types automatically
  • Audit Trails - Track all context modifications
  • Namespace Protection - Protect system keys from conflicts

Developer Friendly

  • Simple API - Intuitive builder pattern for creating workflows
  • Comprehensive Error Handling - Clear error messages and recovery strategies
  • Built-in Debugging - Detailed execution traces and logging
  • Testing Tools - Built-in evaluation framework for testing workflows

Testing & Evaluation

  • Test Against Real Data - Evaluate workflows with real user inputs
  • Performance Metrics - Track accuracy, response times, and costs
  • A/B Testing - Compare different workflow configurations
  • Continuous Monitoring - Monitor workflow performance in production

๐Ÿ—๏ธ Architecture Overview

Intent Kit uses a DAG-based architecture with four main node types:

Classifier Nodes

Understand user intent and route to appropriate paths.

classifier = ClassifierNode(
    name="main_classifier",
    description="Route user requests to appropriate actions",
    output_labels=["greet", "calculate", "weather"]
)

Extractor Nodes

Extract parameters from natural language using LLM.

extractor = ExtractorNode(
    name="name_extractor",
    description="Extract person's name from greeting",
    param_schema={"name": str}
)

Action Nodes

Execute specific actions and produce outputs.

action = ActionNode(
    name="greet_action",
    action=lambda name: f"Hello {name}!",
    description="Greet the user by name"
)

Clarification Nodes

Handle unclear intent by asking for clarification.

clarification = ClarificationNode(
    name="clarification",
    description="Handle unclear or ambiguous requests"
)

๐Ÿ”ง Getting Started

1. Install Intent Kit

# Basic installation
pip install intentkit-py

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

2. Set Up Your API Key

export OPENAI_API_KEY="your-openai-api-key"

3. Build Your First Workflow

from intent_kit import DAGBuilder, run_dag
from intent_kit.core.context import DefaultContext

# Define what your app can do
def greet(name: str) -> str:
    return f"Hello {name}!"

# Create a DAG
builder = DAGBuilder()
builder.with_default_llm_config({
    "provider": "openrouter",
    "model": "google/gemma-2-9b-it"
})

# Add nodes
builder.add_node("classifier", "classifier",
                 output_labels=["greet"],
                 description="Route to appropriate action")

builder.add_node("extract_name", "extractor",
                 param_schema={"name": str},
                 description="Extract name from greeting")

builder.add_node("greet_action", "action",
                 action=greet,
                 description="Greet the user")

# Connect the nodes
builder.add_edge("classifier", "extract_name", "greet")
builder.add_edge("extract_name", "greet_action", "success")
builder.set_entrypoints(["classifier"])

# Build and test
dag = builder.build()
context = DefaultContext()
result, final_context = run_dag(dag, "Hello Alice", context)
print(result.data)  # โ†’ "Hello Alice!"

๐Ÿ“– Learn More

๐Ÿค Contributing

We welcome contributions! Please see our Development Guide for:

  • Setting up your development environment
  • Running tests and linting
  • Contributing code changes
  • Documentation improvements

๐Ÿ“„ License

Intent Kit is licensed under the MIT License. See the LICENSE file for details.

๐Ÿ†˜ Need Help?


Ready to build intelligent applications? Start with our Quickstart Guide and see how easy it is to create AI-powered workflows with Intent Kit!


Built and maintained by Stephen Collins.tech LLC