Skip to main content

Custom Tools

Custom tools let you extend your agents with any capability your system can expose over HTTP. When the agent decides it needs to call your tool, Truedy sends a POST (or GET) request to your endpoint, your server responds with JSON, and the agent uses that data to continue the conversation. Build a custom tool when you need to:
  • Look up a customer account by phone number or email
  • Check order status, shipping information, or account balance
  • Verify identity or eligibility
  • Create a support ticket, send a notification, or trigger any internal workflow
  • Do anything not covered by the built-in integrations

Tool definition fields

Every tool is created with a name and a definition object. The definition describes your endpoint and its parameters. Top-level request body: definition fields: dynamicParameters / staticParameters item shape:
Never embed API keys or secrets in http.baseUrlPattern as query parameters. Use a staticParameters entry with location: "PARAMETER_LOCATION_HEADER" instead, so credentials are not logged in request URLs.

Full workflow

1

Build your webhook endpoint

Create an HTTPS endpoint on your server that accepts POST requests and returns JSON. See the example implementations below.
2

Define the tool in Truedy

Create the tool in the dashboard (Tools → New Tool → Custom HTTP) or via the API. Provide the name, description, URL, method, and parameters schema.
3

Attach the tool to an agent

Go to your agent’s Tools tab and enable the custom tool, or use the PATCH /agents/{id} endpoint.
4

Test with a live call

Use the dashboard’s Test Agent panel to start a test call. Trigger the tool by speaking the scenario it is designed for, and verify your endpoint receives the request and the agent responds correctly.

Example tool definition

This tool looks up a customer’s account status by phone number:

Webhook endpoint examples

Create the tool via API

Attach to an agent

Once the tool is created, attach it to an agent:
The tools array replaces the agent’s current tool list. To add a tool without removing existing ones, fetch the agent’s current tools first and include all IDs in the array.

Tool response format

Return JSON from your endpoint. The agent reads the entire response body, so structure it to be clear and self-explanatory. Recommended response structure:
For errors:
Use human-readable strings for values the agent will speak aloud. Instead of "account_status": 2, use "account_status": "active". The agent reads what you return — make it easy to say.

Timeout handling

Tools must respond within 5 seconds. If your backend operation takes longer (e.g. a slow third-party API), use a queued pattern:
  1. Acknowledge the request immediately with a pending response
  2. Return a message the agent can relay to the caller
  3. Trigger the slow operation asynchronously
Then instruct the agent in the prompt:

Security: validating Truedy requests

Use a shared secret to verify that requests to your endpoint genuinely come from Truedy. In your tool definition, add a secret as a static header parameter:
In your endpoint, validate the header on every request before processing:
Store the shared secret in an environment variable, never hardcoded in source code. Rotate it immediately if it is ever exposed.

Prompt engineering for custom tools

The description field is the single most important part of your tool definition. It is what the AI model reads to decide whether and when to call the tool. Poor description (too vague):
Good description (precise and contextual):
Rules for effective descriptions:
  • State what the tool returns, not just what it is
  • State when to call it (the trigger condition)
  • State any constraints (call once, require a phone number first, etc.)
  • Avoid ambiguity — the model takes descriptions literally

Next steps

Built-in Tools

Use Cal.com, GoHighLevel, or Calendly without writing any code

Tools Overview

Understand the full tool execution model