Metadata-Version: 2.4
Name: milkeyskills
Version: 0.1.0
Summary: Milkey skills infrastructure SDK for connecting multi-skill AI workflows into OpenAI, Anthropic, Gemini, and other AI stacks.
Project-URL: Homepage, https://github.com/ashish200729/milkeyskills-sdk
Project-URL: Repository, https://github.com/ashish200729/milkeyskills-sdk
Project-URL: Issues, https://github.com/ashish200729/milkeyskills-sdk/issues
Author: Milkey
License-Expression: MIT
Keywords: agent skills,agents,ai,anthropic,gemini,milkey,multi-skill,openai,sdk,skill infrastructure,skills,tools
Classifier: Development Status :: 4 - Beta
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: Programming Language :: Python :: 3.13
Classifier: Typing :: Typed
Requires-Python: >=3.10
Requires-Dist: httpx>=0.28.0
Requires-Dist: pydantic>=2.10.0
Provides-Extra: dev
Requires-Dist: mypy>=1.14.0; extra == 'dev'
Requires-Dist: pytest-asyncio>=0.25.0; extra == 'dev'
Requires-Dist: pytest>=8.3.0; extra == 'dev'
Requires-Dist: respx>=0.22.0; extra == 'dev'
Requires-Dist: ruff>=0.9.0; extra == 'dev'
Description-Content-Type: text/markdown

# `milkeyskills`

Milkey Skills SDK for Python helps teams connect Milkey skills infrastructure into existing AI products and agent workflows.

Use it when you want to:

- plug Milkey skills into existing OpenAI-compatible clients
- add reusable skill execution to Anthropic, Gemini, or other AI stacks
- keep your model provider client while adding Milkey-managed skills as tools

## Install

```bash
pip install milkeyskills
```

If your app already uses the OpenAI Python SDK:

```bash
pip install milkeyskills openai
```

## Quick Start

```python
import os

from openai import OpenAI

from milkeyskills import milkey

openai_client = OpenAI(api_key=os.environ["OPENAI_API_KEY"])

milkey_client = milkey.create_client(
    base_url=os.environ["MILKEY_BASE_URL"],
    api_key=os.environ["MILKEY_API_KEY"],
)

tools = milkey.openai.chat.tools(client=milkey_client)

messages = [
    {
        "role": "user",
        "content": "Find the best Milkey skill for PostgreSQL query optimization.",
    }
]

first = openai_client.chat.completions.create(
    model="gpt-4.1",
    messages=messages,
    tools=tools,
)

assistant = first.choices[0].message
messages.append(
    {
        "role": "assistant",
        "content": assistant.content or "",
        "tool_calls": [
            {
                "id": tool_call.id,
                "type": "function",
                "function": {
                    "name": tool_call.function.name,
                    "arguments": tool_call.function.arguments,
                },
            }
            for tool_call in assistant.tool_calls or []
        ],
    }
)

if assistant.tool_calls:
    tool_messages = milkey.openai.chat.messages(
        {
            "tool_calls": [
                {
                    "id": tool_call.id,
                    "function": {
                        "name": tool_call.function.name,
                        "arguments": tool_call.function.arguments,
                    },
                }
                for tool_call in assistant.tool_calls
            ]
        },
        milkey_client,
    )
    messages.extend(tool_messages)

    second = openai_client.chat.completions.create(
        model="gpt-4.1",
        messages=messages,
        tools=tools,
    )
    print(second.choices[0].message.content or "")
else:
    print(assistant.content or "")
```

For production use, keep iterating until the model stops returning `tool_calls` and enforce a max turn count or request timeout. See `examples/openai_chat_completions.py` for a bounded loop.

## Async Client

```python
from milkeyskills import milkey

async with milkey.create_async_client(
    base_url="https://api.milkey.ai",
    api_key="mk_sk_...",
) as client:
    tools = await client.list_tools()
```

## Supported Integrations

- OpenAI-compatible chat completions
- OpenAI responses and realtime-style hosted tool delivery
- Anthropic inline and hosted MCP integrations
- Gemini function-calling integrations, Gemini Interactions hosted MCP helpers
- Framework-agnostic inline tool helpers (`milkey.inline_tools`)

## Provider Matrix

| Provider | API Variant | `mode="auto"` | Supported Modes | Recommended Helper |
| --- | --- | --- | --- | --- |
| OpenAI | Chat Completions | `inline` | `inline`, `hosted` | `milkey.openai.chat.tools(...)` |
| OpenAI | Responses API | `hosted` | `inline`, `hosted` | `milkey.openai.responses.tools(...)` |
| OpenAI | Realtime | `hosted` | `hosted` | `milkey.openai.realtime.tools(...)` |
| Anthropic | Messages API | `hosted` | `inline`, `hosted` | `milkey.anthropic.config(...)` |
| Gemini | `generateContent` | `inline` | `inline` | `milkey.gemini.config(...)` |
| Gemini | Interactions API | `hosted` | `hosted` | `milkey.gemini.interactions.config(...)` |
| Inline | Custom tool loops | `inline` | `inline` | `milkey.inline_tools.tools(...)` |

## Versioning

This package follows Semantic Versioning.

```bash
pip install --upgrade milkeyskills
```

## Development

```bash
cd python
pip install -e ".[dev]"
pytest
ruff check src tests
mypy src
```