Metadata-Version: 2.4
Name: ckad-agent
Version: 0.3.0
Summary: A CKAD (Certified Kubernetes Application Developer) exam preparation assistant
Author-email: Abdessslem Amri <amriabdesslem@gmail.com>
License: MIT
Classifier: Programming Language :: Python :: 3
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Requires-Python: >=3.11
Description-Content-Type: text/markdown
Requires-Dist: pydantic>=2.0.0
Requires-Dist: pydantic-ai>=0.8.0
Requires-Dist: python-dotenv>=1.0.0
Requires-Dist: kubernetes>=28.0.0
Requires-Dist: requests>=2.31.0
Requires-Dist: typer>=0.16.1
Provides-Extra: dev
Requires-Dist: pytest>=7.0.0; extra == "dev"
Requires-Dist: pytest-asyncio>=0.21.0; extra == "dev"
Requires-Dist: black>=23.0.0; extra == "dev"
Requires-Dist: isort>=5.12.0; extra == "dev"
Requires-Dist: mypy>=1.0.0; extra == "dev"
Requires-Dist: pylint>=3.0.0; extra == "dev"
Requires-Dist: pytest-cov>=4.0.0; extra == "dev"

# CKAD Agent

A powerful AI-powered agent. This tool leverages large language models to help you understand, debug, and generate Kubernetes configurations.

## Features

- 🐛 Debug Kubernetes YAML manifests
- 📚 Explain Kubernetes concepts and best practices
- ✨ Generate valid Kubernetes YAML from requirements
- ✅ Validate and improve existing configurations

## Installation

1. Install the package:
   ```bash
   pip install ckad-agent
   ```

2. Create a `.env` file with your OpenAI API key:
   ```bash
   cp .env.example .env
   # Edit .env and add your OpenAI API key
   ```

## Usage

### Command Line Interface

The CKAD Agent provides a convenient CLI for common tasks:

```bash

# Debug issues in read-only mode
ckad debug "My pod in namespace default keeps crashing, fix it" --read-only

# Debug and correct issues (Project in development be carefull, do not use it in production environment)
ckad debug "My pod in namespace default keeps crashing, fix it" --no-read-only

# Explain a Kubernetes concept
ckad explain "How do I configure liveness and readiness probes?"

# Validate a YAML file
ckad validate deployment.yaml --resource Deployment
```

### Python API

```python
from ckad_agent import CkadAgent, CKADRequest, TaskType, KubernetesResourceType
import asyncio

async def main():
    agent = CkadAgent()
    
    # Example: Debug a YAML
    request = CKADRequest(
        task_type=TaskType.DEBUG,
        resource_type=KubernetesResourceType.POD,
        yaml_content="""
        apiVersion: v1
        kind: Pod
        metadata:
          name: my-pod
        spec:
          containers:
          - name: nginx
            image: nginx:latest
        """,
        question="Why isn't this pod starting?"
    )
    
    response = await agent.process_request(request)
    print(response.solution)

asyncio.run(main())
```

## Development with uv

### Prerequisites
- Install `uv` (if not already installed):
  ```bash
  curl -LsSf https://astral.sh/uv/install.sh | sh
  ```
  Or install via pip:
  ```bash
  pip install uv
  ```

### Setup and Development
1. Clone the repository
2. Create and activate a virtual environment:
   ```bash
   uv venv
   source .venv/bin/activate  # On macOS/Linux
   # .\.venv\Scripts\activate  # On Windows
   ```
3. Install the package in development mode with all dependencies:
   ```bash
   uv pip install -e ".[dev]"
   ```
4. Run tests:
   ```bash
   pytest
   ```

## License

MIT
