What are functions?
Functions are connections between your AI agent and your app’s API endpoints. They let the agent read and write data: looking up records, filtering lists, creating entries, and performing actions on behalf of users.Functions are how agents interact with your app’s live data. Without functions, an agent can only chat and reference knowledge base documents. With functions, it can answer questions like “Show me all deals closing this month” by querying your data.
How it works
Build your app with data models
Create your application with the data models and features you need. Each data model gets API endpoints automatically.
Describe what the agent needs
When creating or updating your agent, describe what data it should access: “Give it access to deals and contacts data.”
Agent Builder discovers endpoints
The Agent Builder examines your app’s API endpoints and creates functions that map to them.
Automatic endpoint discovery
When you ask the Agent Builder to give an agent access to your data, it automatically discovers your app’s available API endpoints. You don’t need to manually configure routes or write API code. The builder reads your app’s data models and creates the appropriate function mappings. This means the agent learns what data exists, what fields are available, and what operations are possible.Prompt examples
Query capabilities
Agents with functions can perform sophisticated data queries:| Capability | Example question | What happens |
|---|---|---|
| Filter | ”Show deals with status won” | Filters records by field value |
| Sort | ”Show deals sorted by amount, highest first” | Orders results by a field |
| Search | ”Find contacts at Acme Corp” | Searches text fields |
| Date ranges | ”Deals closing this month” | Filters by date ranges |
| Numeric ranges | ”Deals over $10,000” | Filters by numeric thresholds |
| Limits | ”Show the top 5 deals” | Limits result count |
| Combined filters | ”Open deals over $10k closing this quarter” | Applies multiple filters at once |
Managing functions
You can add, update, or remove functions through prompts:Adding functions
Updating function scope
Removing functions
Best practices
Start with read access
Start with read access
Begin by giving agents the ability to read and query data. Add write capabilities (creating or updating records) only when needed.
Be specific about which models
Be specific about which models
Instead of “give it access to everything,” specify the data models: “Give it access to deals, contacts, and companies.” This keeps the agent focused and reduces confusion.
Match functions to the agent's purpose
Match functions to the agent's purpose
A sales agent needs deals and contacts. A support agent needs orders and tickets. Don’t give agents access to data they don’t need.
Combine with knowledge bases
Combine with knowledge bases
Functions handle live data queries. Knowledge bases handle static reference material. Together, an agent can look up a customer’s order and reference your return policy to answer a question.