Metadata-Version: 2.4
Name: kubiya-control-plane-api
Version: 0.9.21
Summary: Agent Control Plane API - Multi-tenant AI agent orchestration and management platform
Author-email: Kubiya <support@kubiya.ai>
License: AGPL-3.0
Keywords: ai,agents,orchestration,temporal,fastapi,multi-tenant,workflow,automation
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: GNU Affero General Public License v3
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Framework :: FastAPI
Classifier: Topic :: Software Development :: Libraries :: Application Frameworks
Classifier: Topic :: Internet :: WWW/HTTP :: HTTP Servers
Requires-Python: <4.0.0,>=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: httpx<1.0.0,>=0.26.0
Requires-Dist: pydantic<3.0.0,>=2.5.3
Requires-Dist: fastapi<1.0.0,>=0.109.0
Requires-Dist: uvicorn[standard]<1.0.0,>=0.27.0
Requires-Dist: sqlalchemy<3.0.0,>=2.0.25
Requires-Dist: psycopg2-binary<3.0.0,>=2.9.9
Requires-Dist: pydantic-settings<3.0.0,>=2.1.0
Requires-Dist: alembic<2.0.0,>=1.13.1
Requires-Dist: supabase<3.0.0,>=2.3.0
Requires-Dist: temporalio<2.0.0,>=1.5.0
Requires-Dist: python-multipart<1.0.0,>=0.0.6
Requires-Dist: python-jose[cryptography]<4.0.0,>=3.3.0
Requires-Dist: PyJWT<3.0.0,>=2.8.0
Requires-Dist: passlib[bcrypt]<2.0.0,>=1.7.4
Requires-Dist: mangum<1.0.0,>=0.17.0
Requires-Dist: structlog<25.0.0,>=24.1.0
Requires-Dist: croniter<3.0.0,>=2.0.0
Requires-Dist: litellm<2.0.0,>=1.30.0
Requires-Dist: agno<3.0.0,>=2.3.12
Requires-Dist: mcp<2.0.0,>=1.0.0
Requires-Dist: redis<6.0.0,>=5.0.0
Requires-Dist: kubiya-sdk<3.0.0,>=2.0.3
Requires-Dist: websockets<16.0.0,>=15.0
Requires-Dist: python-dotenv<2.0.0,>=1.0.0
Requires-Dist: anthropic<1.0.0,>=0.39.0
Requires-Dist: claude-agent-sdk>=0.1.6
Requires-Dist: opentelemetry-api<2.0.0,>=1.20.0
Requires-Dist: opentelemetry-sdk<2.0.0,>=1.20.0
Requires-Dist: opentelemetry-instrumentation-fastapi<1.0.0,>=0.41b0
Requires-Dist: opentelemetry-instrumentation-sqlalchemy<1.0.0,>=0.41b0
Requires-Dist: opentelemetry-instrumentation-redis<1.0.0,>=0.41b0
Requires-Dist: opentelemetry-instrumentation-httpx<1.0.0,>=0.41b0
Requires-Dist: opentelemetry-exporter-otlp-proto-grpc<2.0.0,>=1.20.0
Requires-Dist: opentelemetry-exporter-otlp-proto-http<2.0.0,>=1.20.0
Requires-Dist: prometheus-client>=0.24.0
Provides-Extra: worker
Requires-Dist: temporalio<2.0.0,>=1.5.0; extra == "worker"
Requires-Dist: structlog<25.0.0,>=24.1.0; extra == "worker"
Requires-Dist: agno<3.0.0,>=2.3.12; extra == "worker"
Requires-Dist: litellm<2.0.0,>=1.30.0; extra == "worker"
Requires-Dist: psutil<6.0.0,>=5.9.0; extra == "worker"
Requires-Dist: docker<8.0.0,>=7.0.0; extra == "worker"
Requires-Dist: redis<6.0.0,>=5.0.0; extra == "worker"
Requires-Dist: mcp<2.0.0,>=1.0.0; extra == "worker"
Requires-Dist: nest-asyncio<2.0.0,>=1.5.0; extra == "worker"
Requires-Dist: claude-agent-sdk<1.0.0,>=0.1.0; extra == "worker"
Provides-Extra: api
Requires-Dist: fastapi<1.0.0,>=0.109.0; extra == "api"
Requires-Dist: uvicorn[standard]<1.0.0,>=0.27.0; extra == "api"
Requires-Dist: sqlalchemy<3.0.0,>=2.0.25; extra == "api"
Requires-Dist: psycopg2-binary<3.0.0,>=2.9.9; extra == "api"
Requires-Dist: pydantic-settings<3.0.0,>=2.1.0; extra == "api"
Requires-Dist: alembic<2.0.0,>=1.13.1; extra == "api"
Requires-Dist: supabase<3.0.0,>=2.3.0; extra == "api"
Requires-Dist: temporalio<2.0.0,>=1.5.0; extra == "api"
Requires-Dist: python-multipart<1.0.0,>=0.0.6; extra == "api"
Requires-Dist: python-jose[cryptography]<4.0.0,>=3.3.0; extra == "api"
Requires-Dist: PyJWT<3.0.0,>=2.8.0; extra == "api"
Requires-Dist: passlib[bcrypt]<2.0.0,>=1.7.4; extra == "api"
Requires-Dist: mangum<1.0.0,>=0.17.0; extra == "api"
Requires-Dist: structlog<25.0.0,>=24.1.0; extra == "api"
Requires-Dist: croniter<3.0.0,>=2.0.0; extra == "api"
Requires-Dist: kubiya-sdk<3.0.0,>=2.0.3; extra == "api"
Provides-Extra: dev
Requires-Dist: pytest<9.0.0,>=7.4.0; extra == "dev"
Requires-Dist: pytest-asyncio<1.0.0,>=0.21.0; extra == "dev"
Requires-Dist: pytest-cov<6.0.0,>=4.1.0; extra == "dev"
Requires-Dist: pytest-mock<4.0.0,>=3.11.0; extra == "dev"
Requires-Dist: pytest-xdist<4.0.0,>=3.5.0; extra == "dev"
Requires-Dist: fakeredis<3.0.0,>=2.20.0; extra == "dev"
Requires-Dist: respx<1.0.0,>=0.20.0; extra == "dev"
Requires-Dist: black<25.0.0,>=23.0.0; extra == "dev"
Requires-Dist: ruff<1.0.0,>=0.1.0; extra == "dev"
Requires-Dist: mypy<2.0.0,>=1.0.0; extra == "dev"
Provides-Extra: test
Requires-Dist: pytest<9.0.0,>=7.4.0; extra == "test"
Requires-Dist: pytest-asyncio<1.0.0,>=0.21.0; extra == "test"
Requires-Dist: pytest-cov<6.0.0,>=4.1.0; extra == "test"
Requires-Dist: pytest-mock<4.0.0,>=3.11.0; extra == "test"
Requires-Dist: pytest-xdist<4.0.0,>=3.5.0; extra == "test"
Requires-Dist: fakeredis<3.0.0,>=2.20.0; extra == "test"
Requires-Dist: respx<1.0.0,>=0.20.0; extra == "test"
Provides-Extra: yaml
Requires-Dist: PyYAML<7.0.0,>=6.0.1; extra == "yaml"
Provides-Extra: nats
Requires-Dist: nats-py<3.0.0,>=2.6.0; extra == "nats"
Requires-Dist: nkeys<1.0.0,>=0.1.0; extra == "nats"
Provides-Extra: event-bus
Requires-Dist: kubiya-control-plane-api[nats,yaml]; extra == "event-bus"
Provides-Extra: all
Requires-Dist: kubiya-control-plane-api[api,dev,event-bus,test,worker]; extra == "all"
Dynamic: license-file

# Kubiya Control Plane API

A multi-tenant AI agent orchestration and management platform built with FastAPI, Temporal, and PostgreSQL.

## Features

- **Multi-tenant Architecture**: Manage multiple projects, teams, and agents
- **Workflow Orchestration**: Temporal-based workflow execution
- **Flexible Agent Runtime**: Support for multiple agent types and skills
- **Policy Enforcement**: OPA-based policy engine for agent governance
- **Scalable Workers**: Distributed worker architecture for agent execution
- **Context Management**: Environment and team-specific context handling
- **LLM Integration**: Support for multiple LLM providers via LiteLLM
- **Comprehensive APIs**: RESTful APIs for all platform features

## Installation

### Using pip

```bash
pip install kubiya-control-plane-api
```

### With optional dependencies

```bash
# For API server
pip install kubiya-control-plane-api[api]

# For worker runtime
pip install kubiya-control-plane-api[worker]

# For development
pip install kubiya-control-plane-api[dev]

# All dependencies
pip install kubiya-control-plane-api[all]
```

### From source

```bash
git clone https://github.com/kubiyabot/agent-control-plane.git
cd agent-control-plane
pip install -e .
```

## Quick Start

### 1. Set up environment variables

Create a `.env` file or set the following environment variables:

```bash
# Database Configuration
DATABASE_URL=postgresql://user:password@localhost:5432/control_plane

# Supabase (for serverless deployments)
SUPABASE_URL=your-supabase-url
SUPABASE_KEY=your-supabase-key

# Temporal Configuration
TEMPORAL_HOST=localhost:7233
TEMPORAL_NAMESPACE=default

# API Configuration
API_TITLE="Agent Control Plane"
API_VERSION="1.0.0"
ENVIRONMENT=development
LOG_LEVEL=info

# Security
SECRET_KEY=your-secret-key-here

# Optional: Kubiya Integration
KUBIYA_API_KEY=your-kubiya-api-key
KUBIYA_API_URL=https://api.kubiya.ai
```

### 2. Run database migrations

```bash
alembic upgrade head
```

### 3. Start the API server

```bash
uvicorn control_plane_api.app.main:app --host 0.0.0.0 --port 7777 --reload
```

The API will be available at `http://localhost:7777`

### 4. Access the API documentation

Open your browser and navigate to:
- Swagger UI: `http://localhost:7777/api/docs`
- ReDoc: `http://localhost:7777/api/redoc`

### 5. Start a worker

To process agent execution workflows:

```bash
kubiya-control-plane-worker
```

## API Endpoints

### Core Resources

- **Projects**: `/api/v1/projects` - Multi-project management
- **Environments**: `/api/v1/environments` - Environment configuration
- **Agents**: `/api/v1/agents` - Agent management
- **Teams**: `/api/v1/teams` - Team management
- **Workflows**: `/api/v1/workflows` - Workflow definitions
- **Executions**: `/api/v1/executions` - Execution tracking
- **Workers**: `/api/v1/workers` - Worker registration and management

### Skills and Policies

- **Skills**: `/api/v1/skills` - Tool sets and definitions
- **Policies**: `/api/v1/policies` - Policy management and enforcement

### Integration

- **Secrets**: `/api/v1/secrets` - Secrets management (proxies to Kubiya)
- **Integrations**: `/api/v1/integrations` - Third-party integrations
- **Models**: `/api/v1/models` - LLM model configuration

### Utilities

- **Health**: `/api/health` - Health check endpoint
- **Task Planning**: `/api/v1/task-planning` - AI-powered task planning

## Configuration

The application uses Pydantic Settings for configuration management. All settings can be configured via environment variables or a `.env` file.

### Key Configuration Options

- `DATABASE_URL`: PostgreSQL connection string
- `SUPABASE_URL`, `SUPABASE_KEY`: Supabase configuration for serverless
- `TEMPORAL_HOST`: Temporal server address
- `KUBIYA_API_KEY`: Kubiya platform API key
- `SECRET_KEY`: Secret key for JWT token signing
- `LOG_LEVEL`: Logging level (debug, info, warning, error)
- `ENVIRONMENT`: Deployment environment (development, staging, production)

## Development

### Install development dependencies

```bash
pip install -e ".[dev]"
```

### Run tests

```bash
# All tests
pytest

# Unit tests only
pytest -m unit

# Integration tests
pytest -m integration

# With coverage
pytest --cov=control_plane_api --cov-report=html
```

### Code formatting

```bash
# Format code with black
black .

# Lint with ruff
ruff check .
```

### Database migrations

```bash
# Create a new migration
alembic revision --autogenerate -m "Description of changes"

# Apply migrations
alembic upgrade head

# Rollback migration
alembic downgrade -1
```

## Architecture

### Workflow Orchestration

The platform uses Temporal for reliable workflow execution:
- Durable execution with automatic retries
- Activity-based task decomposition
- Support for long-running workflows
- Built-in observability and monitoring

### Multi-tenancy

- **Projects**: Top-level isolation boundary
- **Environments**: Isolated execution contexts within projects
- **Teams**: Collaborative agent groups
- **Agents**: Individual agent instances

### Worker Architecture

Workers pull tasks from environment-specific queues and execute agent workflows using Temporal.

## Contributing

1. Fork the repository
2. Create a feature branch
3. Make your changes
4. Run tests and linting
5. Submit a pull request

## License

GNU Affero General Public License v3.0 (AGPL-3.0) - see LICENSE file for details

## Support

For issues and questions:
- GitHub Issues: https://github.com/kubiyabot/agent-control-plane/issues
- Email: support@kubiya.ai

## Links

- [Documentation](https://github.com/kubiyabot/agent-control-plane/blob/main/README.md)
- [GitHub Repository](https://github.com/kubiyabot/agent-control-plane)
- [Kubiya Platform](https://kubiya.ai)
