Learn how to connect your APIs to GenerativeAgent with API Connections
GenerativeAgent can call your APIs to get data or perform actions through API Connections. These connections allow GenerativeAgent to handle complex tasks like looking up account information or booking flights.Our API Connection tooling lets you transform your existing APIs into LLM-friendly interfaces that GenerativeAgent can use effectively. Unlike other providers that require you to create new simplified APIs specifically for LLM use, ASAPP’s approach lets you leverage your current infrastructure without additional development work.
Typically, a developer or other technical user will create API Connections. If you need help, reach out to your ASAPP team.
API Connections are the bridge between your GenerativeAgent and your external APIs. They allow your agent to interact with your existing systems and services, just like a human agent would.
Every API Connection requires an OpenAPI specification that defines your API endpoints and structure.
Choose an existing API spec from your previously uploaded API Specs, or
Upload a new OpenAPI specification file
We support any API that uses JSON for requests and responses.
Use an MCP (Model Context Protocol) server to connect tools designed for LLM interaction. See Using MCP Servers for detailed instructions.
Use pre-built platform adapters (e.g., Salesforce, Slack, ServiceNow) to connect without defining APIs from scratch. See Using Adapters for detailed instructions.
3
Configure Basic Details
Provide the essential information for your connection:
Name: A descriptive name for the API Connection
Description: Brief explanation of the connection’s purpose
Endpoint: Select the specific API endpoint from your specification
We only support endpoints with JSON request and response bodies.
4
Configure the API Source
After creation, you’ll be taken to the API Source configuration page. Here you’ll need to:
The Request Interface defines how GenerativeAgent interacts with your API. It consists of three key components that work together to enable effective API communication.
Request Schema: The schema of the data that GenerativeAgent can send to your API.
Request Transformation: The transformation that will apply to the data before sending it to your API.
Testing Interface: The interface that allows you to test the request transformation with different inputs.
The Request Schema specifies the structure of data that GenerativeAgent can send to your API. This schema should be designed for optimal LLM interaction.
This schema is NOT the schema of the API. This is the schema that the system shows to GenerativeAgent.
{ "body": { // Convert date to ISO format "timestamp": $toMillis(request.date), // Uppercase a value "region": $uppercase(request.country), // Join array values "tags": $join(request.categories, ",") }}
Conditional Logic
Copy
Ask AI
{ "body": { // Include field only if present "optional_field": $exists(request.someField) ? request.someField : undefined, // Transform based on condition "status": request.isActive = true ? "ACTIVE" : "INACTIVE" }}
Thoroughly test your request transformations to ensure GenerativeAgent can send the correct data to your API.The API Connection can not be saved until the request transformation has a successful test.Testing Best Practices
Test Various Scenarios
Copy
Ask AI
// Test 1: Minimal valid request{ "customerId": "123", "action": "view"}// Test 2: Full request with all fields{ "customerId": "123", "action": "update", "data": { "name": "John Doe", "email": "john@example.com" }}
Validate Error Cases
Test with missing required fields
Verify invalid data handling
Check boundary conditions
Use Sandbox Environment
By Default, the API Connection testing is local. You can test against actual API endpoints by setting “Run test in” to Sandbox.
The Response Interface determines how GenerativeAgent processes and presents API responses. A well-designed response interface makes it easier for GenerativeAgent to understand and use the API’s data effectively.There are three main components to the response interface:
Response Schema: The JSON schema for the data returned to GenerativeAgent from the API.
Response Transformation: A JSONata transformation where the API response is transformed into the response given to GenerativeAgent.
Test Response: The testing panel to test the response transformation with different API responses and see the output.
The Response Schema defines the structure of data that GenerativeAgent will receive. Focus on creating clear, simple schemas that are optimized for LLM processing.
The Response Schema is NOT the schema of the underlying API. This is the schema of what the system returns to GenerativeAgent.
{ "type": "object", "properties": { "temperature": { "type": "number", "description": "Current temperature in Celsius" }, "isOpen": { "type": "boolean", "description": "Whether the store is currently open" }, "lastUpdated": { "type": "string", "format": "date-time", "description": "When this information was last updated" } }}
Standardize Formats
Use consistent date/time formats
Normalize enumerated values
Use standard units of measurement
When first created, the Response Schema is a 1-1 mapping to the underlying API spec.
Transform complex API responses into GenerativeAgent-friendly formats using JSONata. The goal is to simplify and standardize the data.The Transformation’s input is the raw API response. The output is the data that GenerativeAgent will receive and must match the Response Schema.
When first created, the Response Transformation is a 1-1 mapping to the underlying API spec.
{ // Convert ISO timestamp to readable format "orderDate": $fromMillis($toMillis(clientApiCall.data.created_at), "[FNn], [MNn] [D1o], [Y]"), // Format time in 12-hour clock "deliveryTime": $fromMillis($toMillis(clientApiCall.data.delivery_eta), "[h]:[m01] [P]")}
Thoroughly test your response transformations to ensure GenerativeAgent receives well-formatted, useful data.The API Connection can not be saved until the response transformation has a successful test.Use API Mock Users to save response from your server to use them in the response testing.Testing Strategies
Test Different Response Types
Make sure to test with different response types your server may respond with.This should include happy paths, varied response types, and error paths.
You can redact sensitive fields from API Connection Logs and conversation details views. There are two types of redaction, each affecting different parts of the request/response flow:
Request/Response Interface: The data that GenerativeAgent interacts with
Raw API Request/Response: The actual data sent to and received from the underlying API
Redacting fields does not affect the data that GenerativeAgent can access. GenerativeAgent requires access to the data in order to perform its tasks. Redaction only impacts the views in the UI.
Request/Response Interface
Raw API Request/Response
Redact fields in the request and response that GenerativeAgent uses. This redacts the transformed data that appears in conversations and API Connection Logs.To redact request/response interface fields:
Add x-redact to the field in the Request Schema or Response Schema
Save the API connection to apply the changes
Redacting internal fields affects both API Connection Logs and conversations where GenerativeAgent uses the API.
Redact fields in the raw API request and response that are sent to and received from the underlying API. This redacts the underlying API data in API Connection Logs only.To redact raw API fields:
Navigate to API Integration Hub > API Specs
Click on the relevant API Spec
Click on the Parameters tab
Per endpoint, click the fields you want to redact
Redacting raw API fields only affects the API Connection Logs as the raw API data is not visible to GenerativeAgent.
Every update to an API Connection requires a version change. This is to ensure that no change can be made to an API connection that impacts a live function.If you make a change to an API connection, the Function that references that API connection will need to be explicitly updated to point to the new version.
We log all requests and responses for API connections. This allows you to see the raw requests and responses, and the transformations that were applied.Use the logs to debug and understand how API connections are working.Logs are available in API Integration Hub > API Connection Logs.
You can set default information in an API spec. These default settings serve as a template for newly created API connections, copying those settings for all API connections created for that API spec.You can set the following defaults:
Headers
Sandbox Settings:
Base URL
Authentication Method
Production Settings:
Base URL
Authentication Method
You can make further changes to API connections as necessary.You can also change the defaults and it will not change existing API connections, though the system will use the new defaults on any new connections made with that Spec.
{ "type": "object", "properties": { "success": { "type": "boolean", "description": "Whether the name update was successful" } }, "required": ["success"]}
Response Transformation:
Copy
Ask AI
{ "success": $exists(clientApiCall.data.id) and $exists(clientApiCall.data.passenger.name.first) and $exists(clientApiCall.data.passenger.name.last) and clientApiCall.data.status = "confirmed"}
{ "type": "object", "properties": { "appointmentId": { "type": "string", "description": "The ID of the appointment to look up" } }, "required": ["appointmentId"]}
{ "type": "object", "properties": { "appointmentType": { "type": "string", "description": "The type of appointment in a readable format" }, "date": { "type": "string", "description": "The appointment date in a friendly format" }, "startTime": { "type": "string", "description": "The appointment start time in 12-hour format" }, "doctor": { "type": "string", "description": "The healthcare provider's name" }, "clinic": { "type": "string", "description": "The location where the appointment will take place" }, "status": { "type": "string", "description": "The current status of the appointment" }, "patientName": { "type": "string", "description": "The name of the patient" } }, "required": ["appointmentType", "date", "startTime", "doctor", "clinic", "status", "patientName"]}
Response Transformation:
Copy
Ask AI
{ /* Convert appointment type from UPPER_SNAKE_CASE to readable format */ "appointmentType": $replace(clientApiCall.data.type, "_", " ") ~> $lowercase(), /* Format date as "Friday, March 15th, 2024" */ "date": $fromMillis($toMillis(clientApiCall.data.startTime), "[FNn], [MNn] [D1o], [Y]"), /* Format start time as "2:30 PM" */ "startTime": $fromMillis($toMillis(clientApiCall.data.startTime), "[h]:[m01] [P]"), /* Map provider and location directly */ "doctor": clientApiCall.data.provider, "clinic": clientApiCall.data.location, /* Map status and patient name */ "status": clientApiCall.data.status, "patientName": clientApiCall.data.patient.name}
Sample Transformed Response:
Copy
Ask AI
{ "appointmentType": "dental cleaning", "date": "Friday, March 15th, 2024", "startTime": "2:30 PM", "doctor": "Dr. Sarah Smith", "clinic": "Downtown Medical Center", "status": "confirmed", "patientName": "John Doe"}
Now that you’ve configured your API connections, GenerativeAgent can interact with your APIs just like a live agent. Here are some helpful resources for next steps: