Metadata-Version: 2.5
Name: txtai-datacircle
Version: 0.1.0
Summary: txtai 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/txtai-datacircle
License-Expression: MIT
License-File: LICENSE
Keywords: agents,api,api-pricing,b2b-data,datacircle,gtm,smolagents,tool-calling,tools,txtai
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Topic :: Software Development :: Libraries
Requires-Python: >=3.10
Description-Content-Type: text/markdown

# txtai-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 [txtai](https://github.com/neuml/txtai) agents four tools that call Datacircle's open API, https://api.datacircle.dev/v1. Each tool is a plain Python function with type hints and a docstring. txtai reads each tool's name, description and arguments from the type hints and the docstring. 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, 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 txtai-datacircle "txtai[agent]" litellm
```

txtai-datacircle works with txtai 9.2 and later, on Python 3.10 and later. txtai-datacircle does not import `txtai`. You need `litellm` only for LiteLLM models, such as `anthropic/claude-haiku-5-5`.

## Use the tools in an agent

Give the tools to an `Agent`:

```python
from txtai import Agent
from txtai_datacircle import datacircle_tools

agent = Agent(model="anthropic/claude-haiku-5-5", tools=datacircle_tools(), max_steps=8)
print(agent("Who are the 3 best providers for the email-finder API?"))
```

The agent calls the tools with each step's arguments as JSON. Set `method="code"` and the agent writes Python that calls the tools as functions. Each tool returns a dict. The agent's code can read the dict's keys:

```python
from txtai import Agent
from txtai_datacircle import datacircle_tools

agent = Agent(model="anthropic/claude-haiku-5-5", tools=datacircle_tools(), method="code", max_steps=8)
print(agent("Which provider is first for the email-finder API, and on which other APIs does it rank?"))
```

## Use the Datacircle tools beside your own tools

Put the Datacircle tools in one list with your own tools and txtai's tools: `tools=[*datacircle_tools(), my_tool, "websearch"]`.

To give the model only some of the tools, list their names: `datacircle_tools(["datacircle_best_plans"])`.

## Use the tools in a txtai app

In a txtai app's YAML file, name each tool by the tool's import path:

```yaml
llm:
  path: anthropic/claude-haiku-5-5

agent:
  gtm:
    max_steps: 8
    tools:
      - target: txtai_datacircle.datacircle_list_apis
      - target: txtai_datacircle.datacircle_best_plans
      - target: txtai_datacircle.datacircle_search_plans
      - target: txtai_datacircle.datacircle_provider
```

Then run the agent with `Application("app.yml").agent("gtm", "Who is best for the email-finder API?")`. Or serve the app with txtai's API: `CONFIG=app.yml uvicorn "txtai.api:app"`. Then post to `/agent`:

```bash
curl -X POST http://localhost:8000/agent -H "Content-Type: application/json" \
  -d '{"name": "gtm", "text": "Who is best for the email-finder API?"}'
```

## Call a tool yourself

You can call each tool without a model. You get the tool's answer as a dict:

```python
from txtai_datacircle import datacircle_best_plans, run

print(datacircle_best_plans("email-finder", limit=3)["plans"])
print(run("datacircle_provider", {"slug": "Bright Data"}))
```

## What the model reads

Each tool returns a dict. 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`.

The tool returns `{"error": "..."}` with the API's message when the API gives no data, such as for an unknown slug. The error for an unknown API slug lists every valid slug. The tool checks each number from the model first. For a number out of range, the tool returns `{"error": "..."}` and makes no API call. If the network fails, the tool returns `{"error": "..."}` with the network error's message. The tool never raises an error. The agent keeps running. The model can call the tool again.

## 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. The API can ask the tool to wait. The tool then waits once, for a minute at most. Each call uses only Python's standard library. Nothing goes to disk.

## Links

- Datacircle: https://datacircle.dev
- The API's spec: https://api.datacircle.dev/v1/openapi.json
