Metadata-Version: 2.1
Name: dwarix-sdk
Version: 0.1.0
Summary: Python SDK for calling tools through Dwarix MCP gateway.
Author: Dwarix
License: Apache-2.0
Project-URL: Homepage, https://github.com/imshakil/dwarix
Project-URL: Repository, https://github.com/imshakil/dwarix
Project-URL: Issues, https://github.com/imshakil/dwarix/issues
Project-URL: Documentation, https://github.com/imshakil/dwarix/tree/main/sdk/python
Keywords: dwarix,mcp,ai-agents,gateway,sdk
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: Topic :: Software Development :: Libraries
Classifier: License :: OSI Approved :: Apache Software License
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Requires-Python: >=3.11
Description-Content-Type: text/markdown

# Dwarix Python SDK

Python client for calling MCP tools through Dwarix gateway.

## Install

```bash
pip install dwarix-sdk
```

## Quick Start

```python
from dwarix import DwarixClient

client = DwarixClient(
    agent_id="agt_example",
    secret="agent-secret",
    gateway_url="http://localhost:8080",
)

result = client.call_sync("github/list_repos", {"org": "acme"})
print(result)
```

## Features

- Automatic token issuance and refresh
- Sync and async tool calls
- `batch_sync()` and async `batch()`
- Parent-child request chaining with `spawn_child()`
- Sync and async context manager support
- Typed exceptions for auth, policy, and upstream failures

## Environment Variables

- `DWARIX_GATEWAY_URL`
- `DWARIX_AGENT_ID`
- `DWARIX_SECRET`
- `DWARIX_SKIP_TLS_VERIFY` for local self-signed environments

## Example

```python
import asyncio
from dwarix import DwarixClient


async def main() -> None:
    async with DwarixClient(
        agent_id="agt_example",
        secret="agent-secret",
        gateway_url="http://localhost:8080",
    ) as client:
        parent_result = await client.call("orchestrator/run", {})
        child = client.spawn_child()
        repos = await child.call("github/list_repos", {"org": "acme"})
        print(parent_result, repos)


asyncio.run(main())
```

## Development Check

```bash
cd sdk/python
python3 -m build --no-isolation
python3 -m twine check dist/*
```
