Metadata-Version: 2.4
Name: projectkate
Version: 0.3.0
Summary: KATE SDK — auto-eval, observability, and knowledge marketplace for AI agents
Project-URL: Homepage, https://www.projectkate.com
Project-URL: Repository, https://github.com/thekateproject/kate-sdk
Author-email: Sagnik <sagnik@projectkate.com>
License: Apache-2.0
License-File: LICENSE
Requires-Python: >=3.11
Requires-Dist: aiosqlite<1,>=0.20
Requires-Dist: anthropic<1,>=0.30
Requires-Dist: deepeval<3,>=1.0
Requires-Dist: httpx<1,>=0.27
Requires-Dist: openai<2,>=1.30
Requires-Dist: pydantic<3,>=2.0
Requires-Dist: rich<14,>=13.0
Requires-Dist: sqlalchemy[asyncio]<3,>=2.0
Provides-Extra: all
Requires-Dist: openinference-instrumentation-anthropic<1,>=0.1.2; extra == 'all'
Requires-Dist: openinference-instrumentation-crewai<1,>=0.1.0; extra == 'all'
Requires-Dist: openinference-instrumentation-google-generativeai<1,>=0.1.0; extra == 'all'
Requires-Dist: openinference-instrumentation-langchain<1,>=0.1.25; extra == 'all'
Requires-Dist: openinference-instrumentation-mistralai<1,>=0.1.0; extra == 'all'
Requires-Dist: openinference-instrumentation-openai<1,>=0.1.4; extra == 'all'
Requires-Dist: openinference-instrumentation-vertexai<1,>=0.1.0; extra == 'all'
Requires-Dist: opentelemetry-api<3,>=1.20; extra == 'all'
Requires-Dist: opentelemetry-sdk<3,>=1.20; extra == 'all'
Provides-Extra: anthropic-instrument
Requires-Dist: openinference-instrumentation-anthropic<1,>=0.1.2; extra == 'anthropic-instrument'
Requires-Dist: opentelemetry-api<3,>=1.20; extra == 'anthropic-instrument'
Requires-Dist: opentelemetry-sdk<3,>=1.20; extra == 'anthropic-instrument'
Provides-Extra: crewai
Requires-Dist: openinference-instrumentation-crewai<1,>=0.1.0; extra == 'crewai'
Requires-Dist: opentelemetry-api<3,>=1.20; extra == 'crewai'
Requires-Dist: opentelemetry-sdk<3,>=1.20; extra == 'crewai'
Provides-Extra: dev
Requires-Dist: pytest-asyncio>=0.23; extra == 'dev'
Requires-Dist: pytest>=8.0; extra == 'dev'
Requires-Dist: respx>=0.21; extra == 'dev'
Requires-Dist: ruff>=0.4; extra == 'dev'
Provides-Extra: google-genai
Requires-Dist: openinference-instrumentation-google-generativeai<1,>=0.1.0; extra == 'google-genai'
Requires-Dist: opentelemetry-api<3,>=1.20; extra == 'google-genai'
Requires-Dist: opentelemetry-sdk<3,>=1.20; extra == 'google-genai'
Provides-Extra: instrument
Requires-Dist: opentelemetry-api<3,>=1.20; extra == 'instrument'
Requires-Dist: opentelemetry-sdk<3,>=1.20; extra == 'instrument'
Provides-Extra: langchain
Requires-Dist: openinference-instrumentation-langchain<1,>=0.1.25; extra == 'langchain'
Requires-Dist: opentelemetry-api<3,>=1.20; extra == 'langchain'
Requires-Dist: opentelemetry-sdk<3,>=1.20; extra == 'langchain'
Provides-Extra: mistral
Requires-Dist: openinference-instrumentation-mistralai<1,>=0.1.0; extra == 'mistral'
Requires-Dist: opentelemetry-api<3,>=1.20; extra == 'mistral'
Requires-Dist: opentelemetry-sdk<3,>=1.20; extra == 'mistral'
Provides-Extra: openai
Requires-Dist: openinference-instrumentation-openai<1,>=0.1.4; extra == 'openai'
Requires-Dist: opentelemetry-api<3,>=1.20; extra == 'openai'
Requires-Dist: opentelemetry-sdk<3,>=1.20; extra == 'openai'
Provides-Extra: vertexai
Requires-Dist: openinference-instrumentation-vertexai<1,>=0.1.0; extra == 'vertexai'
Requires-Dist: opentelemetry-api<3,>=1.20; extra == 'vertexai'
Requires-Dist: opentelemetry-sdk<3,>=1.20; extra == 'vertexai'
Description-Content-Type: text/markdown

![PyPI](https://img.shields.io/pypi/v/projectkate)
![License](https://img.shields.io/badge/license-Apache%202.0-blue)
![Python](https://img.shields.io/badge/python-3.11+-blue)

# KATE SDK

Auto-eval and observability for AI agents. Trace every LLM call, run evaluations, and catch regressions before they ship.

## Install

```bash
pip install projectkate
```

### Optional instrumentation extras

```bash
pip install projectkate[openai]                # OpenAI
pip install projectkate[anthropic-instrument]  # Anthropic
pip install projectkate[langchain]             # LangChain / LangGraph
pip install projectkate[mistral]               # Mistral
pip install projectkate[vertexai]              # Vertex AI
pip install projectkate[google-genai]          # Google GenAI
pip install projectkate[crewai]                # CrewAI
pip install projectkate[all]                   # All supported providers
```

## Quick Start

### Trace mode — instrument your agent

```python
import projectkate

# Initialize — reads KATE_API_URL, KATE_API_KEY, KATE_AGENT_ID from env
projectkate.init()

@projectkate.trace("summarize")
def summarize(text: str) -> str:
    return client.messages.create(
        model="claude-sonnet-4-20250514",
        messages=[{"role": "user", "content": f"Summarize: {text}"}],
    ).content[0].text

async with projectkate.run():
    result = summarize("Today's top news stories...")
    print(result)
```

### Management client — programmatic platform access

```python
from projectkate import KateClient

async with KateClient(api_key="kate_...") as kate:
    # List your agents
    agents = await kate.agents.list()

    # Check eval results for a run
    evals = await kate.evals.get_run_evals(run_id="...")

    # Publish an artifact
    await kate.artifacts.publish(artifact_id="...")

    # Check wallet balance
    balance = await kate.wallet.get_balance()
```

## Tools — discover and use marketplace tools

KATE agents can discover and execute tools from the marketplace. The SDK provides a tool loop that handles the LLM ↔ tool-call cycle automatically.

### Agentic tool loop

Wire up your LLM client and let the SDK handle tool discovery, execution, and chaining:

```python
import projectkate
from openai import AsyncOpenAI

projectkate.init()
llm = AsyncOpenAI()

messages = [
    {"role": "system", "content": "You are a helpful assistant with access to tools."},
    {"role": "user", "content": "Find SEO keywords for 'AI observability'"},
]

result = await projectkate.tool_loop(
    llm,
    model="gpt-4o",
    messages=messages,
    max_rounds=10,
)

print(result.content)          # Final LLM response
print(result.tool_calls_made)  # Number of tool calls executed
```

Works with both OpenAI and Anthropic clients — the SDK detects the provider automatically.

### Local tools

You can register your own tools alongside marketplace tools. The SDK merges them and routes calls to the right handler:

```python
from projectkate import LocalTool

def get_current_date() -> str:
    from datetime import date
    return date.today().isoformat()

result = await projectkate.tool_loop(
    llm,
    model="gpt-4o",
    messages=messages,
    local_tools=[
        LocalTool(
            name="get_current_date",
            description="Returns today's date in ISO format",
            parameters={"type": "object", "properties": {}},
            fn=get_current_date,
        ),
    ],
)
```

Local tools run in-process. Async functions are supported.

### Direct tool management

Use the management client for lower-level control:

```python
async with KateClient(api_key="kate_...") as kate:
    # List tools available to your agent
    tools = await kate.tools.list(agent_id="...")

    # Execute a specific tool
    result = await kate.tools.execute(
        agent_id="...",
        tool_name="seo_keyword_research",
        input_data={"query": "AI observability"},
    )
    print(result.output)

    # Check credential status for subscribed tools
    statuses = await kate.tools.status(agent_id="...")
```

## Local Eval (no server needed)

Run evaluations locally against your agent with zero infrastructure:

```python
from projectkate.local import LocalEvalRunner

runner = LocalEvalRunner(agent_fn=my_agent)
results = await runner.run(test_cases=[
    {"input": "Summarize the news", "expected": "A concise summary..."},
])
runner.print_results(results)
```

## Documentation

- [Docs](https://docs.projectkate.com) — guides, API reference, and examples

## License

Apache 2.0 — see [LICENSE](LICENSE).
