Documentation Index
Fetch the complete documentation index at: https://anam.ai/docs/llms.txt
Use this file to discover all available pages before exploring further.
Overview
Anam’s tool calling system enables AI personas to perform actions beyond conversation. During a session, the LLM can decide when to invoke tools based on user intent, making your personas capable of:- Triggering client-side actions (opening modals, redirecting pages, updating UI)
- Searching knowledge bases using semantic search (RAG)
- Calling external APIs via webhooks
- Executing custom business logic
How Tool Calling Works
When a user interacts with your persona, the conversation flows through a decision-making process:LLM analyzes intent
The persona’s LLM analyzes the request and determines it needs external information to respond accurately.
Tool execution
The system executes the tool based on its type:
- Client tools: The SDK triggers your registered handler. If
awaitResultistrue, the return value fromonStart(or error message if it throws) is sent back to the engine as the tool result. - Knowledge tools: Semantic search performed on your documents
- Webhook tools: HTTP request sent to your API endpoint
- System tools: Executed instantly inside the engine
Tool Types
Anam supports four types of tools, each designed for different use cases:Client Tools
Client tools trigger events in your client application, enabling the persona to control your user interface. Common use cases:- Opening product pages or checkout flows
- Displaying modals or notifications
- Navigating to specific sections of your app
- Updating UI state based on conversation
Knowledge Tools (RAG)
Knowledge tools enable semantic search across your uploaded documents using Retrieval-Augmented Generation (RAG). Common use cases:- Answering questions from product documentation
- Searching company policies or FAQs
- Retrieving information from manuals or guides
- Providing accurate, source-based responses
Folder IDs are UUIDs. You can find them in the Anam Lab UI at
/knowledge or
via the API when creating folders.- They understand the user’s intent, not just keywords.
- They find the most relevant snippets from your documents.
- They provide this information to the AI to form an accurate answer.
Knowledge tools require you to upload and organize documents in knowledge
folders before they can be used. Learn more in the Knowledge Base
documentation.
Webhook Tools
Webhook tools call external HTTP endpoints, allowing your persona to integrate with any API. This enables your persona to interact with external systems and perform actions. Common use cases:- Checking order or shipment status
- Creating support tickets
- Updating CRM records
- Fetching real-time data (weather, stock prices, etc.)
- Triggering workflows in external systems
System Tools
System tools are built-in tools that execute directly inside the Anam engine for instant session control. Unlike other tool types, they require no external endpoints or client-side handlers — just specify thetype and name.
Available system tools:
change_language— Dynamically switch the speech recognition language mid-sessionskip_turn— Skip the persona’s response and wait silently for the user to continue
toolIds:
Protecting Tool Turns from Interruptions
By default, the user can interrupt the persona at any point, including while a tool is executing or while the persona is reading the tool result back. For tools that drive a multi-step action — for example, navigating to a new page, submitting a form, or playing back a confirmation — an interruption part way through can leave the conversation out of sync with what your application just did. SetdisableInterruptions to true on a tool definition to suppress interruptions for the duration of that tool’s turn:
client, server (knowledge and webhook), and system. It defaults to false, which preserves the existing interrupt-anytime behavior.
disableInterruptions only takes effect when there is a turn to protect. Set awaitResult: true on client tools and awaitResponse: true on webhook tools — fire-and-forget tools return control to the LLM immediately, so the flag has nothing to guard.disableInterruptions alongside the other tool fields:
Attaching Tools to Personas
Tools can be attached to personas in two ways:Stateful Personas (Database-Stored)
For stateful personas, tools must be created first and then attached by their ID.Create tools
Create tools via the UI at Response includes the tool ID:
/tools or via the API. Each tool gets a persistent ID.Attach tools to persona
In the UI at
/build/{personaId}, add tools from your organization’s tool library, OR via API when creating/updating a persona:Ephemeral Personas (Session-Only)
For ephemeral personas defined at session creation time, attach tools by their IDs in thetoolIds array:
Tools must be created first via the API or UI before they can be attached to ephemeral personas. The
toolIds array references existing tool IDs.Handling Tool Events
For client tools, useregisterToolCallHandler to define per-tool handlers, this will automatically emit completed or failed events when the handler completes.
Tool Design Best Practices
Write Clear Descriptions
The tool description helps the LLM understand when to use the tool. Be specific and include context.Use Semantic Function Names
Follow snake_case naming conventions and make names descriptive:search_product_documentationcreate_support_ticketopen_checkout_pagesearchdoThingtool1
Define Clear Parameters
Use JSON Schema to define parameters with detailed descriptions:Organize Knowledge by Domain
Create separate knowledge folders for different topics and assign them to specific tools for better relevance:Limitations
Tool naming:- Length: 1-64 characters
- Pattern:
^[a-zA-Z0-9_.-]+$ - No spaces or special characters
- Length: 1-1024 characters
- Require at least one folder ID
- Folders must contain at least one READY document for useful results
- Document uploads subject to size and storage limits
- Supported formats: PDF, TXT, MD, DOCX, CSV, JSON, LOG
- 5-second timeout (Ideally much faster)
- Supported methods: GET, POST, PUT, PATCH, DELETE
- Response size limit: 1MB (ideally lower)
Next Steps
Cookbook: Client-Side Tools
Build a multi-page app where the avatar navigates users with voice commands
Getting Started with Tools
Create your first tool in 15 minutes
Knowledge Base Setup
Upload documents and configure RAG search
Webhook Tools
Integrate external APIs with webhook tools
System Tools
Built-in tools for language switching and turn management

