Metadata-Version: 2.4
Name: agenttools-client
Version: 0.2.0
Summary: Self-healing Python client for Tools for Agents — M2M / A2A API
Project-URL: Homepage, https://toolsforagents.tools
Project-URL: Documentation, https://toolsforagents.tools/docs/guide
Project-URL: Repository, https://github.com/max124vip-dev/tools-for-agents
Project-URL: Issues, https://github.com/max124vip-dev/tools-for-agents/issues
Author-email: Tools for Agents <support@toolsforagents.tools>
License: MIT
Keywords: a2a,agents,ai,api-client,llm,mcp,tools-for-agents
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: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Typing :: Typed
Requires-Python: >=3.10
Requires-Dist: httpx>=0.27.0
Provides-Extra: dev
Requires-Dist: build>=1.0; extra == 'dev'
Requires-Dist: pytest-asyncio>=0.23; extra == 'dev'
Requires-Dist: pytest>=8.0; extra == 'dev'
Description-Content-Type: text/markdown

# AgentTools Python Client

Self-healing **reference SDK** for [Tools for Agents](https://toolsforagents.tools) — M2M / A2A.

## Install

```bash
pip install agenttools-client
# or from repo:
pip install -e ./agenttools_client
```

Requires Python 3.10+ and `httpx`.

## Features

| Feature | Description |
|---------|-------------|
| Auto auth | `AGENTTOOLS_API_KEY` or `POST /v1/register {}` |
| 422 self-heal | Matches `/v1/tools/{tool}/examples` by missing `fields[]` |
| 5xx retry | Honors `Retry-After` / `retry_after_sec` |
| A2A-first | `client.a2a.advisor()`, `run_chain()`, `run_mission()` |
| Typed helpers | `extract()`, `ingest()`, `dry_run()`, `advisor()` |

## Quick start

```python
import asyncio
from agenttools_client import AsyncAgentToolsClient

async def main():
    async with AsyncAgentToolsClient() as client:
        plan = await client.advisor("Extract markdown from a blog URL")
        page = await client.extract("https://example.com")
        chain = await client.run_chain("article_read", {"url": "https://example.com"})
        # A2A orchestrators:
        skill = await client.a2a.advisor("Summarize a PDF for RAG")

asyncio.run(main())
```

## A2A (preferred for multi-agent orchestrators)

```python
async with AsyncAgentToolsClient() as client:
    skills = await client.a2a.list_skills()
    result = await client.a2a.run_chain("pdf_summary", {"url": "https://example.com/x.pdf"})
    mission = await client.a2a.run_mission("Research solid-state batteries")
```

Agent Card: `GET https://api.toolsforagents.tools/.well-known/agent-card.json`

## Self-healing 422

Wrong body → SDK fetches examples, picks best match for missing fields, retries once:

```python
await client.json("POST", "/v1/conflict/detect", json={})  # auto-fixes to documents[]
```

## Environment

| Variable | Default |
|----------|---------|
| `AGENTTOOLS_API_KEY` | — |
| `AGENTTOOLS_API_URL` | `https://api.toolsforagents.tools` |

## Publish (maintainers)

See [PUBLISH.md](./PUBLISH.md).

## License

MIT
