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

# griptape-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 [Griptape](https://github.com/griptape-ai/griptape) a tool, `DatacircleTool`, that calls Datacircle's public API, https://api.datacircle.dev/v1. You need no key and no account.

The tool has four activities:

| Activity | Gives | Call |
| --- | --- | --- |
| `list_apis` | Every GTM API on Datacircle, with the API's slug, number of plans, number of providers and best plan | `GET /apis` |
| `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` |
| `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` |
| `provider` | The APIs a provider sells, and the provider's rank on each API | `GET /providers/{slug}` |

## Install

```bash
pip install griptape-datacircle
```

The package needs Griptape 1.1 or later and Python 3.10 or later.

## Give the tool to an agent

```python
from griptape.structures import Agent
from griptape_datacircle import DatacircleTool

agent = Agent(tools=[DatacircleTool()])
agent.run("Which email finder API is best for under $5 per 1,000?")
print(agent.output.value)
```

The model picks an activity. The agent runs the activity and gives the model the result. The tool works with the model's native tool calls and with Griptape's actions prompt (`use_native_tools=False`). A `PromptTask` in a `Pipeline` or a `Workflow` takes the tool too: `PromptTask(tools=[DatacircleTool()])`.

To use the tool with your own tools, list them all: `Agent(tools=[MyTool(), DatacircleTool()])`.

To give only some activities, name them: `DatacircleTool(allowlist=["best_plans", "search_plans"])`.

## Call an activity yourself

Griptape passes each activity the input as `{"values": ...}`. Wrap your input the same way when you call one:

```python
from griptape_datacircle import DatacircleTool

result = DatacircleTool().best_plans({"values": {"slug": "email-finder", "limit": 3}})
print(result.value["plans"][0])
```

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

## Tool output for the model

Each result is a `JsonArtifact` with our API's answer. 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 an `ErrorArtifact` with the API's error message. The error message for an unknown API slug lists 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. The model gets an `ErrorArtifact` for a number out of range. The tool then makes no API call.

## Network

Each activity makes one HTTPS GET request to https://api.datacircle.dev/v1 and no other network calls. The request holds only the activity'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
- What each key means: https://datacircle.dev/fields

MIT license.
