Metadata-Version: 2.4
Name: hikigai-agentsdk
Version: 0.1.3
Summary: Official Python SDK for building, deploying, and managing HIPAA-compliant AI agents on the Hikigai healthcare platform. Supports Google ADK agent types (LLM, Sequential, Parallel, Loop), MCP connector integration, BYOK model configuration, and one-line Cloud Run deployment.
Project-URL: Homepage, https://hikigai.ai
Author-email: Sai Daya Shankar <sshankar@hikigai.ai>
License: MIT License
        
        Copyright (c) 2026 Hikigai
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
License-File: LICENSE
Keywords: agents,ai,deployment,hikigai,llm
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Requires-Python: >=3.10
Requires-Dist: hikigai-core<0.2.0,>=0.1.0
Requires-Dist: pydantic>=2.0.0
Requires-Dist: typing-extensions>=4.0.0
Provides-Extra: dev
Requires-Dist: mypy>=1.0.0; extra == 'dev'
Requires-Dist: pytest-cov>=4.0.0; extra == 'dev'
Requires-Dist: pytest>=7.0.0; extra == 'dev'
Requires-Dist: ruff>=0.1.0; extra == 'dev'
Description-Content-Type: text/markdown

# hikigai-agentsdk

Python SDK for deploying and managing AI agents on the Hikigai platform.

## Installation

> **Note:** The Hikigai SDKs are currently published to [Test PyPI](https://test.pypi.org) while in early access.
> Do **not** run the SDK from the repository source directly — the `hikigai.core` namespace package
> must be installed to resolve correctly. Always install via the commands below.

```bash
# Using pip
pip install \
  --index-url https://test.pypi.org/simple/ \
  --extra-index-url https://pypi.org/simple/ \
  hikigai-agentsdk==0.0.1
```

This will automatically install `hikigai-core` (the shared namespace dependency) alongside
`hikigai-agentsdk`.

Once released on the main PyPI index, installation will simplify to:

```bash
# Future release (main PyPI)
pip install hikigai-agentsdk
```

## Quick Start

```python
from hikigai.agentsdk import AgentClient, AgentConfig, InputSchema, OutputSchema, StringField

# Initialize client
client = AgentClient(
    api_key="your-api-key",
   project_id="your-project-id"
)

# Deploy an agent
agent = client.deploy(AgentConfig(
    name="my-agent",
    display_name="My AI Agent",
    description="A helpful AI assistant",
    instruction="You are a helpful assistant that answers questions",
    model="claude-3.5-sonnet",
    input_schema=InputSchema(fields={"message": StringField(required=True)}),
    output_schema=OutputSchema(fields={"response": StringField()}),
    tools=[],
    timeout=60,
    memory_mb=512,
    version="1.0.0"
))

print(f"Agent deployed! ID: {agent.id}")
```
## Direct API Methods (Alternative Approach)

For custom integrations or when you need direct HTTP control, you can call the API endpoints directly:

### Authentication Flow

**Step 1: Exchange API Key for Session Token**

```bash
curl --location --request POST 'http://localhost:8000/api/v1/auth/exchange' \
--header 'X-API-Key: your_api_key_here' \
--header 'Content-Type: application/json'
```

### Step 2: Deploy Agent via API

**Python Example:**

```python
import requests
import os
from datetime import datetime, timedelta

class HikigaiAPIClient:
    def __init__(self, api_key: str, base_url: str = "http://localhost:8000"):
        self.api_key = api_key
        self.base_url = base_url
        self.access_token = None
        self.token_expiry = None
    
    def exchange_api_key(self):
        """Exchange API Key for session token."""
        headers = {"X-API-Key": self.api_key, "Content-Type": "application/json"}
        response = requests.post(
            f"{self.base_url}/api/v1/auth/exchange",
            headers=headers
        )
        response.raise_for_status()
        data = response.json()
        
        self.access_token = data["access_token"]
        self.token_expiry = datetime.utcnow() + timedelta(seconds=data["expires_in"] - 300)
        return data
    
    def ensure_token_valid(self):
        """Refresh token if needed."""
        if not self.access_token or datetime.utcnow() >= self.token_expiry:
            self.exchange_api_key()
    
    def deploy_agent(self, config: dict) -> dict:
        """Deploy an agent via API."""
        self.ensure_token_valid()
        headers = {
            "Authorization": f"Bearer {self.access_token}",
            "Content-Type": "application/json"
        }
        response = requests.post(
            f"{self.base_url}/api/v1/agents/deploy",
            headers=headers,
            json=config
        )
        response.raise_for_status()
        return response.json()

# Usage with context manager
class HikigaiAPIClientContext:
    def __init__(self, api_key: str):
        self.client = HikigaiAPIClient(api_key)
    
    def __enter__(self):
        self.client.exchange_api_key()
        return self.client
    
    def __exit__(self, exc_type, exc_val, exc_tb):
        pass

# Deploy agent
with HikigaiAPIClientContext(api_key=os.environ["HIKIGAI_API_KEY"]) as client:
    config = {
        "name": "medical-coder",
        "display_name": "Medical Coding Assistant",
        "description": "Extracts ICD-10 and CPT codes",
        "instruction": "You are a medical coding expert...",
        "model": "claude-3.5-sonnet",
        "timeout": 60,
        "memory_mb": 512,
        "input_schema": {
            "fields": {
                "clinical_note": {"type": "string", "required": True}
            }
        },
        "output_schema": {
            "fields": {
                "icd10_codes": {"type": "array"},
                "cpt_codes": {"type": "array"}
            }
        },
        "tools": []
    }
    
    result = client.deploy_agent(config)
    print(f"Agent deployed! ID: {result['agent_id']}")
```

For complete API documentation, see the [Python AgentSDK Docs](../docs/sdk/agentsdk.md#direct-api-methods).
## Features

- 🚀 **Simple Deployment**: Deploy agents with a single function call
- 🔧 **Tool Integration**: Add custom tools, OpenAPI specs, or MCP servers
- 📊 **Schema Validation**: Define input/output schemas for type safety
- ☁️ **Multi-Cloud**: Deploy to GCP Cloud Run, GCP Agent Engine, or AWS Bedrock
- 🔒 **HIPAA Compliant**: Built-in compliance checking
- 📈 **Versioning**: Semantic versioning support

## Documentation

Full documentation: 

## License

MIT
