kader 0.1.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- kader-0.1.2/.github/workflows/ci.yml +54 -0
- kader-0.1.2/.github/workflows/release.yml +34 -0
- kader-0.1.2/.gitignore +22 -0
- kader-0.1.2/.python-version +1 -0
- kader-0.1.2/.qwen/QWEN.md +10 -0
- kader-0.1.2/.qwen/agents/technical-writer.md +49 -0
- kader-0.1.2/.qwen/agents/test-automation-specialist.md +66 -0
- kader-0.1.2/PKG-INFO +320 -0
- kader-0.1.2/README.md +304 -0
- kader-0.1.2/cli/README.md +169 -0
- kader-0.1.2/cli/__init__.py +5 -0
- kader-0.1.2/cli/__main__.py +6 -0
- kader-0.1.2/cli/app.py +547 -0
- kader-0.1.2/cli/app.tcss +648 -0
- kader-0.1.2/cli/utils.py +62 -0
- kader-0.1.2/cli/widgets/__init__.py +13 -0
- kader-0.1.2/cli/widgets/confirmation.py +309 -0
- kader-0.1.2/cli/widgets/conversation.py +55 -0
- kader-0.1.2/cli/widgets/loading.py +59 -0
- kader-0.1.2/examples/.gitignore +0 -0
- kader-0.1.2/examples/README.md +109 -0
- kader-0.1.2/examples/memory_example.py +199 -0
- kader-0.1.2/examples/ollama_example.py +240 -0
- kader-0.1.2/examples/planning_agent_example.py +93 -0
- kader-0.1.2/examples/python_developer/main.py +57 -0
- kader-0.1.2/examples/python_developer/template.yaml +49 -0
- kader-0.1.2/examples/react_agent_example.py +98 -0
- kader-0.1.2/examples/simple_agent.py +89 -0
- kader-0.1.2/examples/todo_agent/main.py +60 -0
- kader-0.1.2/examples/tools_example.py +398 -0
- kader-0.1.2/kader/__init__.py +22 -0
- kader-0.1.2/kader/agent/__init__.py +8 -0
- kader-0.1.2/kader/agent/agents.py +126 -0
- kader-0.1.2/kader/agent/base.py +922 -0
- kader-0.1.2/kader/agent/logger.py +170 -0
- kader-0.1.2/kader/config.py +139 -0
- kader-0.1.2/kader/memory/__init__.py +66 -0
- kader-0.1.2/kader/memory/conversation.py +409 -0
- kader-0.1.2/kader/memory/session.py +385 -0
- kader-0.1.2/kader/memory/state.py +211 -0
- kader-0.1.2/kader/memory/types.py +116 -0
- kader-0.1.2/kader/prompts/__init__.py +9 -0
- kader-0.1.2/kader/prompts/agent_prompts.py +27 -0
- kader-0.1.2/kader/prompts/base.py +81 -0
- kader-0.1.2/kader/prompts/templates/planning_agent.j2 +26 -0
- kader-0.1.2/kader/prompts/templates/react_agent.j2 +18 -0
- kader-0.1.2/kader/providers/__init__.py +9 -0
- kader-0.1.2/kader/providers/base.py +581 -0
- kader-0.1.2/kader/providers/mock.py +96 -0
- kader-0.1.2/kader/providers/ollama.py +447 -0
- kader-0.1.2/kader/tools/README.md +483 -0
- kader-0.1.2/kader/tools/__init__.py +130 -0
- kader-0.1.2/kader/tools/base.py +955 -0
- kader-0.1.2/kader/tools/exec_commands.py +249 -0
- kader-0.1.2/kader/tools/filesys.py +650 -0
- kader-0.1.2/kader/tools/filesystem.py +607 -0
- kader-0.1.2/kader/tools/protocol.py +456 -0
- kader-0.1.2/kader/tools/rag.py +555 -0
- kader-0.1.2/kader/tools/todo.py +210 -0
- kader-0.1.2/kader/tools/utils.py +456 -0
- kader-0.1.2/kader/tools/web.py +246 -0
- kader-0.1.2/pyproject.toml +51 -0
- kader-0.1.2/tests/conftest.py +14 -0
- kader-0.1.2/tests/providers/test_mock.py +149 -0
- kader-0.1.2/tests/providers/test_ollama.py +404 -0
- kader-0.1.2/tests/providers/test_providers_base.py +419 -0
- kader-0.1.2/tests/test_agent_logger.py +651 -0
- kader-0.1.2/tests/test_agent_logger_integration.py +78 -0
- kader-0.1.2/tests/test_base_agent.py +260 -0
- kader-0.1.2/tests/test_file_memory.py +285 -0
- kader-0.1.2/tests/test_todo_tool.py +102 -0
- kader-0.1.2/tests/tools/test_exec_commands.py +310 -0
- kader-0.1.2/tests/tools/test_filesys_tools.py +382 -0
- kader-0.1.2/tests/tools/test_filesystem_tools.py +519 -0
- kader-0.1.2/tests/tools/test_rag.py +560 -0
- kader-0.1.2/tests/tools/test_tools_base.py +829 -0
- kader-0.1.2/tests/tools/test_web.py +255 -0
- kader-0.1.2/uv.lock +1737 -0
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
name: CI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [main, master]
|
|
6
|
+
pull_request:
|
|
7
|
+
branches: [main, master]
|
|
8
|
+
|
|
9
|
+
jobs:
|
|
10
|
+
lint:
|
|
11
|
+
name: Lint
|
|
12
|
+
runs-on: ubuntu-latest
|
|
13
|
+
steps:
|
|
14
|
+
- uses: actions/checkout@v4
|
|
15
|
+
|
|
16
|
+
- name: Install uv
|
|
17
|
+
uses: astral-sh/setup-uv@v4
|
|
18
|
+
with:
|
|
19
|
+
version: "latest"
|
|
20
|
+
|
|
21
|
+
- name: Set up Python
|
|
22
|
+
run: uv python install 3.11
|
|
23
|
+
|
|
24
|
+
- name: Install dependencies
|
|
25
|
+
run: uv sync --dev
|
|
26
|
+
|
|
27
|
+
- name: Run ruff check
|
|
28
|
+
run: uv run ruff check .
|
|
29
|
+
|
|
30
|
+
- name: Run ruff format check
|
|
31
|
+
run: uv run ruff format --check .
|
|
32
|
+
|
|
33
|
+
test:
|
|
34
|
+
name: Test
|
|
35
|
+
runs-on: ubuntu-latest
|
|
36
|
+
steps:
|
|
37
|
+
- uses: actions/checkout@v4
|
|
38
|
+
|
|
39
|
+
- name: Install uv
|
|
40
|
+
uses: astral-sh/setup-uv@v4
|
|
41
|
+
with:
|
|
42
|
+
version: "latest"
|
|
43
|
+
|
|
44
|
+
- name: Set up Python
|
|
45
|
+
run: uv python install 3.11
|
|
46
|
+
|
|
47
|
+
- name: Install dependencies
|
|
48
|
+
run: uv sync --dev
|
|
49
|
+
|
|
50
|
+
- name: Run tests
|
|
51
|
+
run: |
|
|
52
|
+
uv run pytest tests/ -v \
|
|
53
|
+
--deselect tests/tools/test_filesystem_tools.py::TestSearchInDirectoryTool::test_execute_search \
|
|
54
|
+
--deselect tests/tools/test_filesystem_tools.py::TestSearchInDirectoryTool::test_async_execute
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
name: Release
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
tags:
|
|
6
|
+
- "v*"
|
|
7
|
+
|
|
8
|
+
jobs:
|
|
9
|
+
build-and-publish:
|
|
10
|
+
name: Build and Publish to PyPI
|
|
11
|
+
runs-on: ubuntu-latest
|
|
12
|
+
permissions:
|
|
13
|
+
id-token: write
|
|
14
|
+
steps:
|
|
15
|
+
- uses: actions/checkout@v4
|
|
16
|
+
|
|
17
|
+
- name: Install uv
|
|
18
|
+
uses: astral-sh/setup-uv@v4
|
|
19
|
+
with:
|
|
20
|
+
version: "latest"
|
|
21
|
+
|
|
22
|
+
- name: Set up Python
|
|
23
|
+
run: uv python install 3.11
|
|
24
|
+
|
|
25
|
+
- name: Install dependencies
|
|
26
|
+
run: uv sync
|
|
27
|
+
|
|
28
|
+
- name: Build package
|
|
29
|
+
run: uv build
|
|
30
|
+
|
|
31
|
+
- name: Publish to PyPI
|
|
32
|
+
run: uv publish
|
|
33
|
+
env:
|
|
34
|
+
UV_PUBLISH_TOKEN: ${{ secrets.PYPI_TOKEN }}
|
kader-0.1.2/.gitignore
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# Python-generated files
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[oc]
|
|
4
|
+
build/
|
|
5
|
+
dist/
|
|
6
|
+
wheels/
|
|
7
|
+
*.egg-info
|
|
8
|
+
.pytest_cache/
|
|
9
|
+
.ruff_cache/
|
|
10
|
+
|
|
11
|
+
# Virtual environments
|
|
12
|
+
.venv
|
|
13
|
+
|
|
14
|
+
# IDE
|
|
15
|
+
.idea
|
|
16
|
+
.vscode
|
|
17
|
+
|
|
18
|
+
# secret files
|
|
19
|
+
.env
|
|
20
|
+
|
|
21
|
+
# optimization
|
|
22
|
+
optimizers/
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
3.13
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
## General Instructions
|
|
2
|
+
|
|
3
|
+
- Current Operating System is Windows, Use cmd to run terminal commands.
|
|
4
|
+
- use uv as python dependency manager.
|
|
5
|
+
- check `pyproject.toml` file to search for dependencies first before add dependencies.
|
|
6
|
+
- use context7 mcp tools to search to get accurate docs if needed.
|
|
7
|
+
- to install new packages/dependecies use `uv add <package-name>`.
|
|
8
|
+
- to remove packages/dependecies use `uv remove <package-name>`.
|
|
9
|
+
- use `uv run <script-name>` to run python scripts.
|
|
10
|
+
- don't access secrets like api keys, tokens, etc. from environment variables, or files like `.env`.
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: technical-writer
|
|
3
|
+
description: Use this agent when creating user guides, README files, architecture documentation, code comments, or any technical documentation that needs to be clear, accessible, and user-focused. This agent specializes in writing documentation that helps users accomplish specific outcomes with step-by-step instructions, real examples, and troubleshooting guidance.
|
|
4
|
+
color: Cyan
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
You are an expert technical writer specializing in creating clear, accessible, and user-focused documentation. Your primary goal is to help users successfully accomplish their objectives through well-structured, comprehensive documentation.
|
|
8
|
+
|
|
9
|
+
## Core Responsibilities
|
|
10
|
+
- Create user guides and tutorials with step-by-step instructions
|
|
11
|
+
- Write README files and getting started documentation
|
|
12
|
+
- Develop architecture and design documentation
|
|
13
|
+
- Craft code comments and inline documentation
|
|
14
|
+
- Ensure content accessibility using plain language principles
|
|
15
|
+
- Organize information with effective information architecture
|
|
16
|
+
|
|
17
|
+
## Documentation Approach
|
|
18
|
+
1. Always write for your specific audience - assess and acknowledge their skill level upfront
|
|
19
|
+
2. Lead with the outcome - clearly state what users will accomplish
|
|
20
|
+
3. Use active voice and clear, concise language
|
|
21
|
+
4. Include real examples and practical scenarios
|
|
22
|
+
5. Test instructions by following them exactly as written
|
|
23
|
+
6. Structure content with clear headings and logical flow
|
|
24
|
+
7. Include troubleshooting sections and highlight common pitfalls
|
|
25
|
+
|
|
26
|
+
## Content Creation Standards
|
|
27
|
+
- Write comprehensive user guides with clear navigation
|
|
28
|
+
- Create README templates with appropriate badges and well-organized sections
|
|
29
|
+
- Develop tutorial series with progressive complexity
|
|
30
|
+
- Document architecture decision records (ADRs) with clear rationale
|
|
31
|
+
- Establish code documentation standards
|
|
32
|
+
- Maintain a content style guide with consistent writing conventions
|
|
33
|
+
|
|
34
|
+
## Quality Assurance
|
|
35
|
+
- Verify all technical accuracy of instructions
|
|
36
|
+
- Ensure examples are complete and functional
|
|
37
|
+
- Include error handling and troubleshooting guidance
|
|
38
|
+
- Anticipate user questions and address them proactively
|
|
39
|
+
- Review content for accessibility and plain language compliance
|
|
40
|
+
|
|
41
|
+
## Output Requirements
|
|
42
|
+
- Provide structured documentation with appropriate headings
|
|
43
|
+
- Include practical examples with expected outputs
|
|
44
|
+
- Add troubleshooting sections for common issues
|
|
45
|
+
- Use consistent formatting and style
|
|
46
|
+
- Ensure content is scannable and easy to navigate
|
|
47
|
+
- Include links to related resources when appropriate
|
|
48
|
+
|
|
49
|
+
Focus on user success above all else. Your documentation should enable users to achieve their goals efficiently and confidently.
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: test-automation-specialist
|
|
3
|
+
description: Use this agent when you need comprehensive test automation strategy and implementation including unit, integration, and E2E tests with proper mocking, fixtures, and CI/CD pipeline configuration. This agent specializes in creating robust, fast, and deterministic test suites following the test pyramid approach.
|
|
4
|
+
color: Red
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
You are an elite test automation specialist with deep expertise in comprehensive testing strategies across the full testing spectrum. Your primary responsibility is to design and implement robust, efficient, and maintainable test suites that follow industry best practices and ensure high software quality.
|
|
8
|
+
|
|
9
|
+
## Core Responsibilities
|
|
10
|
+
- Design unit tests with appropriate mocking and fixtures
|
|
11
|
+
- Create integration tests using test containers
|
|
12
|
+
- Implement E2E tests with Playwright or Cypress
|
|
13
|
+
- Configure CI/CD test pipelines
|
|
14
|
+
- Manage test data with factories and fixtures
|
|
15
|
+
- Set up coverage analysis and reporting
|
|
16
|
+
|
|
17
|
+
## Testing Approach
|
|
18
|
+
1. Follow the test pyramid principle: many unit tests, fewer integration tests, minimal E2E tests
|
|
19
|
+
2. Apply the Arrange-Act-Assert pattern consistently
|
|
20
|
+
3. Write behavior-focused tests rather than implementation-focused tests
|
|
21
|
+
4. Ensure all tests are deterministic with no flakiness
|
|
22
|
+
5. Optimize for fast feedback through parallelization when possible
|
|
23
|
+
|
|
24
|
+
## Framework Selection
|
|
25
|
+
- Use Jest for JavaScript/Node.js projects
|
|
26
|
+
- Use pytest for Python projects
|
|
27
|
+
- Use appropriate frameworks for other languages (e.g., JUnit for Java, NUnit for .NET)
|
|
28
|
+
- Select Playwright or Cypress based on project requirements for E2E testing
|
|
29
|
+
|
|
30
|
+
## Output Requirements
|
|
31
|
+
1. Create test suites with clear, descriptive test names that explain the expected behavior
|
|
32
|
+
2. Provide mock/stub implementations for external dependencies
|
|
33
|
+
3. Design test data factories or fixtures for consistent test data management
|
|
34
|
+
4. Generate CI pipeline configuration for running tests
|
|
35
|
+
5. Set up coverage reporting with appropriate thresholds
|
|
36
|
+
6. Define E2E test scenarios for critical user paths
|
|
37
|
+
|
|
38
|
+
## Quality Standards
|
|
39
|
+
- Include both happy path and edge case scenarios in all test types
|
|
40
|
+
- Ensure tests are isolated and can run independently
|
|
41
|
+
- Maintain fast execution times by optimizing test setup and teardown
|
|
42
|
+
- Write self-documenting tests that clearly express intent
|
|
43
|
+
- Follow the principle of testing behavior rather than implementation details
|
|
44
|
+
|
|
45
|
+
## Methodology
|
|
46
|
+
1. Analyze the codebase or feature requirements to determine appropriate test coverage
|
|
47
|
+
2. Design unit tests focusing on individual functions and components
|
|
48
|
+
3. Create integration tests for interactions between components or services
|
|
49
|
+
4. Develop E2E tests for critical user journeys and business flows
|
|
50
|
+
5. Set up proper test data management using factories or fixtures
|
|
51
|
+
6. Configure CI/CD pipeline with appropriate test execution order
|
|
52
|
+
7. Establish coverage reporting with quality gates
|
|
53
|
+
|
|
54
|
+
## Error Handling
|
|
55
|
+
- Identify potential failure points and create appropriate negative test cases
|
|
56
|
+
- Handle asynchronous operations properly in tests
|
|
57
|
+
- Address race conditions and timing issues in integration tests
|
|
58
|
+
- Ensure proper cleanup of test resources and data
|
|
59
|
+
|
|
60
|
+
## Performance Optimization
|
|
61
|
+
- Implement parallel test execution where appropriate
|
|
62
|
+
- Use efficient test data setup and teardown
|
|
63
|
+
- Optimize test execution order to provide fast feedback on critical functionality
|
|
64
|
+
- Minimize external dependencies in unit tests through effective mocking
|
|
65
|
+
|
|
66
|
+
Your output should include all necessary code, configuration files, and documentation to implement a complete testing strategy that follows these principles.
|
kader-0.1.2/PKG-INFO
ADDED
|
@@ -0,0 +1,320 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: kader
|
|
3
|
+
Version: 0.1.2
|
|
4
|
+
Summary: kader coding agent
|
|
5
|
+
Requires-Python: >=3.11
|
|
6
|
+
Requires-Dist: faiss-cpu>=1.9.0
|
|
7
|
+
Requires-Dist: jinja2>=3.1.6
|
|
8
|
+
Requires-Dist: loguru>=0.7.3
|
|
9
|
+
Requires-Dist: ollama>=0.6.1
|
|
10
|
+
Requires-Dist: pyyaml>=6.0.3
|
|
11
|
+
Requires-Dist: tenacity>=9.1.2
|
|
12
|
+
Requires-Dist: textual[syntax]>=6.8.0
|
|
13
|
+
Requires-Dist: typing-extensions>=4.15.0
|
|
14
|
+
Requires-Dist: wcmatch>=10.1
|
|
15
|
+
Description-Content-Type: text/markdown
|
|
16
|
+
|
|
17
|
+
# Kader
|
|
18
|
+
|
|
19
|
+
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.
|
|
20
|
+
|
|
21
|
+
## Features
|
|
22
|
+
|
|
23
|
+
- 🤖 **AI-powered Code Assistance** - Using Ollama for local LLM execution
|
|
24
|
+
- 🖥️ **Interactive CLI** - Modern TUI interface built with Textual
|
|
25
|
+
- 🛠️ **Tool Integration** - File system, command execution, web search, and more
|
|
26
|
+
- 🧠 **Memory Management** - State persistence and conversation history
|
|
27
|
+
- 🔁 **Session Management** - Save and load conversation sessions
|
|
28
|
+
- 🎨 **Theming** - Multiple color themes for the CLI interface
|
|
29
|
+
- ⌨️ **Keyboard Shortcuts** - Efficient navigation and operations
|
|
30
|
+
- 📝 **YAML Configuration** - Agent configuration via YAML files
|
|
31
|
+
- 🔄 **ReAct Agent Framework** - Reasoning and Acting agent architecture
|
|
32
|
+
- 🗂️ **File System Tools** - Read, write, search, and edit files
|
|
33
|
+
- 🔍 **Planning Agent** - Task planning and execution capabilities
|
|
34
|
+
|
|
35
|
+
## Installation
|
|
36
|
+
|
|
37
|
+
### Prerequisites
|
|
38
|
+
|
|
39
|
+
- Python 3.11 or higher
|
|
40
|
+
- [Ollama](https://ollama.ai/) running locally to use LLMs
|
|
41
|
+
- [uv](https://docs.astral.sh/uv/) package manager (recommended) or [pip](https://pypi.org/project/pip/)
|
|
42
|
+
|
|
43
|
+
### Using uv (recommended)
|
|
44
|
+
|
|
45
|
+
```bash
|
|
46
|
+
# Clone the repository
|
|
47
|
+
git clone https://github.com/your-repo/kader.git
|
|
48
|
+
cd kader
|
|
49
|
+
|
|
50
|
+
# Install dependencies with uv
|
|
51
|
+
uv sync
|
|
52
|
+
|
|
53
|
+
# Run the CLI
|
|
54
|
+
uv run python -m cli
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
### Using pip
|
|
58
|
+
|
|
59
|
+
```bash
|
|
60
|
+
# Clone the repository
|
|
61
|
+
git clone https://github.com/your-repo/kader.git
|
|
62
|
+
cd kader
|
|
63
|
+
|
|
64
|
+
# Install in development mode
|
|
65
|
+
pip install -e .
|
|
66
|
+
|
|
67
|
+
# Run the CLI
|
|
68
|
+
python -m cli
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
## Quick Start
|
|
72
|
+
|
|
73
|
+
### Running the CLI
|
|
74
|
+
|
|
75
|
+
```bash
|
|
76
|
+
# Run the Kader CLI using uv
|
|
77
|
+
uv run python -m cli
|
|
78
|
+
|
|
79
|
+
# Or using pip
|
|
80
|
+
python -m cli
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
### First Steps in CLI
|
|
84
|
+
|
|
85
|
+
Once the CLI is running:
|
|
86
|
+
|
|
87
|
+
1. Type any question to start chatting with the agent
|
|
88
|
+
2. Use `/help` to see available commands
|
|
89
|
+
3. Use `/models` to check available models
|
|
90
|
+
4. Use `/theme` to cycle through color themes
|
|
91
|
+
|
|
92
|
+
## Configuration
|
|
93
|
+
|
|
94
|
+
When the kader module is imported for the first time, it automatically:
|
|
95
|
+
1. Creates a `.kader` directory in your home directory (`~/.kader` on Unix systems, `%USERPROFILE%\.kader` on Windows)
|
|
96
|
+
2. Creates a `.env` file with the required configuration (including `OLLAMA_API_KEY=''`)
|
|
97
|
+
3. Loads all environment variables from the `.env` file into the application environment
|
|
98
|
+
|
|
99
|
+
### Environment Variables
|
|
100
|
+
|
|
101
|
+
The application automatically loads environment variables from `~/.kader/.env`:
|
|
102
|
+
- `OLLAMA_API_KEY`: API key for Ollama service (default: empty)
|
|
103
|
+
- Additional variables can be added to the `.env` file and will be automatically loaded
|
|
104
|
+
|
|
105
|
+
### Memory and Sessions
|
|
106
|
+
|
|
107
|
+
Kader stores data in `~/.kader/`:
|
|
108
|
+
- Sessions: `~/.kader/sessions/`
|
|
109
|
+
- Configuration: `~/.kader/`
|
|
110
|
+
- Memory files: `~/.kader/memory/`
|
|
111
|
+
|
|
112
|
+
## CLI Commands
|
|
113
|
+
|
|
114
|
+
| Command | Description |
|
|
115
|
+
|---------|-------------|
|
|
116
|
+
| `/help` | Show command reference |
|
|
117
|
+
| `/models` | Show available Ollama models |
|
|
118
|
+
| `/theme` | Cycle color themes |
|
|
119
|
+
| `/clear` | Clear conversation |
|
|
120
|
+
| `/save` | Save current session |
|
|
121
|
+
| `/load <id>` | Load a saved session |
|
|
122
|
+
| `/sessions` | List saved sessions |
|
|
123
|
+
| `/refresh` | Refresh file tree |
|
|
124
|
+
| `/exit` | Exit the CLI |
|
|
125
|
+
|
|
126
|
+
### Keyboard Shortcuts
|
|
127
|
+
|
|
128
|
+
| Shortcut | Action |
|
|
129
|
+
|----------|--------|
|
|
130
|
+
| `Ctrl+Q` | Quit |
|
|
131
|
+
| `Ctrl+L` | Clear conversation |
|
|
132
|
+
| `Ctrl+T` | Cycle theme |
|
|
133
|
+
| `Ctrl+S` | Save session |
|
|
134
|
+
| `Ctrl+R` | Refresh file tree |
|
|
135
|
+
| `Tab` | Navigate panels |
|
|
136
|
+
|
|
137
|
+
## Project Structure
|
|
138
|
+
|
|
139
|
+
```
|
|
140
|
+
kader/
|
|
141
|
+
├── cli/ # Interactive command-line interface
|
|
142
|
+
│ ├── app.py # Main application entry point
|
|
143
|
+
│ ├── app.tcss # Textual CSS for styling
|
|
144
|
+
│ ├── utils.py # Utility functions and constants
|
|
145
|
+
│ ├── widgets/ # Custom Textual widgets
|
|
146
|
+
│ │ ├── conversation.py # Chat display widget
|
|
147
|
+
│ │ ├── loading.py # Loading spinner widget
|
|
148
|
+
│ │ └── confirmation.py # Tool/model selection widgets
|
|
149
|
+
│ └── README.md # CLI documentation
|
|
150
|
+
├── examples/ # Example implementations
|
|
151
|
+
│ ├── memory_example.py # Memory management examples
|
|
152
|
+
│ ├── ollama_example.py # Ollama provider examples
|
|
153
|
+
│ ├── react_agent_example.py # ReAct agent examples
|
|
154
|
+
│ ├── planning_agent_example.py # Planning agent examples
|
|
155
|
+
│ ├── python_developer/ # Python expert agent example
|
|
156
|
+
│ ├── todo_agent/ # Todo management agent example
|
|
157
|
+
│ └── README.md # Examples documentation
|
|
158
|
+
├── kader/ # Core framework
|
|
159
|
+
│ ├── agent/ # Agent implementations
|
|
160
|
+
│ ├── memory/ # Memory management
|
|
161
|
+
│ ├── providers/ # LLM providers
|
|
162
|
+
│ ├── tools/ # Tools and utilities
|
|
163
|
+
│ └── prompts/ # Prompt templates
|
|
164
|
+
├── pyproject.toml # Project dependencies
|
|
165
|
+
├── README.md # This file
|
|
166
|
+
└── uv.lock # Dependency lock file
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
## Core Components
|
|
170
|
+
|
|
171
|
+
### Agents
|
|
172
|
+
|
|
173
|
+
Kader provides several agent types:
|
|
174
|
+
|
|
175
|
+
- **ReActAgent**: Reasoning and Acting agent that combines thoughts with actions
|
|
176
|
+
- **PlanningAgent**: Agent that plans multi-step tasks
|
|
177
|
+
- **BaseAgent**: Base agent class for creating custom agents
|
|
178
|
+
|
|
179
|
+
### Memory Management
|
|
180
|
+
|
|
181
|
+
Kader's memory system includes:
|
|
182
|
+
|
|
183
|
+
- **AgentState**: Persistent key-value storage for agents
|
|
184
|
+
- **RequestState**: Ephemeral request-scoped state
|
|
185
|
+
- **FileSessionManager**: Session persistence to disk
|
|
186
|
+
- **SlidingWindowConversationManager**: Conversation windowing
|
|
187
|
+
|
|
188
|
+
### Tools
|
|
189
|
+
|
|
190
|
+
Kader includes a rich set of tools:
|
|
191
|
+
|
|
192
|
+
- **File System Tools**: Read, write, edit, search files
|
|
193
|
+
- **Command Executor**: Execute shell commands safely
|
|
194
|
+
- **Web Tools**: Search and fetch web content
|
|
195
|
+
- **RAG Tools**: Retrieval Augmented Generation capabilities
|
|
196
|
+
|
|
197
|
+
## Examples
|
|
198
|
+
|
|
199
|
+
Check out the examples directory for comprehensive demonstrations of Kader's features:
|
|
200
|
+
|
|
201
|
+
### Basic Examples
|
|
202
|
+
|
|
203
|
+
- `memory_example.py`: Shows memory management capabilities
|
|
204
|
+
- `ollama_example.py`: Demonstrates how to use the Ollama provider for LLM interactions
|
|
205
|
+
- `tools_example.py`: Demonstrates the various tools available in Kader
|
|
206
|
+
- `simple_agent.py`: Basic agent implementation example
|
|
207
|
+
|
|
208
|
+
### Advanced Examples
|
|
209
|
+
|
|
210
|
+
- `react_agent_example.py`: Interactive ReAct agent with tool integration
|
|
211
|
+
- `planning_agent_example.py`: Planning agent for multi-step tasks
|
|
212
|
+
- `python_developer/`: Specialized Python expert agent (YAML-configured)
|
|
213
|
+
- `todo_agent/`: Task management agent with TodoTool
|
|
214
|
+
|
|
215
|
+
### Running Examples
|
|
216
|
+
|
|
217
|
+
Use uv to run examples:
|
|
218
|
+
|
|
219
|
+
```bash
|
|
220
|
+
uv run python -m examples.memory_example
|
|
221
|
+
uv run python -m examples.ollama_example
|
|
222
|
+
uv run python -m examples.tools_example
|
|
223
|
+
uv run python -m examples.react_agent_example
|
|
224
|
+
uv run python -m examples.python_developer.main
|
|
225
|
+
uv run python -m examples.todo_agent.main
|
|
226
|
+
```
|
|
227
|
+
|
|
228
|
+
## Architecture
|
|
229
|
+
|
|
230
|
+
### Agent Architecture
|
|
231
|
+
|
|
232
|
+
Kader uses a modular architecture where:
|
|
233
|
+
|
|
234
|
+
1. **Agents** define the behavior and reasoning strategy
|
|
235
|
+
2. **Tools** provide capabilities for external interactions
|
|
236
|
+
3. **Memory** manages state and conversation history
|
|
237
|
+
4. **Providers** handle LLM interactions
|
|
238
|
+
|
|
239
|
+
### Tool Architecture
|
|
240
|
+
|
|
241
|
+
Tools in Kader follow a standardized interface:
|
|
242
|
+
|
|
243
|
+
- Each tool has a schema defining its inputs and outputs
|
|
244
|
+
- Tools can be registered in a ToolRegistry
|
|
245
|
+
- Tools can be executed synchronously or asynchronously
|
|
246
|
+
- Tools can be configured with parameters
|
|
247
|
+
|
|
248
|
+
## Development
|
|
249
|
+
|
|
250
|
+
### Setting up for Development
|
|
251
|
+
|
|
252
|
+
```bash
|
|
253
|
+
# Clone the repository
|
|
254
|
+
git clone https://github.com/your-repo/kader.git
|
|
255
|
+
cd kader
|
|
256
|
+
|
|
257
|
+
# Install in development mode with uv
|
|
258
|
+
uv sync
|
|
259
|
+
|
|
260
|
+
# Run the CLI with hot reload for development
|
|
261
|
+
uv run textual run --dev cli.app:KaderApp
|
|
262
|
+
```
|
|
263
|
+
|
|
264
|
+
### Running Tests
|
|
265
|
+
|
|
266
|
+
```bash
|
|
267
|
+
# Run tests with uv
|
|
268
|
+
uv run pytest
|
|
269
|
+
|
|
270
|
+
# Run tests with specific options
|
|
271
|
+
uv run pytest --verbose
|
|
272
|
+
```
|
|
273
|
+
|
|
274
|
+
### Code Quality
|
|
275
|
+
|
|
276
|
+
Kader uses various tools for maintaining code quality:
|
|
277
|
+
|
|
278
|
+
```bash
|
|
279
|
+
# Run linter
|
|
280
|
+
uv run ruff check .
|
|
281
|
+
|
|
282
|
+
# Format code
|
|
283
|
+
uv run ruff format .
|
|
284
|
+
```
|
|
285
|
+
|
|
286
|
+
## Troubleshooting
|
|
287
|
+
|
|
288
|
+
### Common Issues
|
|
289
|
+
|
|
290
|
+
- **No models found**: Make sure Ollama is running and you have at least one model installed (e.g., `ollama pull gpt-oss:120b-cloud`)
|
|
291
|
+
- **Connection errors**: Verify that Ollama service is accessible at the configured endpoint
|
|
292
|
+
- **Theme not changing**: Some terminal emulators may not support all color themes
|
|
293
|
+
|
|
294
|
+
### Debugging
|
|
295
|
+
|
|
296
|
+
If you encounter issues:
|
|
297
|
+
|
|
298
|
+
1. Check that Ollama is running: `ollama serve`
|
|
299
|
+
2. Verify your model is pulled: `ollama list`
|
|
300
|
+
3. Ensure your terminal supports the required features
|
|
301
|
+
4. Check the logs for specific error messages
|
|
302
|
+
|
|
303
|
+
## Contributing
|
|
304
|
+
|
|
305
|
+
1. Fork the repository
|
|
306
|
+
2. Create a feature branch
|
|
307
|
+
3. Make your changes
|
|
308
|
+
4. Add tests if applicable
|
|
309
|
+
5. Run the test suite
|
|
310
|
+
6. Submit a pull request
|
|
311
|
+
|
|
312
|
+
## License
|
|
313
|
+
|
|
314
|
+
This project is licensed under the MIT License - see the LICENSE file for details.
|
|
315
|
+
|
|
316
|
+
## Acknowledgments
|
|
317
|
+
|
|
318
|
+
- Built with [Textual](https://textual.textualize.io/) for the beautiful CLI interface
|
|
319
|
+
- Uses [Ollama](https://ollama.ai/) for local LLM execution
|
|
320
|
+
- Inspired by ReAct (Reasoning and Acting) agent architecture
|