Call an API
Call external APIs directly from the agent.
Call an API
Lets the agent make HTTP requests to external APIs, with the method, headers and body set in the configuration. The agent decides the request's body from the conversation's context.
Configuration
| Field | Required | What it is |
|---|---|---|
| API endpoint | Yes | The full URL of the endpoint to call (e.g. https://api.example.com/v1/customers) |
| HTTP method | Yes | The request's method: GET, POST, PUT, DELETE or PATCH |
| Headers (JSON) | No | The request's headers as a JSON object (e.g. { "Authorization": "Bearer token123", "Content-Type": "application/json" }) |
How it works
Given a task involving that API, the agent:
- Uses the configured endpoint and method.
- Applies the headers from the configuration.
- Decides the request's body from the conversation's context.
- Returns the HTTP status and the data in the response.
Input parameters (at run time)
| Parameter | What it is |
|---|---|
| Body | The request's body (for POST, PUT and PATCH). The agent fills it in from the context |
Response
| Field | What it is |
|---|---|
| Status | The response's HTTP code (200, 201, 404) |
| Data | What the API returned |
tip
Use the action's description to tell the agent what the API does and when to use it. The more precise the description, the better the agent decides when and how to call the endpoint.