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¶
- Intent DAGs - How to structure your workflows with DAGs
- Nodes and Actions - Building blocks for your applications
- Context Architecture - Managing state and memory
- Extractor Nodes - Parameter extraction using LLM services
- Clarification Nodes - Multi-turn conversation handling
Examples¶
- Basic Examples - Simple examples to get started
- Calculator Bot - Simple math operations
- Context-Aware Chatbot - Remembering conversations
- Context Memory Demo - Multi-turn conversations
- DAG Examples - Advanced DAG patterns and node reuse
Configuration¶
- JSON Serialization - Define workflows in JSON
- LLM Integration - OpenAI, Anthropic, Google, Ollama
Services¶
- AI Services - Comprehensive AI service integration
Development¶
- Building - How to build the package
- Testing - Unit tests and integration testing
- Evaluation - Performance evaluation and benchmarking
- Evaluation Framework - Comprehensive testing framework
- Debugging - Debugging tools and techniques
- Performance Monitoring - Performance tracking and reporting
Utilities¶
- Utilities - Type coercion, text processing, performance monitoring, logging, and reporting
API Reference¶
- Complete API Reference - Full API documentation
๐ ๏ธ 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¶
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¶
- Quickstart Guide - Get up and running fast
- Examples - See working examples
- Core Concepts - Understand the fundamentals
- API Reference - Complete API documentation
- Development - Testing, debugging, and deployment
๐ค 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?¶
- ๐ Full Documentation - Complete guides and API reference
- ๐ก Examples - Working examples to learn from
- ๐ GitHub Issues - Ask questions or report bugs
- ๐ฌ Discussions - Join the community
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