> For the complete documentation index, see [llms.txt](https://agpt.co/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://agpt.co/docs/integrations/block-integrations/call_tool.md).

# Treg Call Tool

Call any tool in [Treg](https://treg.to)'s catalog, or one your Treg team registered, by id. Find ids, inputs and prices with Treg Search Catalog and Treg Get Tool. Needs a Treg API key from treg.to. Every paid call is billed by Treg from your team's prepaid balance at the provider's price, and the block reports the charge as `cost_usd`. Treg blocks run on your own Treg key, and the platform charges no credits for them.

## Treg Call Tool

### What it is

Call any of Treg's 4,000+ tools by id (SEO, social, ads, people and company data, scraping, generation), or a tool your Treg team registered. Find tool ids and prices with Treg Search Catalog.

### How it works

The block sends your request to `https://treg.to/call/<tool>` with your Treg key in the `X-Treg-Token` header; Treg injects the provider's credential on its side and relays the provider's answer unchanged. `tool` is a catalog id (e.g. `tikhub.tiktok.user.profile`) or a team tool and its path (e.g. `intercom/conversations`); anything that could leave Treg's call route, such as `..`, is refused before sending. On the platform's Treg key only catalog ids are accepted, because that key's Treg team is shared by every user; connect your own key to call your team's tools. Treg headers other than the route options (`X-Treg-Route-Verify`, `-Waterfall`, `-Prefer`, `-Exclude`, `-Confirm`, `-Strict-Filters`) are refused, so the spending cap can't be overridden. `method` AUTO sends POST when there is a body and GET otherwise. `max_cost_usd` is sent as `X-Treg-Route-Max-Cost`, so Treg refuses, without charge, a call whose estimated price is above it. A tool that starts a background task (a video or image generation) answers at once with `async_task`, the descriptor for checking on it with another call; `cost_usd` is then the amount reserved, settled when the task ends. A provider that reports a failure inside a successful answer raises an error. Failed calls are not retried. Because a team tool can write to an outside system, the block is treated as an outside action. Every paid call is billed by Treg from your team's prepaid balance at the provider's price, and the block reports the charge as `cost_usd`. Treg blocks run on your own Treg key, and the platform charges no credits for them.

### Inputs

| Input          | Description                                                                                                                                                                             | Type                                                      | Required |
| -------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------- | -------- |
| tool           | What to call: a catalog tool id, e.g. 'tikhub.tiktok.user.profile', as Treg Search Catalog lists it; or a tool your Treg team registered, with its path, e.g. 'intercom/conversations'. | str                                                       | Yes      |
| query          | Query parameters, e.g. {"uniqueId": "tiktok"}. A list value repeats the parameter.                                                                                                      | Dict\[str, Any]                                           | No       |
| body           | A JSON body, for tools called with POST. Treg Get Tool lists the fields a tool takes.                                                                                                   | Body                                                      | No       |
| method         | The HTTP method. AUTO sends POST when there is a body, GET otherwise.                                                                                                                   | "AUTO" \| "GET" \| "POST" \| "PUT" \| "PATCH" \| "DELETE" | No       |
| headers        | Extra headers, e.g. a provider option or Treg's 'X-Treg-Route-Verify: true'. Your Treg key is added for you.                                                                            | Dict\[str, str]                                           | No       |
| max\_cost\_usd | The most this call may cost, in USD. Treg refuses, without charge, a call it prices above this before sending it.                                                                       | float                                                     | No       |

### Outputs

| Output      | Description                                                                                                                      | Type            |
| ----------- | -------------------------------------------------------------------------------------------------------------------------------- | --------------- |
| error       | Error message if the operation failed                                                                                            | str             |
| response    | The provider's answer, exactly as it sent it.                                                                                    | Response        |
| status      | The provider's HTTP status.                                                                                                      | int             |
| cost\_usd   | What Treg charged, in USD. For a task still running (see async\_task) this is the amount reserved, settled when it ends.         | float           |
| call\_id    | Treg's id for this call.                                                                                                         | str             |
| served\_by  | The tool that answered, for a routed tool. Emitted only when Treg names one.                                                     | str             |
| cached      | True when Treg answered from its archive of the same question, at a tenth of the price.                                          | bool            |
| async\_task | For a tool that starts a background task (a video or image generation): how to check on it with another call. Emitted only then. | Dict\[str, Any] |

### Possible use case

**Anything in the catalog**: Call a tool the other Treg blocks don't cover, such as TikTok profiles, keyword volumes or backlinks.

**Team tools**: Call an API your Treg team registered, without the key ever reaching the workflow.

***


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://agpt.co/docs/integrations/block-integrations/call_tool.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
