Metadata-Version: 2.5
Name: copilot-sdk-datacircle
Version: 0.1.0
Summary: GitHub Copilot SDK tools for the Datacircle API: find the best GTM APIs
Project-URL: Homepage, https://datacircle.dev
Project-URL: Documentation, https://api.datacircle.dev/v1/openapi.json
Project-URL: Repository, https://github.com/waynehamadi/copilot-sdk-datacircle-python
License-Expression: MIT
License-File: LICENSE
Keywords: agents,api,api-pricing,b2b-data,copilot,copilot-sdk,datacircle,github-copilot,gtm,tools
Classifier: Framework :: AsyncIO
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Topic :: Software Development :: Libraries
Requires-Python: >=3.11
Requires-Dist: httpx>=0.24
Requires-Dist: pydantic>=2
Description-Content-Type: text/markdown

# Datacircle tools for the GitHub Copilot SDK (Python)

Find the best GTM APIs. We benchmark all the GTM APIs and we put the results on our website.

Our website: https://datacircle.dev

This package gives the [GitHub Copilot SDK for Python](https://github.com/microsoft/copilot-sdk/tree/main/python) four tools that call Datacircle's open API, https://api.datacircle.dev/v1. The SDK's `define_tool` makes each tool. You put the four tools in a session beside your own tools. You need no key and no account.

| Tool | What the tool gives | Call |
| --- | --- | --- |
| `datacircle_list_apis` | Every GTM API on Datacircle, with the API's slug, number of plans, number of providers and best plan | `GET /apis` |
| `datacircle_best_plans` | One API's plans, best score out of 100 first. Each plan comes with a rank and a price per 1,000 calls | `GET /apis/{slug}/best` |
| `datacircle_search_plans` | Plans that match a provider or plan name, on all APIs or on one API. You can sort them by score, provider or price | `GET /plans` |
| `datacircle_provider` | The APIs a provider sells, and the provider's rank on each API | `GET /providers/{slug}` |

## Install

```bash
pip install microsoft-copilot-sdk copilot-sdk-datacircle
```

The tools work with `microsoft-copilot-sdk` 2.0.0 and later. They also work with `github-copilot-sdk` 1.0.0 and later. Before 2.0, the SDK had the name `github-copilot-sdk`. They need Python 3.11 or later.

## Use the tools

Give the tools to `create_session()`:

```python
import asyncio

from copilot import CopilotClient
from copilot.session import PermissionHandler
from copilot_sdk_datacircle import datacircle_tools


async def main():
    async with CopilotClient(mode="coding-agent") as client:
        async with await client.create_session(
            model="gpt-5",
            permissions={"on_request": PermissionHandler.approve_all},
            tools={"definitions": datacircle_tools()},
        ) as session:
            reply = await session.send_and_wait("Who are the 3 best providers for the email-finder API?", timeout=300)
            print(reply.data.content)


asyncio.run(main())
```

On `github-copilot-sdk` 1.x, pass the list itself as `tools=datacircle_tools()`. Pass the permission handler as `on_permission_request=`.

You can put the tools beside your own tools:

```python
tools={"definitions": [*datacircle_tools(), lookup_issue]}
```

In `mode="empty"`, a session runs only the tools in `available_tools`. Add the custom tools to `available_tools`: `tools={"definitions": datacircle_tools(), "available_tools": ToolSet().add_custom("*")}`. Import `ToolSet` from `copilot`.

To give the model only some of the tools, filter them by name: `[t for t in datacircle_tools() if t.name != "datacircle_provider"]`.

The tools only read data. They run with no permission prompt. With `datacircle_tools(skip_permission=False)`, your permission handler decides each call.

## Make each call yourself

You can make each call without a model. Each call returns the answer as a dict:

```python
from copilot_sdk_datacircle import best_plans

answer = await best_plans("email-finder", limit=3)
print(answer["plans"])
```

The other calls are `list_apis()`, `search_plans()` and `provider_ranks()`. If the API refuses a call, the dict is `{"error": ...}` with the API's message.

## What the model reads

Each tool gives the model a JSON object as text. Each plan comes with a rank, provider, plan, score, price per 1,000 (`perThousand`, in dollars) and a page on datacircle.dev. The page on datacircle.dev lists every field.

For an unknown slug, the model gets a failure with the API's message. The failure also names the tool to call instead. If an input does not fit the schema, the model gets a failure that names the wrong argument. If the network fails, the model gets a failure with the network error's message. After a failure, the model can call the tool again and keep working.

`datacircle_tools(timeout=10)` makes each call wait 10 seconds at most for an answer. The default is 30 seconds.

## Network

Each tool call makes one HTTPS GET request to https://api.datacircle.dev/v1 and nothing else. The request holds only the tool's own arguments: no key and nothing from your chats. The API takes up to 60 calls a minute from one IP address. After a 429 answer (too many calls), the tool waits up to a minute and tries once more. The package needs the SDK, httpx and Pydantic. The package stores nothing.

## Links

- Datacircle: https://datacircle.dev
- The API: https://datacircle.dev/api
- The API's spec: https://api.datacircle.dev/v1/openapi.json
- Each key's meaning: https://datacircle.dev/fields
- The same tools for the TypeScript SDK: [@datacircle/copilot-sdk](https://www.npmjs.com/package/@datacircle/copilot-sdk)
- The same tools for the Go SDK: [copilot-sdk-go-datacircle](https://pkg.go.dev/github.com/waynehamadi/copilot-sdk-go-datacircle)

MIT license.
