kei-agent-py-sdk


Namekei-agent-py-sdk JSON
Version 0.1.0b6 PyPI version JSON
download
home_pageNone
SummaryEnterprise-Grade Python SDK for Keiko-Personal-Assistant Platform with Multi-Protocol Support and Comprehensive Documentation
upload_time2025-08-19 16:13:21
maintainerNone
docs_urlNone
authorNone
requires_python>=3.8
licenseMIT
keywords ai agent multi-agent framework rpc stream bus mcp enterprise async distributed tracing monitoring resilience
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # KEI-Agent Python SDK

[![CI](https://github.com/oscharko-dev/kei-agent-py-sdk/actions/workflows/ci.yml/badge.svg)](https://github.com/oscharko-dev/kei-agent-py-sdk/actions/workflows/ci.yml)
[![Docs](https://github.com/oscharko-dev/kei-agent-py-sdk/actions/workflows/docs.yml/badge.svg)](https://github.com/oscharko-dev/kei-agent-py-sdk/actions/workflows/docs.yml)
[![Coverage](https://img.shields.io/badge/coverage-15%25-yellow.svg)](https://oscharko-dev.github.io/kei-agent-py-sdk/coverage/)
[![codecov](https://codecov.io/gh/oscharko-dev/kei-agent-py-sdk/branch/main/graph/badge.svg)](https://codecov.io/gh/oscharko-dev/kei-agent-py-sdk)
[![TestPyPI](https://img.shields.io/badge/TestPyPI-available-brightgreen.svg)](https://test.pypi.org/project/kei-agent-py-sdk/)
[![PyPI](https://img.shields.io/pypi/v/kei_agent_py_sdk.svg)](https://pypi.org/project/kei_agent_py_sdk/)
[![Python](https://img.shields.io/badge/python-3.8%2B-blue.svg)](https://pypi.org/project/kei_agent_py_sdk/)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
[![Documentation](https://img.shields.io/badge/docs-latest-brightgreen.svg)](https://oscharko-dev.github.io/kei-agent-py-sdk/)

**Enterprise-Grade Python SDK for KEI-Agent Framework with Multi-Protocol Support**

The KEI-Agent Python SDK provides a unified, typed API for developing intelligent agents with comprehensive protocol support, enterprise security, and production monitoring.

## ๐Ÿš€ Features

### Multi-Protocol Support

- **KEI-RPC**: Synchronous request-response operations
- **KEI-Stream**: Bidirectional real-time communication
- **KEI-Bus**: Asynchronous message bus integration
- **KEI-MCP**: Model Context Protocol for tool integration

### Enterprise Security

- **Multi-Auth**: Bearer Token, OIDC, mTLS
- **Input Validation**: Comprehensive sanitization and XSS/SQL injection protection
- **Audit Logging**: Complete traceability of all operations
- **RBAC**: Role-Based Access Control integration

### Production Monitoring

- **Structured Logging**: JSON format with correlation IDs
- **Health Checks**: Database, API, memory, custom checks
- **Performance Metrics**: Built-in timing and resource monitoring
- **Distributed Tracing**: OpenTelemetry integration

### Developer Experience

- **Type Safety**: 100% type hints for complete IntelliSense
- **Comprehensive Documentation**: Complete guides and API reference
- **Auto-Protocol Selection**: Intelligent protocol selection
- **Async-First**: Non-blocking I/O for maximum performance

## ๐Ÿ“ฆ Installation

### Installation from TestPyPI (Pre-Release)

```bash
pip install -i https://test.pypi.org/simple/ kei-agent-py-sdk
```

With extras (and fallback to PyPI for dependencies):

```bash
pip install -i https://test.pypi.org/simple/ \
  --extra-index-url https://pypi.org/simple/ \
  "kei-agent-py-sdk[security,docs]"
```

### Standard Installation

```bash
pip install kei_agent_py_sdk
```

### With Enterprise Features

```bash
pip install "kei_agent_py_sdk[security,docs]"
```

### Development Installation

```bash
git clone https://github.com/oscharko-dev/kei-agent-py-sdk.git
cd kei-agent-py-sdk
pip install -e ".[dev,docs,security]"
```

## โšก Quick Start

### Simple Agent Client

```python
import asyncio
import psutil
import requests
from kei_agent import (
    UnifiedKeiAgentClient,
    AgentClientConfig,
    CapabilityManager,
    CapabilityProfile
)

# 1. TOOL IMPLEMENTATION: System Monitor
async def system_monitor_tool(target: str, metrics: list) -> dict:
    """Real implementation for system metrics using psutil."""
    result = {}

    if "cpu" in metrics:
        result["cpu_percent"] = psutil.cpu_percent(interval=1)
    if "memory" in metrics:
        memory = psutil.virtual_memory()
        result["memory_percent"] = memory.percent
    if "disk" in metrics:
        disk = psutil.disk_usage('/')
        result["disk_percent"] = (disk.used / disk.total) * 100

    return {
        "target": target,
        "metrics": result,
        "status": "healthy" if all(v < 80 for v in result.values()) else "warning"
    }

# 2. TOOL IMPLEMENTATION: API Health Check
async def api_health_tool(endpoint: str) -> dict:
    """Checks API endpoint availability."""
    try:
        response = requests.get(endpoint, timeout=5)
        return {
            "endpoint": endpoint,
            "status_code": response.status_code,
            "response_time_ms": response.elapsed.total_seconds() * 1000,
            "status": "healthy" if response.status_code == 200 else "unhealthy"
        }
    except Exception as e:
        return {
            "endpoint": endpoint,
            "error": str(e),
            "status": "unhealthy"
        }

async def main():
    config = AgentClientConfig(
        base_url="https://api.kei-framework.com",
        api_token="your-api-token",
        agent_id="my-agent"
    )

    async with UnifiedKeiAgentClient(config=config) as client:
        # 3. REGISTER TOOLS
        capability_manager = CapabilityManager(client._legacy_client)

        # Register system monitor tool
        await capability_manager.register_capability(
            CapabilityProfile(
                name="system_monitor",
                version="1.0.0",
                description="Collects CPU, memory, disk metrics",
                methods={"get_metrics": {"parameters": ["target", "metrics"]}}
            ),
            handler=system_monitor_tool
        )

        # Register API health tool
        await capability_manager.register_capability(
            CapabilityProfile(
                name="api_health_checker",
                version="1.0.0",
                description="Checks API endpoint availability",
                methods={"check_endpoint": {"parameters": ["endpoint"]}}
            ),
            handler=api_health_tool
        )

        # 4. USE COMPLETE IMPLEMENTATION
        # Plan with concrete tools
        plan = await client.plan_task(
            objective="Perform complete system diagnosis",
            context={"tools": ["system_monitor", "api_health_checker"]}
        )
        print(f"Plan created: {plan['plan_id']}")

        # Get system metrics via registered tool
        system_data = await client.use_tool(
            "system_monitor",
            **{
                "target": "localhost",
                "metrics": ["cpu", "memory", "disk"]
            }
        )
        print(f"System metrics: {system_data}")

        # Check API health via registered tool
        api_data = await client.use_tool(
            "api_health_checker",
            **{"endpoint": "https://api.kei-framework.com/health"}
        )
        print(f"API status: {api_data['status']}")

asyncio.run(main())
```

### Multi-Protocol Features

```python
import asyncio
import time
from kei_agent import ProtocolType

async def multi_protocol_example():
    config = AgentClientConfig(
        base_url="https://api.kei-framework.com",
        api_token="your-api-token",
        agent_id="multi-protocol-agent"
    )

    async with UnifiedKeiAgentClient(config=config) as client:
        # Automatic protocol selection (RPC) - Correct API signature
        plan = await client.plan_task(
            objective="Discover available tools",
            context={"category": "monitoring", "max_results": 5}
        )
        print(f"Plan: {plan}")

        # Streaming: Use execute_agent_operation for stream operations
        stream_result = await client.execute_agent_operation(
            "stream_monitoring",
            {"data": "real-time-feed", "callback": True},
            protocol=ProtocolType.STREAM
        )
        print(f"Stream result: {stream_result}")

        # Tool discovery via MCP - Concrete implementable tools
        tools = await client.discover_available_tools("monitoring")
        print(f"Available tools: {len(tools)}")

        # Use available tool (if present)
        if tools:
            tool_result = await client.use_tool(
                tools[0]["name"],
                **{"target": "system", "check_type": "basic"}
            )
            print(f"Tool result: {tool_result}")

        # Asynchronous bus operation - Concrete implementation
        bus_result = await client.execute_agent_operation(
            "async_health_check",
            {
                "target_agent": "monitoring-agent",
                "message_type": "health_check_request",
                "payload": {"scope": "basic", "timeout": 30}
            },
            protocol=ProtocolType.BUS
        )
        print(f"Bus result: {bus_result}")

asyncio.run(multi_protocol_example())
```

### Enterprise Features

```python
import time
from kei_agent import (
    get_logger,
    get_health_manager,
    LogContext,
    APIHealthCheck,
    MemoryHealthCheck,
    HealthStatus
)

# Structured Logging
logger = get_logger("enterprise_agent")
# create_correlation_id() already sets the context
correlation_id = logger.create_correlation_id()
logger.set_context(LogContext(
    user_id="user-123",
    agent_id="enterprise-agent"
))

# Health Monitoring
health_manager = get_health_manager()
health_manager.register_check(APIHealthCheck(
    name="external_api",
    url="https://api.external.com/health"
))
health_manager.register_check(MemoryHealthCheck(
    name="system_memory",
    warning_threshold=0.8
))

async def enterprise_example():
    config = AgentClientConfig(
        base_url="https://api.kei-framework.com",
        api_token="your-api-token",
        agent_id="enterprise-agent"
    )

    async with UnifiedKeiAgentClient(config=config) as client:
        # Operation with logging
        operation_id = logger.log_operation_start("business_process")
        start_time = time.time()

        try:
            result = await client.plan_task("Enterprise task")
            logger.log_operation_end("business_process", operation_id, start_time, success=True)

            # Health Check
            summary = await health_manager.run_all_checks()
            logger.info(
                "Health check completed",
                overall_status=summary.overall_status.value,
                healthy_count=summary.healthy_count,
            )

        except Exception as e:
            logger.log_operation_end("business_process", operation_id, start_time, success=False)
            logger.error("Business process failed", error=str(e))
            raise

asyncio.run(enterprise_example())
```

## ๐Ÿ—๏ธ Architecture

The SDK follows a modular, enterprise-grade architecture:

```
kei_agent/
โ”œโ”€โ”€ unified_client.py               # Main API class
โ”œโ”€โ”€ protocol_types.py               # Type definitions and configurations
โ”œโ”€โ”€ security_manager.py             # Authentication and token management
โ”œโ”€โ”€ protocol_clients.py             # KEI-RPC, Stream, Bus, MCP clients
โ”œโ”€โ”€ protocol_selector.py            # Intelligent protocol selection
โ”œโ”€โ”€ enterprise_logging.py           # Structured JSON logging
โ”œโ”€โ”€ health_checks.py               # System monitoring and health checks
โ””โ”€โ”€ input_validation.py            # Input validation and sanitization
```

### Design Principles

- **Clean Code**: All modules โ‰ค200 lines, functions โ‰ค20 lines
- **Type Safety**: 100% type hints for all public APIs
- **Single Responsibility**: Each module has a clearly defined responsibility
- **Async-First**: Non-blocking I/O for maximum performance
- **Enterprise-Ready**: Production monitoring and security hardening

## ๐Ÿ“š Documentation

- **[Complete Documentation](https://oscharko-dev.github.io/kei-agent-py-sdk/)** - Comprehensive guides and API reference

## ๐Ÿ”ง Configuration

### Basic Configuration

```python
from kei_agent import AgentClientConfig, ProtocolConfig, SecurityConfig, AuthType

# Agent configuration
agent_config = AgentClientConfig(
    base_url="https://api.kei-framework.com",
    api_token="your-api-token",
    agent_id="my-agent",
    timeout=30,
    max_retries=3
)

# Protocol configuration
protocol_config = ProtocolConfig(
    rpc_enabled=True,
    stream_enabled=True,
    bus_enabled=True,
    mcp_enabled=True,
    auto_protocol_selection=True,
    protocol_fallback_enabled=True
)

# Security configuration
security_config = SecurityConfig(
    auth_type=AuthType.BEARER,
    api_token="your-api-token",
    rbac_enabled=True,
    audit_enabled=True
)

# Client with complete configuration
client = UnifiedKeiAgentClient(
    config=agent_config,
    protocol_config=protocol_config,
    security_config=security_config
)
```

### Environment Variables

```bash
export KEI_API_URL="https://api.kei-framework.com"
export KEI_API_TOKEN="your-api-token"
export KEI_AGENT_ID="my-agent"
export KEI_AUTH_TYPE="bearer"
export KEI_RBAC_ENABLED="true"
export KEI_AUDIT_ENABLED="true"
```

## ๐Ÿงช Testing

```bash
# Run unit tests
python -m pytest tests/ -v

# With coverage
python -m pytest tests/ --cov=kei_agent --cov-report=html

# Specific test categories
python -m pytest tests/ -m "unit"          # Unit tests
python -m pytest tests/ -m "integration"   # Integration tests
python -m pytest tests/ -m "security"      # Security tests

# Performance tests
python -m pytest tests/ -m "performance"
```

## ๐Ÿค Contributing

We welcome contributions! Please read our [Development Guide](docs/development/index.md) and [Contribution Guidelines](PRE_COMMIT_SETUP.md).

### Development Setup

```bash
# Clone repository
git clone https://github.com/oscharko-dev/kei-agent-py-sdk.git
cd kei-agent-py-sdk

# Set up development environment
python -m venv venv
source venv/bin/activate  # Linux/macOS
pip install -e ".[dev,docs,security]"

# Install pre-commit hooks
pre-commit install

# Run tests
make test

# Build documentation
mkdocs build --strict
```

## ๐Ÿ“„ License

This project is licensed under the [MIT License](LICENSE).

## ๐Ÿ”— Links

- **GitHub Repository**: [oscharko-dev/kei-agent-py-sdk](https://github.com/oscharko-dev/kei-agent-py-sdk)
- **TestPyPI Package**: [kei-agent-py-sdk](https://test.pypi.org/project/kei-agent-py-sdk/)
- **Documentation**: [GitHub Pages](https://oscharko-dev.github.io/kei-agent-py-sdk/)
- **Issues**: [GitHub Issues](https://github.com/oscharko-dev/kei-agent-py-sdk/issues)

## ๐Ÿ“Š Status

- โœ… **Production Ready**: Fully tested and documented
- โœ… **Type Safe**: 100% type hints for all APIs
- โœ… **Enterprise Grade**: Security, monitoring, and compliance features
- โœ… **Well Documented**: Comprehensive documentation
- โœ… **Actively Maintained**: Regular updates and support

---

**Ready to get started?** Install the SDK and follow our [Quick Start Guide](https://oscharko-dev.github.io/kei-agent-py-sdk/getting-started/quickstart/)!

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "kei-agent-py-sdk",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": "Oliver Scharkowski <o.scharkowski@oscharko.de>",
    "keywords": "ai, agent, multi-agent, framework, rpc, stream, bus, mcp, enterprise, async, distributed, tracing, monitoring, resilience",
    "author": null,
    "author_email": "Oliver Scharkowski <o.scharkowski@oscharko.de>",
    "download_url": "https://files.pythonhosted.org/packages/cb/c8/1fe0dd05e58e0108d1ef35623a0233c0996d6fc2bdec1789311d415b946e/kei_agent_py_sdk-0.1.0b6.tar.gz",
    "platform": null,
    "description": "# KEI-Agent Python SDK\n\n[![CI](https://github.com/oscharko-dev/kei-agent-py-sdk/actions/workflows/ci.yml/badge.svg)](https://github.com/oscharko-dev/kei-agent-py-sdk/actions/workflows/ci.yml)\n[![Docs](https://github.com/oscharko-dev/kei-agent-py-sdk/actions/workflows/docs.yml/badge.svg)](https://github.com/oscharko-dev/kei-agent-py-sdk/actions/workflows/docs.yml)\n[![Coverage](https://img.shields.io/badge/coverage-15%25-yellow.svg)](https://oscharko-dev.github.io/kei-agent-py-sdk/coverage/)\n[![codecov](https://codecov.io/gh/oscharko-dev/kei-agent-py-sdk/branch/main/graph/badge.svg)](https://codecov.io/gh/oscharko-dev/kei-agent-py-sdk)\n[![TestPyPI](https://img.shields.io/badge/TestPyPI-available-brightgreen.svg)](https://test.pypi.org/project/kei-agent-py-sdk/)\n[![PyPI](https://img.shields.io/pypi/v/kei_agent_py_sdk.svg)](https://pypi.org/project/kei_agent_py_sdk/)\n[![Python](https://img.shields.io/badge/python-3.8%2B-blue.svg)](https://pypi.org/project/kei_agent_py_sdk/)\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\n[![Documentation](https://img.shields.io/badge/docs-latest-brightgreen.svg)](https://oscharko-dev.github.io/kei-agent-py-sdk/)\n\n**Enterprise-Grade Python SDK for KEI-Agent Framework with Multi-Protocol Support**\n\nThe KEI-Agent Python SDK provides a unified, typed API for developing intelligent agents with comprehensive protocol support, enterprise security, and production monitoring.\n\n## \ud83d\ude80 Features\n\n### Multi-Protocol Support\n\n- **KEI-RPC**: Synchronous request-response operations\n- **KEI-Stream**: Bidirectional real-time communication\n- **KEI-Bus**: Asynchronous message bus integration\n- **KEI-MCP**: Model Context Protocol for tool integration\n\n### Enterprise Security\n\n- **Multi-Auth**: Bearer Token, OIDC, mTLS\n- **Input Validation**: Comprehensive sanitization and XSS/SQL injection protection\n- **Audit Logging**: Complete traceability of all operations\n- **RBAC**: Role-Based Access Control integration\n\n### Production Monitoring\n\n- **Structured Logging**: JSON format with correlation IDs\n- **Health Checks**: Database, API, memory, custom checks\n- **Performance Metrics**: Built-in timing and resource monitoring\n- **Distributed Tracing**: OpenTelemetry integration\n\n### Developer Experience\n\n- **Type Safety**: 100% type hints for complete IntelliSense\n- **Comprehensive Documentation**: Complete guides and API reference\n- **Auto-Protocol Selection**: Intelligent protocol selection\n- **Async-First**: Non-blocking I/O for maximum performance\n\n## \ud83d\udce6 Installation\n\n### Installation from TestPyPI (Pre-Release)\n\n```bash\npip install -i https://test.pypi.org/simple/ kei-agent-py-sdk\n```\n\nWith extras (and fallback to PyPI for dependencies):\n\n```bash\npip install -i https://test.pypi.org/simple/ \\\n  --extra-index-url https://pypi.org/simple/ \\\n  \"kei-agent-py-sdk[security,docs]\"\n```\n\n### Standard Installation\n\n```bash\npip install kei_agent_py_sdk\n```\n\n### With Enterprise Features\n\n```bash\npip install \"kei_agent_py_sdk[security,docs]\"\n```\n\n### Development Installation\n\n```bash\ngit clone https://github.com/oscharko-dev/kei-agent-py-sdk.git\ncd kei-agent-py-sdk\npip install -e \".[dev,docs,security]\"\n```\n\n## \u26a1 Quick Start\n\n### Simple Agent Client\n\n```python\nimport asyncio\nimport psutil\nimport requests\nfrom kei_agent import (\n    UnifiedKeiAgentClient,\n    AgentClientConfig,\n    CapabilityManager,\n    CapabilityProfile\n)\n\n# 1. TOOL IMPLEMENTATION: System Monitor\nasync def system_monitor_tool(target: str, metrics: list) -> dict:\n    \"\"\"Real implementation for system metrics using psutil.\"\"\"\n    result = {}\n\n    if \"cpu\" in metrics:\n        result[\"cpu_percent\"] = psutil.cpu_percent(interval=1)\n    if \"memory\" in metrics:\n        memory = psutil.virtual_memory()\n        result[\"memory_percent\"] = memory.percent\n    if \"disk\" in metrics:\n        disk = psutil.disk_usage('/')\n        result[\"disk_percent\"] = (disk.used / disk.total) * 100\n\n    return {\n        \"target\": target,\n        \"metrics\": result,\n        \"status\": \"healthy\" if all(v < 80 for v in result.values()) else \"warning\"\n    }\n\n# 2. TOOL IMPLEMENTATION: API Health Check\nasync def api_health_tool(endpoint: str) -> dict:\n    \"\"\"Checks API endpoint availability.\"\"\"\n    try:\n        response = requests.get(endpoint, timeout=5)\n        return {\n            \"endpoint\": endpoint,\n            \"status_code\": response.status_code,\n            \"response_time_ms\": response.elapsed.total_seconds() * 1000,\n            \"status\": \"healthy\" if response.status_code == 200 else \"unhealthy\"\n        }\n    except Exception as e:\n        return {\n            \"endpoint\": endpoint,\n            \"error\": str(e),\n            \"status\": \"unhealthy\"\n        }\n\nasync def main():\n    config = AgentClientConfig(\n        base_url=\"https://api.kei-framework.com\",\n        api_token=\"your-api-token\",\n        agent_id=\"my-agent\"\n    )\n\n    async with UnifiedKeiAgentClient(config=config) as client:\n        # 3. REGISTER TOOLS\n        capability_manager = CapabilityManager(client._legacy_client)\n\n        # Register system monitor tool\n        await capability_manager.register_capability(\n            CapabilityProfile(\n                name=\"system_monitor\",\n                version=\"1.0.0\",\n                description=\"Collects CPU, memory, disk metrics\",\n                methods={\"get_metrics\": {\"parameters\": [\"target\", \"metrics\"]}}\n            ),\n            handler=system_monitor_tool\n        )\n\n        # Register API health tool\n        await capability_manager.register_capability(\n            CapabilityProfile(\n                name=\"api_health_checker\",\n                version=\"1.0.0\",\n                description=\"Checks API endpoint availability\",\n                methods={\"check_endpoint\": {\"parameters\": [\"endpoint\"]}}\n            ),\n            handler=api_health_tool\n        )\n\n        # 4. USE COMPLETE IMPLEMENTATION\n        # Plan with concrete tools\n        plan = await client.plan_task(\n            objective=\"Perform complete system diagnosis\",\n            context={\"tools\": [\"system_monitor\", \"api_health_checker\"]}\n        )\n        print(f\"Plan created: {plan['plan_id']}\")\n\n        # Get system metrics via registered tool\n        system_data = await client.use_tool(\n            \"system_monitor\",\n            **{\n                \"target\": \"localhost\",\n                \"metrics\": [\"cpu\", \"memory\", \"disk\"]\n            }\n        )\n        print(f\"System metrics: {system_data}\")\n\n        # Check API health via registered tool\n        api_data = await client.use_tool(\n            \"api_health_checker\",\n            **{\"endpoint\": \"https://api.kei-framework.com/health\"}\n        )\n        print(f\"API status: {api_data['status']}\")\n\nasyncio.run(main())\n```\n\n### Multi-Protocol Features\n\n```python\nimport asyncio\nimport time\nfrom kei_agent import ProtocolType\n\nasync def multi_protocol_example():\n    config = AgentClientConfig(\n        base_url=\"https://api.kei-framework.com\",\n        api_token=\"your-api-token\",\n        agent_id=\"multi-protocol-agent\"\n    )\n\n    async with UnifiedKeiAgentClient(config=config) as client:\n        # Automatic protocol selection (RPC) - Correct API signature\n        plan = await client.plan_task(\n            objective=\"Discover available tools\",\n            context={\"category\": \"monitoring\", \"max_results\": 5}\n        )\n        print(f\"Plan: {plan}\")\n\n        # Streaming: Use execute_agent_operation for stream operations\n        stream_result = await client.execute_agent_operation(\n            \"stream_monitoring\",\n            {\"data\": \"real-time-feed\", \"callback\": True},\n            protocol=ProtocolType.STREAM\n        )\n        print(f\"Stream result: {stream_result}\")\n\n        # Tool discovery via MCP - Concrete implementable tools\n        tools = await client.discover_available_tools(\"monitoring\")\n        print(f\"Available tools: {len(tools)}\")\n\n        # Use available tool (if present)\n        if tools:\n            tool_result = await client.use_tool(\n                tools[0][\"name\"],\n                **{\"target\": \"system\", \"check_type\": \"basic\"}\n            )\n            print(f\"Tool result: {tool_result}\")\n\n        # Asynchronous bus operation - Concrete implementation\n        bus_result = await client.execute_agent_operation(\n            \"async_health_check\",\n            {\n                \"target_agent\": \"monitoring-agent\",\n                \"message_type\": \"health_check_request\",\n                \"payload\": {\"scope\": \"basic\", \"timeout\": 30}\n            },\n            protocol=ProtocolType.BUS\n        )\n        print(f\"Bus result: {bus_result}\")\n\nasyncio.run(multi_protocol_example())\n```\n\n### Enterprise Features\n\n```python\nimport time\nfrom kei_agent import (\n    get_logger,\n    get_health_manager,\n    LogContext,\n    APIHealthCheck,\n    MemoryHealthCheck,\n    HealthStatus\n)\n\n# Structured Logging\nlogger = get_logger(\"enterprise_agent\")\n# create_correlation_id() already sets the context\ncorrelation_id = logger.create_correlation_id()\nlogger.set_context(LogContext(\n    user_id=\"user-123\",\n    agent_id=\"enterprise-agent\"\n))\n\n# Health Monitoring\nhealth_manager = get_health_manager()\nhealth_manager.register_check(APIHealthCheck(\n    name=\"external_api\",\n    url=\"https://api.external.com/health\"\n))\nhealth_manager.register_check(MemoryHealthCheck(\n    name=\"system_memory\",\n    warning_threshold=0.8\n))\n\nasync def enterprise_example():\n    config = AgentClientConfig(\n        base_url=\"https://api.kei-framework.com\",\n        api_token=\"your-api-token\",\n        agent_id=\"enterprise-agent\"\n    )\n\n    async with UnifiedKeiAgentClient(config=config) as client:\n        # Operation with logging\n        operation_id = logger.log_operation_start(\"business_process\")\n        start_time = time.time()\n\n        try:\n            result = await client.plan_task(\"Enterprise task\")\n            logger.log_operation_end(\"business_process\", operation_id, start_time, success=True)\n\n            # Health Check\n            summary = await health_manager.run_all_checks()\n            logger.info(\n                \"Health check completed\",\n                overall_status=summary.overall_status.value,\n                healthy_count=summary.healthy_count,\n            )\n\n        except Exception as e:\n            logger.log_operation_end(\"business_process\", operation_id, start_time, success=False)\n            logger.error(\"Business process failed\", error=str(e))\n            raise\n\nasyncio.run(enterprise_example())\n```\n\n## \ud83c\udfd7\ufe0f Architecture\n\nThe SDK follows a modular, enterprise-grade architecture:\n\n```\nkei_agent/\n\u251c\u2500\u2500 unified_client.py               # Main API class\n\u251c\u2500\u2500 protocol_types.py               # Type definitions and configurations\n\u251c\u2500\u2500 security_manager.py             # Authentication and token management\n\u251c\u2500\u2500 protocol_clients.py             # KEI-RPC, Stream, Bus, MCP clients\n\u251c\u2500\u2500 protocol_selector.py            # Intelligent protocol selection\n\u251c\u2500\u2500 enterprise_logging.py           # Structured JSON logging\n\u251c\u2500\u2500 health_checks.py               # System monitoring and health checks\n\u2514\u2500\u2500 input_validation.py            # Input validation and sanitization\n```\n\n### Design Principles\n\n- **Clean Code**: All modules \u2264200 lines, functions \u226420 lines\n- **Type Safety**: 100% type hints for all public APIs\n- **Single Responsibility**: Each module has a clearly defined responsibility\n- **Async-First**: Non-blocking I/O for maximum performance\n- **Enterprise-Ready**: Production monitoring and security hardening\n\n## \ud83d\udcda Documentation\n\n- **[Complete Documentation](https://oscharko-dev.github.io/kei-agent-py-sdk/)** - Comprehensive guides and API reference\n\n## \ud83d\udd27 Configuration\n\n### Basic Configuration\n\n```python\nfrom kei_agent import AgentClientConfig, ProtocolConfig, SecurityConfig, AuthType\n\n# Agent configuration\nagent_config = AgentClientConfig(\n    base_url=\"https://api.kei-framework.com\",\n    api_token=\"your-api-token\",\n    agent_id=\"my-agent\",\n    timeout=30,\n    max_retries=3\n)\n\n# Protocol configuration\nprotocol_config = ProtocolConfig(\n    rpc_enabled=True,\n    stream_enabled=True,\n    bus_enabled=True,\n    mcp_enabled=True,\n    auto_protocol_selection=True,\n    protocol_fallback_enabled=True\n)\n\n# Security configuration\nsecurity_config = SecurityConfig(\n    auth_type=AuthType.BEARER,\n    api_token=\"your-api-token\",\n    rbac_enabled=True,\n    audit_enabled=True\n)\n\n# Client with complete configuration\nclient = UnifiedKeiAgentClient(\n    config=agent_config,\n    protocol_config=protocol_config,\n    security_config=security_config\n)\n```\n\n### Environment Variables\n\n```bash\nexport KEI_API_URL=\"https://api.kei-framework.com\"\nexport KEI_API_TOKEN=\"your-api-token\"\nexport KEI_AGENT_ID=\"my-agent\"\nexport KEI_AUTH_TYPE=\"bearer\"\nexport KEI_RBAC_ENABLED=\"true\"\nexport KEI_AUDIT_ENABLED=\"true\"\n```\n\n## \ud83e\uddea Testing\n\n```bash\n# Run unit tests\npython -m pytest tests/ -v\n\n# With coverage\npython -m pytest tests/ --cov=kei_agent --cov-report=html\n\n# Specific test categories\npython -m pytest tests/ -m \"unit\"          # Unit tests\npython -m pytest tests/ -m \"integration\"   # Integration tests\npython -m pytest tests/ -m \"security\"      # Security tests\n\n# Performance tests\npython -m pytest tests/ -m \"performance\"\n```\n\n## \ud83e\udd1d Contributing\n\nWe welcome contributions! Please read our [Development Guide](docs/development/index.md) and [Contribution Guidelines](PRE_COMMIT_SETUP.md).\n\n### Development Setup\n\n```bash\n# Clone repository\ngit clone https://github.com/oscharko-dev/kei-agent-py-sdk.git\ncd kei-agent-py-sdk\n\n# Set up development environment\npython -m venv venv\nsource venv/bin/activate  # Linux/macOS\npip install -e \".[dev,docs,security]\"\n\n# Install pre-commit hooks\npre-commit install\n\n# Run tests\nmake test\n\n# Build documentation\nmkdocs build --strict\n```\n\n## \ud83d\udcc4 License\n\nThis project is licensed under the [MIT License](LICENSE).\n\n## \ud83d\udd17 Links\n\n- **GitHub Repository**: [oscharko-dev/kei-agent-py-sdk](https://github.com/oscharko-dev/kei-agent-py-sdk)\n- **TestPyPI Package**: [kei-agent-py-sdk](https://test.pypi.org/project/kei-agent-py-sdk/)\n- **Documentation**: [GitHub Pages](https://oscharko-dev.github.io/kei-agent-py-sdk/)\n- **Issues**: [GitHub Issues](https://github.com/oscharko-dev/kei-agent-py-sdk/issues)\n\n## \ud83d\udcca Status\n\n- \u2705 **Production Ready**: Fully tested and documented\n- \u2705 **Type Safe**: 100% type hints for all APIs\n- \u2705 **Enterprise Grade**: Security, monitoring, and compliance features\n- \u2705 **Well Documented**: Comprehensive documentation\n- \u2705 **Actively Maintained**: Regular updates and support\n\n---\n\n**Ready to get started?** Install the SDK and follow our [Quick Start Guide](https://oscharko-dev.github.io/kei-agent-py-sdk/getting-started/quickstart/)!\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Enterprise-Grade Python SDK for Keiko-Personal-Assistant Platform with Multi-Protocol Support and Comprehensive Documentation",
    "version": "0.1.0b6",
    "project_urls": {
        "Bug Tracker": "https://github.com/oscharko-dev/kei-agent-py-sdk/issues",
        "Changelog": "https://github.com/oscharko-dev/kei-agent-py-sdk/blob/main/CHANGELOG.md",
        "Documentation": "https://oscharko-dev.github.io/kei-agent-py-sdk/",
        "Homepage": "https://oscharko.de",
        "Repository": "https://github.com/oscharko-dev/kei-agent-py-sdk"
    },
    "split_keywords": [
        "ai",
        " agent",
        " multi-agent",
        " framework",
        " rpc",
        " stream",
        " bus",
        " mcp",
        " enterprise",
        " async",
        " distributed",
        " tracing",
        " monitoring",
        " resilience"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "550a00a11be9310630a79aebf0d8bb1f3d7c2368d47ed12586acec137696f81c",
                "md5": "d1b2783ace6ec5781c5aeb96b1602173",
                "sha256": "2e59f3c82fe5e7b8bc4b951244b40570f38b172b4f29d4e8fd08fb38b69750b4"
            },
            "downloads": -1,
            "filename": "kei_agent_py_sdk-0.1.0b6-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "d1b2783ace6ec5781c5aeb96b1602173",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 168431,
            "upload_time": "2025-08-19T16:13:20",
            "upload_time_iso_8601": "2025-08-19T16:13:20.534049Z",
            "url": "https://files.pythonhosted.org/packages/55/0a/00a11be9310630a79aebf0d8bb1f3d7c2368d47ed12586acec137696f81c/kei_agent_py_sdk-0.1.0b6-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "cbc81fe0dd05e58e0108d1ef35623a0233c0996d6fc2bdec1789311d415b946e",
                "md5": "73b51567d1c22a58bd3b11f333e42eb4",
                "sha256": "fafdc31976b9116b9f5c2e26ab2ee5180d68e49e017bf738aa2a65a2327e5d1c"
            },
            "downloads": -1,
            "filename": "kei_agent_py_sdk-0.1.0b6.tar.gz",
            "has_sig": false,
            "md5_digest": "73b51567d1c22a58bd3b11f333e42eb4",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 437099,
            "upload_time": "2025-08-19T16:13:21",
            "upload_time_iso_8601": "2025-08-19T16:13:21.750137Z",
            "url": "https://files.pythonhosted.org/packages/cb/c8/1fe0dd05e58e0108d1ef35623a0233c0996d6fc2bdec1789311d415b946e/kei_agent_py_sdk-0.1.0b6.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-08-19 16:13:21",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "oscharko-dev",
    "github_project": "kei-agent-py-sdk",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "kei-agent-py-sdk"
}
        
Elapsed time: 0.55184s