Skip to main content

Module kota_code

Module kota_code 

Source
Expand description

§Kota Code - AI Code Agent Library

Kota Code is a lightweight AI code agent library that provides a comprehensive set of tools for building AI-powered code assistants. It supports multiple LLM providers and comes with built-in file operations, code analysis, and task management capabilities.

§Quick Start

use kota::kota_code::{AgentBuilder, ContextManager, SkillManager};
use anyhow::Result;
#[tokio::main]
async fn main() -> Result<()> {
    // Create context and skill managers
    let context = ContextManager::new(".chat_sessions", "my-session".to_string())?;
    let skill_manager = SkillManager::new();
    // Create an agent instance with context and skills
    let agent_instance = AgentBuilder::new(
        "your-api-key".to_string(),
        "gpt-4".to_string()
    )?
    .with_context(context)
    .with_skill_manager(skill_manager)
    .build()?;
    // Access the agent, context, and skill manager
    // agent_instance.agent
    // agent_instance.context()
    // agent_instance.skill_manager()
    Ok(())
}

§Features

  • Multiple LLM Providers: OpenAI, Anthropic, DeepSeek, Cohere, Ollama
  • File Operations: Read, write, edit, delete files with built-in tools
  • Code Analysis: Scan codebase, grep search, pattern matching
  • Task Management: Plan mode with task dependencies and status tracking
  • Skills System: Specialized agent behaviors (code review, refactoring, debugging, documentation)
  • Context Management: Persistent conversation history with session support
  • Extensible: Easy to add custom tools and behaviors

Re-exports§

pub use agent::create_agent;
pub use agent::AgentBuilder;
pub use agent::AgentInstance;
pub use agent::AgentType;
pub use agent::Provider;
pub use context::ContextManager;
pub use context::SerializableMessage;
pub use context::SessionMetadata;
pub use mcp::client::McpClient;
pub use mcp::McpManager;
pub use plan::Plan;
pub use plan::PlanManager;
pub use plan::Task;
pub use plan::TaskStatus;
pub use runtime::CommandDef;
pub use runtime::KotaConfig;
pub use runtime::SessionIdHook;
pub use runtime::ToolRegistry;
pub use skills::Skill;
pub use skills::SkillManager;
pub use tools::FileToolError;
pub use tools::WrappedCreateDirectoryTool;
pub use tools::WrappedDeleteFileTool;
pub use tools::WrappedEditFileTool;
pub use tools::WrappedExecuteBashCommandTool;
pub use tools::WrappedGrepSearchTool;
pub use tools::WrappedReadFileTool;
pub use tools::WrappedScanCodebaseTool;
pub use tools::WrappedUpdatePlanTool;
pub use tools::WrappedWriteFileTool;

Modules§

agent
context
mcp
MCP (Model Context Protocol) Manager
plan
prelude
Prelude module for convenient imports
runtime
skills
tools