Descripción del componente
Cómo funciona el componente Solicitud de API
The API Request component is a versatile tool designed to facilitate HTTP requests within your AI workflows. It enables your workflow to interact with external APIs or web services by sending requests to one or more URLs and processing the responses. This capability is essential for tasks such as data retrieval, integration with third-party services, or invoking custom endpoints as part of automated or intelligent processes.
What Does the Component Do?
This component allows you to configure and send HTTP requests (GET, POST, PATCH, PUT) to specified URLs. You can customize the request by adding headers, query parameters, and a request body. It also supports handling form data and setting custom timeouts, making it suitable for a wide range of API interactions.
The API Request component supports the following configurable inputs:
Field | Description | Type | Default/Options |
---|
URL | Enter one or more target URLs, separated by commas. | String | |
Method | HTTP method to use for the request. | Dropdown | GET, POST, PATCH, PUT |
Headers | Custom headers to include in the request (as a dictionary). | Dictionary/Data | |
Body | Data payload for POST, PATCH, or PUT requests (as a dictionary). | Dictionary/Data | |
Query Parameters | Key-value pairs to append as URL query parameters. | Dictionary/Data | |
Use Form Data | Toggle to send data as application/x-www-form-urlencoded . | Boolean | false |
Timeout | Time (in seconds) before the request times out. | Integer | 5 |
Cache TTL | How long to cache the API response. Set to ‘No cache’ to disable. | Dropdown | No cache, 5 min, … etc. |
Verbose | If enabled, prints verbose output for debugging. | Boolean | false |
Tool Name | Name for this API request tool (for use by agents). | String | |
Tool Description | Description to help agents understand how to use this tool. | String (multiline) | |
Outputs
The component produces two main outputs:
Output Name | Type | Description |
---|
Data | Data | The response data from the API request. |
Tool | Tool | Makes this API request available as a “tool” for agent-based workflows. |
Why Use This Component?
- Integration: Connect your AI workflow to any external API or web service, making it easy to augment your processes with new data or actions.
- Flexibility: Supports multiple HTTP methods, custom headers, bodies, and query parameters—suitable for simple and complex API calls alike.
- Caching: Optionally caches responses to improve performance and reduce redundant API calls.
- Form Data Support: Easily submit form-encoded data for compatible endpoints.
- Agent-Friendly: Define tool names and descriptions so the component can be used as a tool by agent-based AI workflows.
Example Use Cases
- Retrieve real-time data (e.g., weather, news, finance) from public APIs.
- Submit information to a third-party service (e.g., CRM, ticketing system).
- Integrate with custom backend endpoints for data processing or workflow automation.
- Enable LLM agents to call external APIs as part of their reasoning or task execution.
Summary
The API Request component is an essential building block for any AI process that needs to interact with web services or external data sources. It offers a comprehensive set of configuration options to handle a wide variety of HTTP request scenarios, and its outputs can be used directly or made available as a tool for agent-based AI workflows.