Artificial Intelligence · 1 min read
Custom API Calls for AI Agents
Custom API calls let a managed AI agent connect to an outside service while it's talking to someone. For example, it can check stock or availability, look up an order, or send details to another system.
Before you start
Have the service's API documentation and credentials ready.
Request methods: GET, POST, PUT, PATCH, DELETE
Authentication: API key, bearer token, basic authentication, or none
Step 1: Open the agent
- Go to AI Agents > Agent Studio.
- Open Managed Agents and choose the agent.
Step 2: Set up the request
Add a custom API call and enter:
- Request method
- Endpoint URL
- Path or query parameters
- Headers
- Request body, if needed
- Authentication
- Usage instructions
Step 3: Say when to use it
Write clear instructions for when the agent should make the call and what information it needs first. For example: "When the customer asks about order status, ask for their order number, then call this API."
Step 4: Test
Run a test request and check the response. Confirm the agent can read the fields it needs, then try it in a test conversation before you go live.
How the agent uses it
During a conversation, the agent collects the information, makes the call, and uses the response in its reply.
Tips
- Keep credentials private. Use an API key with only the access the agent needs.
- Describe the response fields in plain language so the agent uses them correctly.
- Tell the agent what to say if the call fails.