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 - Using Ollama for local LLM execution
- ๐ฅ๏ธ Interactive CLI - Modern TUI interface built with Textual
- ๐ ๏ธ Tool Integration - File system, command execution, web search, and more
- ๐ง Memory Management - State persistence and conversation history
- ๐ Session Management - Save and load conversation sessions
- ๐จ Theming - Multiple color themes for the CLI interface
- โจ๏ธ Keyboard Shortcuts - Efficient navigation and operations
- ๐ YAML Configuration - Agent configuration via YAML files
- ๐ ReAct Agent Framework - Reasoning and Acting agent architecture
- ๐๏ธ File System Tools - Read, write, search, and edit files
- ๐ Planning Agent - Task planning and execution capabilities
- ๐ค Agent-As-Tool - Spawn sub-agents for specific tasks with isolated memory
Installation
Prerequisites
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:
- Type any question to start chatting with the agent
- Use
/helpto see available commands - Use
/modelsto check available models - Use
/themeto cycle through color themes
Configuration
When the kader module is imported for the first time, it automatically:
- Creates a
.kaderdirectory in your home directory (~/.kaderon Unix systems,%USERPROFILE%\.kaderon Windows) - Creates a
.envfile with the required configuration (includingOLLAMA_API_KEY='') - Loads all environment variables from the
.envfile into the application environment
Environment Variables
The application automatically loads environment variables from ~/.kader/.env:
OLLAMA_API_KEY: API key for Ollama service (default: empty)- Additional variables can be added to the
.envfile and will be automatically loaded
Memory and Sessions
Kader stores data in ~/.kader/:
- Sessions:
~/.kader/sessions/ - Configuration:
~/.kader/ - Memory files:
~/.kader/memory/
CLI Commands
| Command | Description |
|---|---|
/help |
Show command reference |
/models |
Show available Ollama models |
/theme |
Cycle color themes |
/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+T |
Cycle theme |
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
โ โโโ utils.py # Utility functions and constants
โ โโโ widgets/ # Custom Textual widgets
โ โ โโโ conversation.py # Chat display widget
โ โ โโโ loading.py # Loading spinner widget
โ โ โโโ confirmation.py # Tool/model selection widgets
โ โโโ README.md # CLI documentation
โโโ examples/ # Example implementations
โ โโโ memory_example.py # Memory management examples
โ โโโ ollama_example.py # Ollama provider examples
โ โโโ react_agent_example.py # ReAct agent examples
โ โโโ planning_agent_example.py # Planning agent examples
โ โโโ python_developer/ # Python expert agent example
โ โโโ todo_agent/ # Todo management agent example
โ โโโ README.md # Examples documentation
โโโ kader/ # Core framework
โ โโโ agent/ # Agent implementations
โ โโโ memory/ # Memory management
โ โโโ providers/ # LLM providers
โ โโโ tools/ # Tools and utilities
โ โโโ prompts/ # Prompt templates
โโโ pyproject.toml # Project dependencies
โโโ README.md # This file
โโโ uv.lock # Dependency lock file
Core Components
Agents
Kader provides several agent types:
- ReActAgent: Reasoning and Acting agent that combines thoughts with actions
- PlanningAgent: Agent that plans multi-step tasks
- BaseAgent: Base agent class for creating custom agents
Agent-As-Tool (AgentTool)
The AgentTool allows you to wrap a ReActAgent as a callable tool, enabling agents to spawn sub-agents for specific tasks with isolated memory contexts.
from kader.tools import AgentTool
# Autonomous execution (runs without pausing for confirmation)
autonomous_agent = AgentTool(
name="research_agent",
description="Research topics autonomously",
interrupt_before_tool=False,
)
result = autonomous_agent.execute(task="Find info about topic X")
# Interactive execution (pauses for user confirmation before each tool)
def my_callback(tool_call_dict, llm_content=None):
user_input = input("Execute? [y/n]: ")
return (user_input.lower() == 'y', None)
interactive_agent = AgentTool(
name="interactive_agent",
interrupt_before_tool=True,
tool_confirmation_callback=my_callback,
)
result = interactive_agent.execute(task="Analyze data and generate report")
Key Features:
- Each sub-agent has isolated memory (separate
SlidingWindowConversationManager) - Default tools included: filesystem, web search, command executor
- Optional
interrupt_before_toolfor user confirmation before tool execution - Task completes when the agent returns its final response
Memory Management
Kader's memory system includes:
- AgentState: Persistent key-value storage for agents
- RequestState: Ephemeral request-scoped state
- FileSessionManager: Session persistence to disk
- SlidingWindowConversationManager: Conversation windowing
Tools
Kader includes a rich set of tools:
- File System Tools: Read, write, edit, search files
- Command Executor: Execute shell commands safely
- Web Tools: Search and fetch web content
- RAG Tools: Retrieval Augmented Generation capabilities
- AgentTool: Spawn sub-agents for specific tasks
Examples
Check out the examples directory for comprehensive demonstrations of Kader's features:
Basic Examples
memory_example.py: Shows memory management capabilitiesollama_example.py: Demonstrates how to use the Ollama provider for LLM interactionstools_example.py: Demonstrates the various tools available in Kadersimple_agent.py: Basic agent implementation example
Advanced Examples
react_agent_example.py: Interactive ReAct agent with tool integrationplanning_agent_example.py: Planning agent for multi-step taskspython_developer/: Specialized Python expert agent (YAML-configured)todo_agent/: Task management agent with TodoTool
Running Examples
Use uv to run examples:
uv run python -m examples.memory_example
uv run python -m examples.ollama_example
uv run python -m examples.tools_example
uv run python -m examples.react_agent_example
uv run python -m examples.python_developer.main
uv run python -m examples.todo_agent.main
Architecture
Agent Architecture
Kader uses a modular architecture where:
- Agents define the behavior and reasoning strategy
- Tools provide capabilities for external interactions
- Memory manages state and conversation history
- Providers handle LLM interactions
Tool Architecture
Tools in Kader follow a standardized interface:
- Each tool has a schema defining its inputs and outputs
- Tools can be registered in a ToolRegistry
- Tools can be executed synchronously or asynchronously
- Tools can be configured with parameters
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: Make sure Ollama is running and you have at least one model installed (e.g.,
ollama pull gpt-oss:120b-cloud) - Connection errors: Verify that Ollama service is accessible at the configured endpoint
- Theme not changing: Some terminal emulators may not support all color themes
Debugging
If you encounter issues:
- Check that Ollama is running:
ollama serve - Verify your model is pulled:
ollama list - Ensure your terminal supports the required features
- Check the logs for specific error messages
Contributing
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests if applicable
- Run the test suite
- Submit a pull request
License
This project is licensed under the MIT License - see the LICENSE file for details.
Acknowledgments
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file kader-1.0.0.tar.gz.
File metadata
- Download URL: kader-1.0.0.tar.gz
- Upload date:
- Size: 253.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.9.28 {"installer":{"name":"uv","version":"0.9.28","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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8a8b36b3b7e6f426c1118688006ca04d3e810634100ccfd2354f28b1df97e767
|
|
| MD5 |
d61b6fa090567ebbb31a4eb4674d0bac
|
|
| BLAKE2b-256 |
afc23f3527c8e49705d748ef777027c7eea75e4ecd2207de6416a5ab2b09c43e
|
File details
Details for the file kader-1.0.0-py3-none-any.whl.
File metadata
- Download URL: kader-1.0.0-py3-none-any.whl
- Upload date:
- Size: 112.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.9.28 {"installer":{"name":"uv","version":"0.9.28","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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f2daf10fc58c2b6454621f66a69eb0c0ff18b118eda0d104b83d5d19e03ea961
|
|
| MD5 |
2162805e10cf25be60acaa786cf08ae9
|
|
| BLAKE2b-256 |
38da0043b5cd37f199ad7c9fc53a58fe03ff0a350669703f1d3eabe47d092f2b
|