Skip to main content

kader coding agent

Project description

Kader

Kader is an intelligent coding agent designed to assist with software development tasks. It provides a comprehensive framework for building AI-powered agents with advanced reasoning capabilities and tool integration.

Features

  • ๐Ÿค– AI-powered Code Assistance - Support for multiple LLM providers:
    • Ollama: Local LLM execution for privacy and speed.
    • Google Gemini: Cloud-based powerful models via the Google GenAI SDK.
  • ๐Ÿ–ฅ๏ธ Interactive CLI - Modern TUI interface built with Textual:
    • Lazy Loading: Efficient directory tree loading for large projects.
    • TODO Management: Integrated TODO list widget with automatic updates.
  • ๐Ÿ› ๏ธ Tool Integration - File system, command execution, web search, and more.
  • ๐Ÿง  Memory Management - State persistence, conversation history, and isolated sub-agent memory.
  • ๐Ÿ” Session Management - Save and load conversation sessions.
  • โŒจ๏ธ Keyboard Shortcuts - Efficient navigation and operations.
  • ๐Ÿ“ YAML Configuration - Agent configuration via YAML files.
  • ๐Ÿ”„ Planner-Executor Framework - Sophisticated reasoning and acting architecture using task planning and delegation.
  • ๐Ÿ—‚๏ธ File System Tools - Read, write, search, and edit files.
  • ๐Ÿค Agent-As-Tool - Spawn sub-agents for specific tasks with isolated memory and automated context aggregation.

Installation

Prerequisites

  • Python 3.11 or higher
  • Ollama (optional, for local LLMs)
  • uv package manager (recommended) or pip

Using uv (recommended)

# Clone the repository
git clone https://github.com/your-repo/kader.git
cd kader

# Install dependencies with uv
uv sync

# Run the CLI
uv run python -m cli

Using pip

# Clone the repository
git clone https://github.com/your-repo/kader.git
cd kader

# Install in development mode
pip install -e .

# Run the CLI
python -m cli

Quick Start

Running the CLI

# Run the Kader CLI using uv
uv run python -m cli

# Or using pip
python -m cli

First Steps in CLI

Once the CLI is running:

  1. Type any question to start chatting with the agent.
  2. Use /help to see available commands.
  3. Use /models to check available models from all providers.
  4. The directory tree on the left features lazy loading, expanding only when needed.
  5. The TODO list on the right tracks tasks identified by the planner.

Configuration

When the kader module is imported for the first time, it automatically creates a .kader directory in your home directory and a .env file.

Environment Variables

The application automatically loads environment variables from ~/.kader/.env:

  • OLLAMA_API_KEY: API key for Ollama service (if applicable).
  • GOOGLE_API_KEY: API key for Google Gemini (required for Google Provider).
  • Additional variables can be added to the .env file and will be automatically loaded.

Memory and Sessions

Kader stores data in ~/.kader/:

  • Sessions: ~/.kader/memory/sessions/
  • Configuration: ~/.kader/
  • Memory files: ~/.kader/memory/
  • Checkpoints: ~/.kader/memory/sessions/<session-id>/executors/ (Aggregated context from sub-agents)

CLI Commands

Command Description
/help Show command reference
/models Show available models (Ollama & Google)
/clear Clear conversation
/save Save current session
/load <id> Load a saved session
/sessions List saved sessions
/refresh Refresh file tree
/exit Exit the CLI

Keyboard Shortcuts

Shortcut Action
Ctrl+Q Quit
Ctrl+L Clear conversation
Ctrl+S Save session
Ctrl+R Refresh file tree
Tab Navigate panels

Project Structure

kader/
โ”œโ”€โ”€ cli/                    # Interactive command-line interface
โ”‚   โ”œโ”€โ”€ app.py             # Main application entry point
โ”‚   โ”œโ”€โ”€ app.tcss           # Textual CSS for styling
โ”‚   โ”œโ”€โ”€ llm_factory.py     # Provider selection logic
โ”‚   โ”œโ”€โ”€ widgets/           # Custom Textual widgets
โ”‚   โ”‚   โ”œโ”€โ”€ conversation.py # Chat display widget
โ”‚   โ”‚   โ”œโ”€โ”€ loading.py     # Loading spinner widget
โ”‚   โ”‚   โ”œโ”€โ”€ confirmation.py # Tool/model selection widgets
โ”‚   โ”‚   โ””โ”€โ”€ todo_list.py    # TODO tracking widget
โ”‚   โ””โ”€โ”€ README.md          # CLI documentation
โ”œโ”€โ”€ examples/              # Example implementations
โ”‚   โ”œโ”€โ”€ memory_example.py  # Memory management examples
โ”‚   โ”œโ”€โ”€ google_example.py  # Google Gemini provider examples
โ”‚   โ”œโ”€โ”€ planner_executor_example.py # Advanced workflow examples
โ”‚   โ””โ”€โ”€ README.md         # Examples documentation
โ”œโ”€โ”€ kader/                # Core framework
โ”‚   โ”œโ”€โ”€ agent/            # Agent implementations (Planning, ReAct)
โ”‚   โ”œโ”€โ”€ memory/           # Memory management & persistence
โ”‚   โ”œโ”€โ”€ providers/        # LLM providers (Ollama, Google)
โ”‚   โ”œโ”€โ”€ tools/            # Tools (File System, Web, Command, AgentTool)
โ”‚   โ”œโ”€โ”€ prompts/          # Prompt templates (Jinja2)
โ”‚   โ””โ”€โ”€ utils/            # Utilities (Checkpointer, ContextAggregator)
โ”œโ”€โ”€ pyproject.toml        # Project dependencies
โ”œโ”€โ”€ README.md             # This file
โ””โ”€โ”€ uv.lock               # Dependency lock file

Core Components

Agents

Kader provides a robust agent architecture:

  • ReActAgent: Reasoning and Acting agent that combines thoughts with actions.
  • PlanningAgent: High-level agent that breaks complex tasks into manageable plans.
  • BaseAgent: Abstract base class for creating custom agent behaviors.

LLM Providers

Kader supports multiple backends:

  • OllamaProvider: Connects to locally running Ollama instances.
  • GoogleProvider: High-performance access to Gemini models.

Agent-As-Tool (AgentTool)

The AgentTool allows a PlanningAgent (Architect) to delegate work to a ReActAgent (Worker). It features:

  • Persistent Memory: Sub-agent conversations are saved to JSON.
  • Context Aggregation: Sub-agent research and actions are automatically merged into the main session's checkpoint.md via ContextAggregator.

Memory Management

  • SlidingWindowConversationManager: Maintains context within token limits.
  • PersistentSlidingWindowConversationManager: Auto-saves sub-agent history.
  • Checkpointer: Generates markdown summaries of agent actions.

Development

Setting up for Development

# Clone the repository
git clone https://github.com/your-repo/kader.git
cd kader

# Install in development mode with uv
uv sync

# Run the CLI with hot reload for development
uv run textual run --dev cli.app:KaderApp

Running Tests

# Run tests with uv
uv run pytest

# Run tests with specific options
uv run pytest --verbose

Code Quality

Kader uses various tools for maintaining code quality:

# Run linter
uv run ruff check .

# Format code
uv run ruff format .

Troubleshooting

Common Issues

  • No models found: Ensure your providers are correctly configured. For Ollama, run ollama serve. For Google, ensure GOOGLE_API_KEY is set.
  • Connection errors: Verify internet access for cloud providers and local service availability for Ollama.

Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Add tests if applicable
  5. Run the test suite
  6. Submit a pull request

License

This project is licensed under the MIT License - see the LICENSE file for details.

Acknowledgments

  • Built with Textual for the beautiful CLI interface.
  • Uses Ollama for local LLM execution.
  • Powered by Google Gemini for advanced cloud-based reasoning.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

kader-2.2.1.tar.gz (958.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

kader-2.2.1-py3-none-any.whl (131.0 kB view details)

Uploaded Python 3

File details

Details for the file kader-2.2.1.tar.gz.

File metadata

  • Download URL: kader-2.2.1.tar.gz
  • Upload date:
  • Size: 958.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.0 {"installer":{"name":"uv","version":"0.10.0","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for kader-2.2.1.tar.gz
Algorithm Hash digest
SHA256 503793ea95e2e3cbe82bb70ae04f3958ead855fd8f906555ba72d14662515de2
MD5 435ac373280680bc28da71fcfb2e541c
BLAKE2b-256 129fdbd572fcbf15331af7e0a2c18cc22056ce243c2eb6673c66334fc85350fe

See more details on using hashes here.

File details

Details for the file kader-2.2.1-py3-none-any.whl.

File metadata

  • Download URL: kader-2.2.1-py3-none-any.whl
  • Upload date:
  • Size: 131.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.0 {"installer":{"name":"uv","version":"0.10.0","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for kader-2.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 22395b22cdc24ae9f81497f5c9b21a9c9167589b15e014126229cfe1f74e3dfe
MD5 8ad98122a4ad9d77f2a632e2a2e5b82d
BLAKE2b-256 068f98e8608d1c976b15ec8b8334395be4142b1faaaf4cf83c91e097e951972a

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page