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: Event sent to your client application - Knowledge tools: Semantic search performed on your documents - Webhook tools: HTTP request sent to your API endpoint
Tool Types
Anam supports three 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
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, your application receives events when the LLM invokes a tool. Listen for theCLIENT_TOOL_EVENT_RECEIVED event:
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)

