Actions & Tools
Give your agent powers. Call your API, transfer to a human, hang up, look things up.
By default, your agent only talks. Tools are powers you grant it — like fetching data from your CRM or transferring the call to a human.
When you add a tool, you describe what it does in plain English. The AI decides when to use it.
There are four kinds:
- HTTP tools — call your API
- Client tools — run JavaScript in the visitor's browser (web only)
- MCP servers — connect to other AI tools / databases
- Transfer tools — hand the call to a human or another agent
1. HTTP tools (most common)
Let the bot call your API mid-conversation.
Example use cases:
- "Look up customer's order status"
- "Check if a phone number is registered"
- "Save a new lead to the CRM"
- "Send an OTP via SMS"
Add an HTTP tool
Configure → Actions → HTTP Tools → + Add
| Field | Example | What goes here |
|---|---|---|
| Name | check_order_status | The function name the AI sees. Use snake_case. |
| Description | "Look up an order by ID. Use when the customer asks about their order status, delivery, or shipping." | Tell the AI when to use it. Be specific. |
| Method | GET | HTTP verb |
| URL | https://api.shop.com/orders/{order_id} | {name} in the URL becomes a parameter |
| Parameters | order_id (string, required) | What the AI must collect from the caller before calling |
| Headers | Authorization: Bearer sk_xxx | Custom headers (e.g. your API key) |
| Silent | off | If on, bot stops talking while waiting for the API response |
| Wait message | "One moment while I look that up..." | What the bot says while it waits (only when not silent) |
| Error message | "Sorry, I couldn't find that order." | What the bot says if the API fails |
How it works in practice
You set up the tool above. A caller says "What's the status of order ORD-1234?"
- AI sees the tool description, decides to use it
- AI extracts
order_id = "ORD-1234"from the caller's words - osmTalk sends
GET https://api.shop.com/orders/ORD-1234with your headers - Your API responds, say
{ "status": "shipped", "tracking": "AWB987" } - AI summarizes the response in natural speech: "Your order ORD-1234 was shipped — tracking number AWB987."
You don't write code to glue these steps. You just describe the tool.
Personalize the request body with {{variables}}
If you pass dynamic variables at call start, you can use them in the URL, headers, or body:
URL: https://api.example.com/orders?campaign={{campaign_id}}&order={order_id}
Headers: { "X-Caller-Name": "{{first_name}}" }{{campaign_id}} (from call-start) is filled in automatically. {order_id} (from the AI's tool args) comes from the conversation.
2. Client tools (web widget only)
Run JavaScript on the page the user is browsing. Useful for "show this on screen while we talk":
| Use case | Example |
|---|---|
| Highlight a product on the page | highlight_product(product_id) |
| Open a modal with the price | show_price_modal(plan) |
| Pre-fill a form field | fill_email_field(email) |
| Navigate the user to another page | navigate_to("/pricing") |
How it works
You declare the tool name + parameters + a preview response. The osmTalk widget on your page receives the function call and you implement it in your widget integration code:
window.osmtalk.on("tool_call", ({ name, args }) => {
if (name === "highlight_product") {
document.querySelector(`[data-product-id="${args.product_id}"]`)
.classList.add("highlight");
}
});Only works on browser web calls — not phone or WhatsApp.
3. MCP servers (advanced)
MCP = Model Context Protocol. It's a standard for AI tools.
You can connect external MCP servers (like the official filesystem, GitHub, postgres servers) and your agent gets all their capabilities for free.
| Transport | When to use |
|---|---|
stdio | Local MCP package (npm/uvx) — most popular |
sse | Network MCP server with SSE endpoint |
http | New MCP-spec streamable HTTP |
Example: Postgres MCP
In Configure → Actions → MCP Servers → + Add:
| Field | Value |
|---|---|
| Name | postgres |
| Transport | stdio |
| Command | uvx |
| Args | ["mcp-server-postgres", "postgresql://user:pass@host/db"] |
Your agent now has tools like query_postgres(sql) automatically — describe the data you want and the AI writes SQL and calls the tool.
Security: only add MCP servers you trust. They have full access to whatever the server can do — file system, database, network.
For full MCP setup: MCP Integration Guide.
4. Transfer tools
Move the call to someone (or some other agent).
Transfer to a human
Configure → Actions → Call Transfer → Transfer to Human
| Field | Example |
|---|---|
| Enabled | ✓ |
| Destination Number | +919876543210 |
| Trigger Description | "Transfer when the caller asks for a manager, says they want to speak to a person, or seems frustrated." |
The bot picks up the cue from the conversation. When triggered:
- Bot says "Let me get someone who can help — one moment."
- Bot dials the destination number
- The caller is connected to that human; bot exits the call
Transfer to another agent (mid-call)
If you have specialized agents (Sales, Support, Tech, Billing), you can let the front-line agent route to them.
Configure → Actions → Call Transfer → Transfer to Other Agents
Add each agent you want to route to. Give a short trigger description for each:
| Target agent | Trigger description |
|---|---|
| Sales Bot | "When caller mentions buying, pricing, or discounts." |
| Tech Support | "When caller has a technical question or product not working." |
| Billing | "When caller asks about invoices, refunds, payment issues." |
Calls don't drop — the same call continues with the new agent's prompt. The conversation history is preserved.
Direct keypad routes (DTMF)
If you want callers to skip the AI entirely — "press 1 for sales, 2 for support" — set up keypad routes:
Configure → Advanced → Keypad (DTMF)
Full guide: Keypad routing.
Tool best practices
| Do | Don't |
|---|---|
| Be specific in the description ("Use when caller asks about order status") | Vague description ("Useful tool") |
| List required parameters explicitly | Make every field optional |
Set a waitMessage if the API is slow (>2s) | Leave the bot silent for 5+ seconds |
Use SSL (https://) URLs only | Use http:// — the bot will refuse internal IPs anyway |
| Limit one tool to one job | One tool that does five different things |
Common questions
"The bot has the tool but never uses it." The description isn't clear. Tell the AI exactly when to use it. Use examples.
"The bot uses the tool when it shouldn't." Same fix in reverse — add a "DO NOT use this tool when..." sentence.
"My API responds in 5 seconds and the bot sounds dead."
Add a waitMessage: "Let me check that for you...". Or speed up your API.
"My tool call returns an error."
Set errorMessage: "I couldn't find that information. Could you try again with the order number?" so the bot handles failures gracefully.
"Will the tool work on all channels?"
- HTTP tools: yes (phone, web, WhatsApp)
- Client tools: web only
- MCP: yes, all channels
- Transfer: phone primarily; agent-to-agent works on web too