Kit

Kit is Bosca's AI agent — it builds intelligent agents with tools and routes conversations to the right specialist.

Kit is the AI agent orchestration layer that powers Bosca's conversational AI. It turns database-defined agent configurations into live, tool-equipped agents that can search content, query data, manage scripts, generate images, process documents, and more.

What Kit provides:

  • Dynamic agent construction from database definitions
  • A library of 40+ specialized tools spanning content, analytics, scripting, and media
  • Chat routing with session management and streaming responses
  • Extensibility via scripts and external MCP servers

How It Works

Kit builds agent hierarchies at runtime. When a chat message arrives, Kit:

  1. Loads the agent definition, model, and prompt from the database
  2. Resolves all configured tools from the DI container or as script-backed tools
  3. Connects any referenced MCP servers for external tool access
  4. Recursively builds sub-agents for delegation
  5. Runs the assembled agent with full conversation history and streams the response

Agents are not hard-coded---they are defined in the database. You can add, remove, or reconfigure agents and their tools without redeploying.

Tool Library

Kit includes a rich set of tools that give agents the ability to interact with the Bosca platform and beyond.

SQL & Analytics

Agents can explore and query analytics data through Trino with read-only access:

  • List Catalogs, Schemas, Tables: Discover available data sources
  • Describe Table: Inspect column names and types
  • Execute Query: Run SELECT queries against the analytics database
  • Search Query: Full-text and semantic search across platform content, respecting permissions

GraphQL

Agents can introspect and query the Bosca GraphQL API directly:

  • List Root Fields: Discover available queries and mutations
  • Get Type Definition: Inspect any GraphQL type
  • Search Schema: Find types and fields by keyword
  • Execute Query: Run arbitrary GraphQL queries with variables

Scripting

Full lifecycle management of platform scripts:

  • List, Get, Create, Edit, Delete: Manage script definitions
  • Execute, Validate: Run scripts and check syntax
  • Enable/Disable: Control script activation
  • Triggers (List, Add, Remove): Bind scripts to workflow events

Images

  • Generate Image: Create new images using AI models
  • Edit Image: Modify existing images with AI-assisted editing

PDF Processing

  • Extract Text: Pull text content from PDFs stored in Bosca
  • Extract Images: Pull embedded images from PDFs
  • PDF Info: Retrieve metadata (page count, dimensions, etc.)

Documents

  • Convert to Document: Transform content (such as HTML) into structured Bosca documents

Bible

Specialized tools for Bible content:

  • Get Available Bibles: List available translations
  • List Books: Enumerate books and chapters for a translation
  • Get Verses: Retrieve specific passages
  • Search References: Find passages by reference

Documentation

  • Search Documentation: Search indexed platform documentation

Client Interaction

  • Get Confirmation: Request user confirmation before proceeding with an action
  • Render Visualization: Display charts or visual data in the chat interface

Chat Dispatcher

The KitChatDispatcher is the entry point for AI chat. It handles:

  • Session management: Each conversation is tied to a user and session ID, with distributed locking to prevent concurrent processing of the same session
  • Attachment context: File and collection attachments on a session are injected as context so agents can reference them
  • Streaming responses: Responses stream in real time via Server-Sent Events, with status updates (streaming, completed, failed) dispatched throughout
  • MCP lifecycle: External MCP toolsets are connected at the start of a request and cleaned up when the request completes

Chat is accessible via SSE streaming at /api/v1/ai/chat.

Extending Kit

Script-Backed Tools

Any platform script can be exposed as an agent tool. When a tool references a script ID, Kit loads the script and wraps it as a tool that agents can call. This lets you add new agent capabilities without writing compiled code.

MCP Server Integration

Agents can connect to external MCP servers registered in the database. Kit loads the referenced MCP toolsets at request time, making third-party tools available alongside built-in ones.

Custom Tools

New compiled tools follow a simple pattern: extend AbstractTool<Input, Output> with serializable input/output types, implement a suspend execute function, and register the tool via the DI system. Tools automatically get access to the authenticated user context, database connections, and caching.

Package Installation

Kit ships as a package (kit v1.0.0) with three installers that run during platform setup:

  • Model Installer: Registers default AI models
  • Prompt Installer: Registers default system prompts
  • Agent Installer: Registers the Kit agent hierarchy with its tools and sub-agents

For developers

Related modules:

  • Kit orchestration: backend/kit
  • Agent system: backend/framework/ai
  • Core AI interfaces: backend/framework/core-ai
  • Scripting engine: backend/framework/scripting

Related: