Metadata-Version: 2.5
Name: qwen-agent-datacircle
Version: 0.1.0
Summary: Qwen-Agent 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/qwen-agent-datacircle
License-Expression: MIT
License-File: LICENSE
Keywords: agents,api,api-pricing,b2b-data,datacircle,function-calling,gtm,qwen,qwen-agent,tools
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Topic :: Software Development :: Libraries
Requires-Python: >=3.9
Requires-Dist: numpy
Requires-Dist: python-dateutil
Requires-Dist: qwen-agent>=0.0.15
Requires-Dist: soundfile
Requires-Dist: tqdm
Description-Content-Type: text/markdown

# qwen-agent-datacircle

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 [Qwen-Agent](https://github.com/QwenLM/Qwen-Agent) four tools that call Datacircle's public API, https://api.datacircle.dev/v1. You need no key and no account.

| 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, sorted by score out of 100, best 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 qwen-agent-datacircle
```

The package needs Qwen-Agent 0.0.15 or later and Python 3.9 or later.

## Give the tools to an agent

Importing the package registers the four tools with Qwen-Agent. Then you pass the tool names to an agent:

```python
import qwen_agent_datacircle
from qwen_agent.agents import Assistant

llm_cfg = {"model": "qwen3-32b", "model_server": "http://localhost:8000/v1", "api_key": "EMPTY"}
bot = Assistant(llm=llm_cfg, function_list=qwen_agent_datacircle.NAMES)

messages = [{"role": "user", "content": "Which email finder API is best for under $5 per 1,000?"}]
responses = bot.run_nonstream(messages)
print(responses[-1]["content"])
```

The model picks a tool. The agent runs the tool and gives the model the result. The tools work with Qwen-Agent's own function calling prompt and with `ReActChat`. To use the model's native tool calls, set `"use_raw_api": True` in `generate_cfg`. Some model servers give only native tool calls. Ollama gives only native tool calls for some models.

To add the Datacircle tools to your own tools, list every tool name: `function_list=["code_interpreter", *qwen_agent_datacircle.NAMES]`.

To give an agent only a few Datacircle tools, list only those names: `function_list=["datacircle_best_plans", "datacircle_search_plans"]`. A tool instance works too: `function_list=[qwen_agent_datacircle.DatacircleBestPlans()]`.

## Call a tool yourself

Each tool takes arguments as JSON text or a dict, the same as Qwen-Agent sends. Each tool returns JSON text:

```python
import json
from qwen_agent_datacircle import DatacircleBestPlans

result = json.loads(DatacircleBestPlans().call({"slug": "email-finder", "limit": 3}))
print(result["plans"][0])
```

The functions `list_apis`, `best_plans`, `search_plans` and `provider` return each tool's output as Python dicts.

## Tool output for the model

Each result is our API's answer as JSON. Each plan comes with a rank, provider, plan, score, price per 1,000 (`perThousand`, in dollars) and a page on datacircle.dev. That page lists every field.

You can give a provider's name in place of a slug. The tool turns `Bright Data` into `bright-data`.

For an unknown slug, the model gets `{"error": ...}` with a list of every valid slug. The model can then pick a valid slug and call the tool again. The tool checks each value from the model before the API call. For a number out of range, the tool makes no API call. The model gets `{"error": ...}` instead.

## Network

Each tool call makes one HTTPS GET request to https://api.datacircle.dev/v1 and no other network calls. The request holds only the tool's input. The API takes up to 60 calls a minute from one IP address. If the API says to wait, the tool waits up to a minute. The tool waits at most once per call. All plans are in one file at https://datacircle.dev/datacircle.json.

## Links

- Datacircle: https://datacircle.dev
- The API: https://datacircle.dev/api
- The API's spec: https://api.datacircle.dev/v1/openapi.json
- The meaning of each key: https://datacircle.dev/fields

MIT license.
