Skip to content

Creating Custom Tools

Custom tools let you extend agents beyond the built-in catalog capabilities. Agent Studio supports two types of custom tools: SMTP tools for sending emails and HTTP tools for calling external REST APIs.

SMTP tools enable agents to send emails via an SMTP server. Common use cases include:

  • Sending notification or alert emails
  • Distributing reports with chart attachments
  • Automated communications triggered by agent flows

SMTP tools require three pieces of configuration:

ComponentDescription
SMTP configServer hostname, port, TLS setting, and sender email address
Auth configCredentials for authenticating with the SMTP server
Tool metadataDisplay name, description, and a unique function name
  1. Open the tool creation form

    In Agent Studio, go to Tools and click Add tool. Select the SMTP tab.

  2. Fill in the tool details

    FieldDescriptionExample
    NameA display name for the toolEmail Sender
    Unique function nameA unique identifier for the LLMsend_email
    DescriptionHelps the LLM understand when to use this toolSend email notifications to recipients
    SMTP HostYour SMTP server hostnamesmtp.yourprovider.com
    PortSMTP port (typically 587 for STARTTLS)587
    Use STARTTLSEnable TLS encryptiontrue
    Sender emailThe “From” address for outgoing emailsnotifications@yourcompany.com
    UsernameSMTP username(from your email provider)
    PasswordSMTP password or API key(from your email provider)
  3. Save and test

    Click Save, then select the tool and click Run tool to verify the configuration with test inputs.

  4. Assign the tool to an agent

    When creating or editing an agent, add the tool from the agent’s tool configuration panel.

FieldTypeDefaultDescription
hoststringrequiredSMTP server hostname
portinteger587SMTP server port (1—65535)
use_starttlsbooleantrueWhether to use STARTTLS encryption
sender_emailstringrequiredThe “From” address for outgoing emails
ProviderHostPortUsername
SendGridsmtp.sendgrid.net587apikey (API key as password)
AWS SESemail-smtp.{region}.amazonaws.com587IAM SMTP credentials
Gmailsmtp.gmail.com587Email address (app password required)
Mailgunsmtp.mailgun.org587postmaster@your-domain.mailgun.org

When an agent calls the SMTP tool, it provides the following parameters:

ParameterTypeRequiredDescription
tostring or listYesRecipient email address(es)
subjectstringYesEmail subject line
bodystringYesEmail body content (plain text or HTML)
body_formatstringNo"plain" (default) or "html"
attachment_asset_idslistNoAsset IDs to attach to the email
ccstring or listNoCC recipient(s)
bccstring or listNoBCC recipient(s)

HTTP tools enable agents to call external HTTPS endpoints. Common use cases include:

  • Calling REST APIs (CRM lookups, ticketing systems, etc.)
  • Sending webhook notifications (Slack, Teams, etc.)
  • Integrating with cloud services (Microsoft Graph, Google APIs, etc.)

HTTP tools require four pieces of configuration:

ComponentDescription
HTTP configURL template, HTTP method, and timeout
Auth configCredentials for authenticating with the endpoint
Input parameter schemaJSON Schema defining the tool’s input parameters
Tool metadataDisplay name, description, and a unique function name
  1. Open the tool creation form

    In Agent Studio, go to Tools and click Add tool. Select the REST tab.

  2. Fill in the tool details

    FieldDescriptionExample
    NameA display name for the toolCustomer Lookup
    Unique function nameA unique identifier for the LLMlookup_customer
    DescriptionHelps the LLM understand when to use this toolLook up customer details by ID
    URLHTTPS URL template (use {param} for path parameters)https://api.example.com/v1/customers/{customer_id}
    MethodHTTP methodGET
    Timeout (seconds)Request timeout (max 60)30
    Authentication methodHow to authenticate with the endpointSee Supported authentication types
  3. Add input parameter schema

    Click Add input parameter schema and define the parameters the tool accepts as a JSON Schema. Path parameters in the URL (e.g., {customer_id}) must be included and marked as required.

    {
    "type": "object",
    "properties": {
    "customer_id": {
    "type": "string",
    "description": "Customer ID to look up"
    }
    },
    "required": ["customer_id"]
    }
  4. Save and test

    Click Save, then select the tool and click Run tool to verify the configuration.

  5. Assign the tool to an agent

    When creating or editing an agent, add the tool from the agent’s tool configuration panel.

FieldTypeDefaultDescription
urlstringrequiredHTTPS URL template (can include {param} placeholders)
methodstringrequiredGET, POST, PUT, PATCH, or DELETE
timeout_secondsinteger30Request timeout in seconds (max 60)

URLs can include path parameters using {param} syntax:

https://api.example.com/users/{user_id}
https://api.example.com/v1/{resource_type}/{resource_id}

Requirements:

  • Must use HTTPS (HTTP is not allowed)
  • Cannot use IP addresses (domain names only)
  • Cannot point to localhost or private network ranges
  • Path parameters must be defined in input_parameter_schema and marked as required

Parameters are automatically routed based on the HTTP method:

MethodPath parametersRemaining parameters
GET, DELETESubstituted into URLSent as query string
POST, PUT, PATCHSubstituted into URLSent as JSON body
Auth TypeUse CaseRequired Fields
NONEPublic APIs or API key via headerscustom_headers (optional)
BASICUsername/passwordusername, password
CLIENT_CREDENTIALSOAuth 2.0 server-to-servertoken_url, client_id, client_secret, scopes (optional)
AUTHORIZATION_CODEOAuth 2.0 user-delegatedauthorization_url, token_url, client_id, client_secret (optional)

API key via custom headers

{
"name": "API Key Auth",
"auth_type": "NONE",
"custom_headers": {
"X-API-Key": "your-api-key"
}
}

Basic authentication

{
"name": "Basic Auth",
"auth_type": "BASIC",
"username": "user",
"password": "password"
}

OAuth 2.0 Client Credentials

{
"name": "OAuth M2M",
"auth_type": "CLIENT_CREDENTIALS",
"token_url": "https://auth.example.com/oauth/token",
"client_id": "your-client-id",
"client_secret": "your-client-secret",
"scopes": "api.read api.write"
}

Example: Sending email via Microsoft Graph API

Section titled “Example: Sending email via Microsoft Graph API”

Organizations using Microsoft 365 often have SMTP Basic Authentication disabled tenant-wide. In this case, you can use an HTTP tool with the Microsoft Graph Send Mail API to send emails using OAuth 2.0 — no code changes required.

You need an Azure AD app registration with the Mail.Send application permission. See the Microsoft documentation for setup instructions.

  1. Register an app in Microsoft Entra ID (Azure AD)

    • Go to the Azure portal > Microsoft Entra ID > App registrations > New registration
    • Give it a name (e.g., “Alation Agent Studio Email”)
    • Set Supported account types to “Accounts in this organizational directory only”
    • No redirect URI is needed
  2. Add the Mail.Send permission

    • In the app registration, go to API permissions > Add a permission
    • Select Microsoft Graph > Application permissions
    • Search for and add Mail.Send
    • Click Grant admin consent (requires an Azure AD admin)
  3. Create a client secret

    • Go to Certificates & secrets > New client secret
    • Copy the secret value (it is only shown once)
  4. Note your tenant and client IDs

    • From the app’s Overview page, copy the Application (client) ID and Directory (tenant) ID
  1. In Agent Studio, go to Tools > Add tool > REST tab.

  2. Click Edit as JSON at the bottom of the form and paste the following configuration, replacing the placeholder values with your Azure AD app details:

    {
    "name": "Send Email (Microsoft 365)",
    "function_name": "send_email_m365",
    "description": "Send an email using Microsoft Graph API. Use this tool to send emails to recipients with a subject and body.",
    "tool_type": "http",
    "auth_config": {
    "name": "Microsoft Graph OAuth",
    "auth_type": "CLIENT_CREDENTIALS",
    "token_url": "https://login.microsoftonline.com/<your-tenant-id>/oauth2/v2.0/token",
    "client_id": "<your-client-id>",
    "client_secret": "<your-client-secret>",
    "scopes": "https://graph.microsoft.com/.default"
    },
    "http_config": {
    "url": "https://graph.microsoft.com/v1.0/users/{sender_user_id}/sendMail",
    "method": "POST",
    "timeout_seconds": 30
    },
    "input_parameter_schema": {
    "type": "object",
    "properties": {
    "sender_user_id": {
    "type": "string",
    "description": "The email address of the sender, e.g. noreply@yourcompany.com"
    },
    "message": {
    "type": "object",
    "description": "The email message to send",
    "properties": {
    "subject": {
    "type": "string",
    "description": "Email subject line"
    },
    "body": {
    "type": "object",
    "description": "Email body",
    "properties": {
    "contentType": {
    "type": "string",
    "description": "Body format: Text or HTML"
    },
    "content": {
    "type": "string",
    "description": "The email body content"
    }
    },
    "required": ["contentType", "content"]
    },
    "toRecipients": {
    "type": "array",
    "description": "List of recipients",
    "items": {
    "type": "object",
    "properties": {
    "emailAddress": {
    "type": "object",
    "properties": {
    "address": {
    "type": "string",
    "description": "Recipient email address"
    }
    },
    "required": ["address"]
    }
    },
    "required": ["emailAddress"]
    }
    }
    },
    "required": ["subject", "body", "toRecipients"]
    }
    },
    "required": ["sender_user_id", "message"]
    }
    }
  3. Click Save, then test the tool with sample inputs.

When an agent calls this tool:

  1. Agent Studio uses the CLIENT_CREDENTIALS auth config to automatically fetch an OAuth token from https://login.microsoftonline.com/{tenant}/oauth2/v2.0/token
  2. The token is included as a Bearer token in the request to Microsoft Graph
  3. The Graph API sends the email on behalf of the specified sender
  4. A 202 Accepted response confirms the email was accepted for delivery

ErrorCauseSolution
Authentication unsuccessfulWrong credentials or Basic Auth disabledVerify username/password. For Microsoft 365, use an HTTP tool with Graph API instead
Connection refusedWrong host or portVerify SMTP server settings with your email provider
TLS handshake errorSTARTTLS misconfigurationVerify port supports STARTTLS (typically port 587)
Sender not verifiedUnverified sender addressVerify the sender email with your provider
ErrorCauseSolution
URL must use HTTPSHTTP URL providedChange the URL scheme to https://
URL cannot use IP addressesIP address in URLUse a domain name instead
Path parameters not found in schemaMissing schema propertyAdd the path parameter to input_parameter_schema and mark it as required
401/403 responseAuthentication failureVerify credentials. For OAuth, check that admin consent has been granted
Request timed outSlow endpointIncrease timeout_seconds (max 60)
EndpointMethodDescription
/ai/api/v1/config/toolPOSTCreate a tool config
/ai/api/v1/config/toolGETList tool configs
/ai/api/v1/config/tool/{id}GETGet a tool config
/ai/api/v1/config/tool/{id}PATCHUpdate a tool config
/ai/api/v1/config/tool/{id}DELETEDelete a tool config

For the full API specification, see the API Reference.