Cheshire Cat AI Core: An AI Agent Microservice Framework

Summary
Cheshire Cat AI Core is an open-source framework designed for building custom AI agents as microservices. It offers an API-first approach, enabling easy integration of conversational layers into applications with WebSocket chat and a customizable REST API. Key features include built-in RAG with Qdrant, extensibility via plugins, function calling, and full Dockerization for straightforward deployment.
Repository Info
Introduction
Cheshire Cat AI Core is a robust, API-first framework for developing custom AI agents as microservices. Written in Python, it provides a comprehensive toolkit for integrating conversational AI capabilities into any application. The framework supports WebSocket for chat interactions and offers a customizable REST API for agent management, making it highly versatile for various use cases.
Key features include built-in Retrieval Augmented Generation (RAG) with Qdrant, a powerful plugin system for extensibility, and support for event callbacks, function calling (tools), and conversational forms. It also boasts an easy-to-use admin panel, multi-user support with granular permissions, and compatibility with any identity provider and language model via Langchain. The entire system is 100% Dockerized for effortless deployment.
Installation
Getting Cheshire Cat AI Core up and running on your machine is straightforward, requiring only Docker to be installed.
To quickly start the latest version, use the following command:
docker run --rm -it -p 1865:80 ghcr.io/cheshire-cat-ai/core:latest
Once running, you can interact with the Cheshire Cat:
- Chat with the Cheshire Cat on localhost:1865/admin
- Explore the REST API on localhost:1865/docs
For a more persistent setup with Docker Compose and volumes, refer to the official documentation.
Examples
Cheshire Cat AI Core provides powerful mechanisms for customizing agent behavior, including hooks, tools, and conversational forms.
Hooks (Events)
Hooks are an event system that allows for fine-grained control over your assistant's behavior at various stages of a conversation.
from cat.mad_hatter.decorators import hook
@hook
def agent_prompt_prefix(prefix, cat):
prefix = """You are Marvin the socks seller, a poetic vendor of socks.\nYou are an expert in socks, and you reply with exactly one rhyme.\n"""
return prefix
Tools (Function Calling)
Inspired by Langchain, tools enable your AI agent to perform specific actions or retrieve information by calling external functions.
from cat.mad_hatter.decorators import tool
@tool(return_direct=True)
def socks_prices(color, cat):
"""How much do socks cost? Input is the sock color."""
prices = {
"black": 5,
"white": 10,
"pink": 50,
}
price = prices.get(color, 0)
return f"{price} bucks, meeeow!"
Conversational Forms
Conversational forms allow you to guide goal-oriented conversations, collecting specific data from the user in a structured manner.
from pydantic import BaseModel
from cat.experimental.form import form, CatForm
# data structure to fill up
class PizzaOrder(BaseModel):
pizza_type: str
phone: int
# forms let you control goal oriented conversations
@form
class PizzaForm(CatForm):
description = "Pizza Order"
model_class = PizzaOrder
start_examples = [
"order a pizza!",
"I want pizza"
]
stop_examples = [
"stop pizza order",
"not hungry anymore",
]
ask_confirm = True
def submit(self, form_data):
# do the actual order here!
# return to convo
return {
"output": f"Pizza order on its way: {form_data}"
}
Why Use Cheshire Cat AI Core?
Cheshire Cat AI Core stands out as an excellent choice for building AI agents due to several compelling reasons:
- API-First Design: Easily integrate conversational layers into existing applications with its robust WebSocket and REST APIs.
- Extensibility: Customize and extend functionality through a powerful plugin system, hooks, and function calling capabilities.
- Built-in RAG: Leverage integrated Retrieval Augmented Generation with Qdrant for enhanced knowledge retrieval and context awareness.
- LLM Agnostic: Supports any language model via Langchain, offering flexibility in choosing your preferred AI backend.
- Simplified Deployment: Being 100% Dockerized, it ensures consistent and easy deployment across different environments.
- Active Community: Benefit from an active Discord community and comprehensive documentation.
Links
Explore more about Cheshire Cat AI Core through these official resources: