> For the complete documentation index, see [llms.txt](https://docs.greatwave.ai/great-wave-ai-harness/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.greatwave.ai/great-wave-ai-harness/great-wave-ai-harness/agent-features/agent-modules/agent-modes/api-agent.md). Agents can also search and read this documentation through its [MCP server](https://docs.greatwave.ai/great-wave-ai-harness/~gitbook/mcp).

# API (Agent)

Configure an agent that calls an external API and presents its results.

Use **API Agent** to call an external API from a conversation. It maps user requests to API parameters, sends the request, and presents the result.

### Set up an API Agent

1. Open the agent's **Instructions** module.
2. Select **API Agent** from **Agent Mode**.
3. Add the API method, endpoint, headers, and parameters.
4. Write guidance for mapping user requests to parameters.
5. Add response instructions when results need formatting.
6. Select **Refresh Agent**, then test representative requests.

{% hint style="warning" %}
Test the endpoint and authentication outside the agent first. Never expose credentials in instructions or responses.
{% endhint %}

### Configure the request

Set these values in **API Configurations**:

* **Method** — choose the method required by the endpoint.
* **URL** — enter the complete endpoint, including dynamic placeholders where needed.
* **Headers** — add authentication and content-type headers.
* **Parameters** — define each value and how it is supplied.

Use **Predefined** for fixed values. Use **AI Generate** when the agent should derive a value. Use **Entire Context** when the API needs the full user request.

### Write parameter guidance

In **Configuration Guidance**, explain how the agent should extract values, apply defaults, and handle missing information.

```
Extract a city name from weather requests.
Use "current" when no city is provided.
Ask for clarification when the request has more than one city.
```

### Format the response

Use **Final Response Instructions** when raw API output needs transformation. State which fields to show, how to format them, and how to handle empty results or errors.

### Detailed configuration reference

#### The Instructions Page Layout <a href="#the-instructions-page-layout" id="the-instructions-page-layout"></a>

The API Agent is configured within the broader Instructions page, which has a two-column layout:

**Left Column (Configuration)**

* **Agent Mode Selector** - Choose "API Agent"
* **API Configurations Panel** - Main API setup and parameter configuration
* **Configuration Guidance Panel** - Instructions for parameter population
* **Final Response Instructions Panel** - Response processing and formatting
* **Refresh Agent Button** - Apply your configuration changes

**Right Column (Testing)**

* **Chat Interface** - Test your agent with sample queries
* **Response Display** - See how the agent calls APIs and formats responses
* **API Call Logs** - View the actual API requests and responses

#### Configuration Panel Structure <a href="#configuration-panel-structure" id="configuration-panel-structure"></a>

When API Agent mode is selected, you'll see:

1. **API Configurations Panel** - Core API setup (method, URL, headers, parameters)
2. **Configuration Guidance Panel** - Instructions for intelligent parameter mapping
3. **Final Response Instructions Panel** - Response processing and formatting guidance

***

### Feature-by-Feature Instructions <a href="#feature-by-feature-instructions" id="feature-by-feature-instructions"></a>

#### 1. Selecting the Agent Mode <a href="#id-1-selecting-the-agent-mode" id="id-1-selecting-the-agent-mode"></a>

**What it does:** Changes your agent to API Agent mode, enabling external API integration and intelligent parameter mapping.

**Where to find it:** Top of the left column, labeled "Agent Mode:"

**How to use:**

1. Click the **Agent Mode** button (shows current mode)
2. A dropdown menu will appear
3. Scroll through options and click **"API Agent"**
4. The page will update to show API configuration panels

**Expected result:** API Configurations panel appears, replacing other agent-specific options.

***

#### 2. Configuring API Settings <a href="#id-2-configuring-api-settings" id="id-2-configuring-api-settings"></a>

**What it does:** Sets up the basic API connection including HTTP method, URL, and authentication.

**Where to find it:** In the "API Configurations" panel

**HTTP Method Selection**

**What it does:** Chooses the HTTP method for API requests.

**Options:**

* **GET**: Retrieve data from the API
* **POST**: Send data to create or update resources
* **PUT**: Update existing resources

**How to use:**

1. Find the dropdown next to the URL field
2. Click to expand the options
3. Select GET, POST, or PUT based on your API requirements

**API URL Configuration**

**What it does:** Specifies the endpoint URL for API calls.

**How to use:**

1. Find the URL input field in the API configurations
2. Enter your complete API endpoint URL
3. Include https\:// or http\:// protocol
4. Add path parameters directly or use curly braces for dynamic values

**Examples:**

* `https://api.weather.com/v1/current/{location}`
* `https://api.github.com/repos/{owner}/{repo}/issues`
* `https://api.stripe.com/v1/customers`

**URL Validation:** The system will highlight invalid URLs in red.

**Request Headers**

**What it does:** Configures HTTP headers for authentication and content specification.

**How to use:**

1. Find the "Request Headers" section
2. Click **"Add Header"** to add new headers
3. Enter header name (e.g., "Authorization", "Content-Type")
4. Enter header value (e.g., "Bearer your-api-key", "application/json")

**Common Headers:**

* **Authorization**: `Bearer your-token` or `Basic base64-encoded-credentials`
* **Content-Type**: `application/json` or `application/x-www-form-urlencoded`
* **Accept**: `application/json`
* **User-Agent**: Your application identifier

***

#### 3. Setting Up API Parameters <a href="#id-3-setting-up-api-parameters" id="id-3-setting-up-api-parameters"></a>

**What it does:** Defines the parameters that will be sent with API requests, with intelligent mapping from user queries.

**Where to find it:** In the "API Configurations" panel, under "Query Parameters" or "Request Body Fields"

**Parameter Types**

**What it does:** Specifies the data type for each parameter.

**Options:**

* **String**: Text values
* **Integer**: Whole numbers
* **Boolean**: True/false values
* **Array**: List of values (comma-separated)
* **Nested**: Complex objects with sub-parameters

**How to use:**

1. Click **"+ Add Parameter"** to create a new parameter
2. Enter the parameter name (key)
3. Select the data type from the dropdown
4. Enter a default value or leave blank for dynamic population

**Content Types**

**What it does:** Determines how parameter values are populated.

**Options:**

* **Predefined**: Use the value you enter (static)
* **AI Generate**: Let the agent generate the value based on context
* **Entire Context**: Use the full user query as the parameter value

**How to use:**

1. For each parameter, select the content type
2. **Predefined**: Enter a fixed value
3. **AI Generate**: The agent will create appropriate values
4. **Entire Context**: The full user query becomes the parameter value

**Dynamic Parameter Mapping**

**What it does:** Uses curly braces in URLs and parameter values for dynamic content.

**How to use:**

1. In URLs: `https://api.example.com/users/{userId}`
2. In parameter values: Use curly braces for placeholders
3. The agent will populate these based on user queries and guidance

**Example:**

* URL: `https://api.weather.com/v1/forecast/{location}/{days}`
* Parameter: `{query}` for search terms

***

#### 4. Importing API Schemas <a href="#id-4-importing-api-schemas" id="id-4-importing-api-schemas"></a>

**What it does:** Automatically generates parameter configurations from API documentation or example JSON.

**Where to find it:** In the API Configurations panel, "Import from JSON / Schema" section

**JSON Schema Import**

**What it does:** Creates parameters from a JSON schema definition.

**How to use:**

1. Click **"Import from JSON / Schema"** to expand the section
2. Paste your JSON schema or example object
3. Click **"Generate Parameters"**
4. The system will create parameter fields automatically

**Example Schema:**

```json
{
  "fields": [
    {"name": "userId", "type": "integer"},
    {"name": "email", "type": "string"},
    {"name": "active", "type": "boolean"}
  ]
}
```

**JSON Object Import**

**What it does:** Creates parameters from an example API request object.

**How to use:**

1. Paste a sample JSON object representing your API request
2. Click **"Generate Parameters"**
3. Parameters will be created matching the object structure

**Example Object:**

```json
{
  "search": "laptop",
  "category": "electronics",
  "priceRange": {
    "min": 500,
    "max": 2000
  },
  "inStock": true
}
```

***

#### 5. Writing Configuration Guidance <a href="#id-5-writing-configuration-guidance" id="id-5-writing-configuration-guidance"></a>

**What it does:** Provides instructions to the agent on how to intelligently populate API parameters from user queries.

**Where to find it:** In the "Configuration Guidance" panel

**How to use:**

1. Find the text area in the Configuration Guidance panel
2. Write clear instructions for parameter mapping
3. Include examples of how user queries should populate parameters
4. Specify any business logic or validation rules

**Example Instructions:**

```
You are an API agent for a weather service. When users ask about weather:

1. Extract location from queries like "What's the weather in Paris?" → {location} = "Paris"
2. Extract time periods from queries like "Weather for next 5 days" → {days} = 5
3. Use current location if none specified → {location} = "current"
4. Default to 3 days if no period specified → {days} = 3

Examples:
- "Weather in Tokyo tomorrow" → location: "Tokyo", days: 1
- "Is it raining in London?" → location: "London", days: 1
- "5-day forecast for New York" → location: "New York", days: 5
```

**Tips for effective guidance:**

* Be specific about parameter extraction patterns
* Include multiple examples for different query types
* Define default values for optional parameters
* Specify validation rules and error handling

***

#### 6. Setting Up Response Processing <a href="#id-6-setting-up-response-processing" id="id-6-setting-up-response-processing"></a>

**What it does:** Defines how API responses are processed and formatted for users.

**Where to find it:** In the "Final Response Instructions" panel

**Response Synthesis Toggle**

**What it does:** Enables post-processing of API responses for better user experience.

**How to use:**

1. Find the **"Post-Response Synthesis"** toggle
2. Switch to **"On"** to enable response processing
3. A text area will appear for synthesis instructions

**Synthesis Instructions**

**What it does:** Provides guidance on how to format and present API response data.

**How to use:**

1. Write instructions for processing the raw API response
2. Specify how to extract relevant information
3. Define the response format and structure
4. Include any data transformation or summarization needs

**Example Instructions:**

```
Process the weather API response and present it in a user-friendly format:

1. Extract current conditions, temperature, and forecast
2. Convert temperatures to Fahrenheit if user prefers
3. Format as: "Current weather in {location}: {condition}, {temperature}°F"
4. Include forecast summary for next few days
5. Highlight any severe weather warnings

Response Structure:
- Current Conditions (temperature, conditions, wind)
- Daily Forecast (high/low, conditions)
- Special Notes (precipitation, warnings)
```

***

### Common Workflows <a href="#common-workflows" id="common-workflows"></a>

#### Workflow 1: Weather Information API <a href="#workflow-1-weather-information-api" id="workflow-1-weather-information-api"></a>

**Goal:** Create an agent that provides weather information through a weather API

**Steps:**

1. Select **API Agent** as Agent Mode
2. Configure API settings:
   * Method: GET
   * URL: `https://api.weatherapi.com/v1/current.json`
   * Headers: Add API key header
3. Add parameters:
   * Key: `key`, Value: `your-api-key`, Type: String, Content: Predefined
   * Key: `q`, Value: `{location}`, Type: String, Content: AI Generate
4. In Configuration Guidance, write:

   ```
   Extract location from user queries about weather.
   Examples:
   - "Weather in Paris" → q: "Paris"
   - "Is it raining in Tokyo?" → q: "Tokyo"
   - Default to user's current location if none specified
   ```
5. Enable Response Synthesis with instructions to format weather data nicely
6. Click **"Refresh Agent"**

**Result:** Users can ask "What's the weather in London?" and get formatted weather information.

***

#### Workflow 2: Product Search API <a href="#workflow-2-product-search-api" id="workflow-2-product-search-api"></a>

**Goal:** Enable product search through an e-commerce API

**Steps:**

1. Select **API Agent** as Agent Mode
2. Configure API settings:
   * Method: GET
   * URL: `https://api.shop.com/products/search`
   * Headers: Add authentication headers
3. Add parameters:
   * Key: `query`, Value: `{search_term}`, Type: String, Content: AI Generate
   * Key: `category`, Value: `{category}`, Type: String, Content: AI Generate (optional)
   * Key: `limit`, Value: `10`, Type: Integer, Content: Predefined
4. In Configuration Guidance, write:

   ```
   Extract search terms and categories from product queries.
   Examples:
   - "Find red running shoes" → query: "running shoes", category: "shoes"
   - "Show me laptops under $1000" → query: "laptops", price filter logic
   - "I need a coffee maker" → query: "coffee maker", category: "kitchen"
   ```
5. Set up Response Synthesis to format product results with prices, descriptions, and links
6. Click **"Refresh Agent"**

**Result:** Users can search products conversationally: "Find me a good wireless keyboard under $50"

***

#### Workflow 3: Database Query API <a href="#workflow-3-database-query-api" id="workflow-3-database-query-api"></a>

**Goal:** Provide natural language access to database queries through an API

**Steps:**

1. Select **API Agent** as Agent Mode
2. Configure API settings:
   * Method: POST
   * URL: `https://api.company.com/database/query`
   * Headers: Add authentication and content-type headers
3. Add parameters:
   * Key: `query`, Value: `{sql_query}`, Type: String, Content: AI Generate
   * Key: `format`, Value: `json`, Type: String, Content: Predefined
4. In Configuration Guidance, write:

   ```
   Convert natural language questions to SQL queries.
   Database schema: customers(id, name, email), orders(id, customer_id, amount, date)

   Examples:
   - "How many customers do we have?" → SELECT COUNT(*) FROM customers
   - "Show orders from John Smith" → SELECT * FROM orders WHERE customer_id IN (SELECT id FROM customers WHERE name = 'John Smith')
   - "Total sales this month" → SELECT SUM(amount) FROM orders WHERE MONTH(date) = MONTH(CURRENT_DATE)

   Always use parameterized queries and validate input.
   ```
5. Configure Response Synthesis to format database results as readable tables or summaries
6. Click **"Refresh Agent"**

**Result:** Users can ask business questions like "What's our total revenue this quarter?" and get database results.

***

#### Workflow 4: Social Media Analytics API <a href="#workflow-4-social-media-analytics-api" id="workflow-4-social-media-analytics-api"></a>

**Goal:** Provide social media insights through analytics APIs

**Steps:**

1. Select **API Agent** as Agent Mode
2. Configure API settings:
   * Method: GET
   * URL: `https://api.socialplatform.com/analytics/posts`
   * Headers: Add API authentication
3. Add parameters:
   * Key: `account_id`, Value: `{account}`, Type: String, Content: AI Generate
   * Key: `date_from`, Value: `{start_date}`, Type: String, Content: AI Generate
   * Key: `date_to`, Value: `{end_date}`, Type: String, Content: AI Generate
   * Key: `metrics`, Value: `engagement,reach,impressions`, Type: Array, Content: Predefined
4. In Configuration Guidance, write:

   ```
   Extract account names, date ranges, and metrics from social media queries.
   Examples:
   - "How did our Instagram perform last week?" → account: "instagram", date_from: "7 days ago", date_to: "today"
   - "Twitter engagement for @company in January" → account: "@company", date_from: "2024-01-01", date_to: "2024-01-31"
   - Default to last 30 days if no date specified
   ```
5. Set up Response Synthesis to create visual summaries of social metrics
6. Click **"Refresh Agent"**

**Result:** Users can ask "How are our social media posts performing?" and get analytics insights.

***

#### Workflow 5: Customer Support Ticket API <a href="#workflow-5-customer-support-ticket-api" id="workflow-5-customer-support-ticket-api"></a>

**Goal:** Enable ticket creation and status checking through a support API

**Steps:**

1. Select **API Agent** as Agent Mode
2. Configure API settings:
   * Method: POST (for ticket creation) or GET (for status checking)
   * URL: `https://api.support.com/tickets`
   * Headers: Add authentication headers
3. Add parameters for ticket creation:
   * Key: `subject`, Value: `{issue_title}`, Type: String, Content: AI Generate
   * Key: `description`, Value: `{issue_details}`, Type: String, Content: Entire Context
   * Key: `priority`, Value: `{urgency}`, Type: String, Content: AI Generate
   * Key: `category`, Value: `{issue_type}`, Type: String, Content: AI Generate
4. In Configuration Guidance, write:

   ```
   Help users create support tickets from their descriptions.
   Examples:
   - "My laptop won't start" → subject: "Laptop won't power on", priority: "high", category: "hardware"
   - "Billing question about last month's charge" → subject: "Billing inquiry", priority: "medium", category: "billing"
   - "How do I reset my password?" → This might be a knowledge base question, not a ticket

   For status checks:
   - "What's the status of ticket #123?" → GET request with ticket ID
   ```
5. Configure Response Synthesis to provide clear ticket confirmation and next steps
6. Click **"Refresh Agent"**

**Result:** Users can create support tickets by describing their issues in natural language.

***

### Error Handling & Troubleshooting <a href="#error-handling--troubleshooting" id="error-handling--troubleshooting"></a>

#### Issue: API calls failing with authentication errors <a href="#issue-api-calls-failing-with-authentication-errors" id="issue-api-calls-failing-with-authentication-errors"></a>

**Cause:** Incorrect API keys or authentication headers.

**Solutions:**

1. **Verify API credentials:**
   * Check that API keys are correct and not expired
   * Ensure proper header format (Bearer token, Basic auth, etc.)
2. **Test API directly:**
   * Use tools like Postman or curl to test your API endpoint
   * Verify the API works with your credentials outside the agent
3. **Check header formatting:**
   * Ensure proper spacing and capitalization in header names
   * Verify token format matches API documentation

***

#### Issue: Parameters not being populated correctly <a href="#issue-parameters-not-being-populated-correctly" id="issue-parameters-not-being-populated-correctly"></a>

**Cause:** Configuration Guidance is unclear or insufficient.

**Solutions:**

1. **Improve guidance instructions:**
   * Add more specific examples of parameter extraction
   * Include edge cases and variations
2. **Test with simple queries:**
   * Start with straightforward queries to verify basic mapping
   * Gradually add complexity
3. **Check parameter content types:**
   * Ensure AI Generate parameters have clear guidance
   * Use Predefined for parameters that shouldn't change

***

#### Issue: API responses are not formatted properly <a href="#issue-api-responses-are-not-formatted-properly" id="issue-api-responses-are-not-formatted-properly"></a>

**Cause:** Response Synthesis instructions are inadequate.

**Solutions:**

1. **Enhance synthesis instructions:**
   * Provide specific formatting guidance
   * Include examples of desired output format
2. **Test API responses directly:**
   * Check the raw API response structure
   * Ensure synthesis instructions match the actual response format
3. **Simplify formatting:**
   * Start with basic field extraction
   * Gradually add formatting complexity

***

#### Issue: Agent creates incorrect API calls <a href="#issue-agent-creates-incorrect-api-calls" id="issue-agent-creates-incorrect-api-calls"></a>

**Cause:** URL or parameter configuration errors.

**Solutions:**

1. **Validate URL structure:**
   * Ensure the URL is complete and properly formatted
   * Check for missing protocols (https\://)
2. **Review parameter setup:**
   * Verify parameter names match API documentation
   * Check data types and content types are appropriate
3. **Test with known values:**
   * Use predefined parameter values to test API calls
   * Verify the API works with correct parameters

***

#### Issue: Complex nested parameters not working <a href="#issue-complex-nested-parameters-not-working" id="issue-complex-nested-parameters-not-working"></a>

**Cause:** Nested parameter structure is incorrect.

**Solutions:**

1. **Use schema import:**
   * Import JSON schema or example object to auto-generate nested structure
   * This ensures proper nesting and data types
2. **Manually configure nesting:**
   * Use the "nested" parameter type for complex objects
   * Add sub-parameters within nested structures
3. **Test with simple structures first:**
   * Start with flat parameter structures
   * Add nesting gradually as needed

***

#### Issue: Agent doesn't understand user queries <a href="#issue-agent-doesnt-understand-user-queries" id="issue-agent-doesnt-understand-user-queries"></a>

**Cause:** Configuration Guidance doesn't cover query variations.

**Solutions:**

1. **Expand guidance examples:**
   * Add more variations of how users might phrase queries
   * Include synonyms and alternative expressions
2. **Provide clearer patterns:**
   * Define specific patterns for parameter extraction
   * Include fallback logic for unclear queries
3. **Test with diverse queries:**
   * Try different ways users might ask for the same information
   * Refine guidance based on actual usage patterns

***

### Tips & Best Practices <a href="#tips--best-practices" id="tips--best-practices"></a>

#### ✓ Best Practice 1: Start with API Documentation <a href="#best-practice-1-start-with-api-documentation" id="best-practice-1-start-with-api-documentation"></a>

Always review your API documentation before configuration:

* **Understand authentication requirements** and header formats
* **Identify required vs. optional parameters** and their data types
* **Review response structures** to plan synthesis instructions
* **Test API endpoints directly** before integrating with the agent

***

#### ✓ Best Practice 2: Use Clear Parameter Naming <a href="#best-practice-2-use-clear-parameter-naming" id="best-practice-2-use-clear-parameter-naming"></a>

Make parameter extraction easier with consistent naming:

* **Use descriptive parameter names** that match API documentation
* **Avoid abbreviations** that might confuse the agent
* **Use consistent naming conventions** across similar parameters
* **Document parameter purposes** in configuration guidance

***

#### ✓ Best Practice 3: Provide Comprehensive Examples <a href="#best-practice-3-provide-comprehensive-examples" id="best-practice-3-provide-comprehensive-examples"></a>

Include diverse examples in Configuration Guidance:

* **Cover different query types** users might ask
* **Show parameter extraction** for each example
* **Include edge cases** and unusual query patterns
* **Demonstrate default value logic** for optional parameters

***

#### ✓ Best Practice 4: Plan Response Formatting <a href="#best-practice-4-plan-response-formatting" id="best-practice-4-plan-response-formatting"></a>

Design response presentation carefully:

* **Understand API response structure** before writing synthesis instructions
* **Define clear output formats** for different response types
* **Include error handling** for API failures or empty responses
* **Consider user experience** in response presentation

***

#### ✓ Best Practice 5: Test Incrementally <a href="#best-practice-5-test-incrementally" id="best-practice-5-test-incrementally"></a>

Build and test your API agent step by step:

* **Start with basic API calls** using predefined parameters
* **Add dynamic parameters** one at a time
* **Test with various queries** to ensure robust parameter extraction
* **Validate response formatting** with different API response scenarios

***

#### ✓ Best Practice 6: Handle API Limitations <a href="#best-practice-6-handle-api-limitations" id="best-practice-6-handle-api-limitations"></a>

Design for real-world API constraints:

* **Implement rate limiting awareness** in your guidance
* **Handle pagination** for large result sets
* **Plan for API downtime** with appropriate error messages
* **Consider data freshness** requirements for time-sensitive information

***

#### ✓ Best Practice 7: Secure Sensitive Information <a href="#best-practice-7-secure-sensitive-information" id="best-practice-7-secure-sensitive-information"></a>

Protect API credentials and sensitive data:

* **Use secure header storage** for API keys and tokens
* **Avoid logging sensitive parameters** in debug information
* **Implement proper access controls** for API agent usage
* **Regularly rotate API credentials** for security

***

#### ✓ Best Practice 8: Monitor and Optimize Performance <a href="#best-practice-8-monitor-and-optimize-performance" id="best-practice-8-monitor-and-optimize-performance"></a>

Track API agent usage and performance:

* **Monitor API call success rates** and error patterns
* **Track response times** and optimize slow queries
* **Analyze user query patterns** to improve parameter extraction
* **Update configurations** based on real usage data

***

### Understanding the Interface Elements <a href="#understanding-the-interface-elements" id="understanding-the-interface-elements"></a>

#### HTTP Method Dropdown <a href="#http-method-dropdown" id="http-method-dropdown"></a>

* **How it works:** Click to select GET, POST, or PUT
* **Used for:** Choosing the appropriate HTTP method for your API
* **Impact:** Changes parameter section label (Query Parameters vs Request Body Fields)

#### URL Input Field <a href="#url-input-field" id="url-input-field"></a>

* **How it works:** Type or paste your API endpoint URL
* **Validation:** Highlights invalid URLs in red
* **Features:** Supports dynamic parameters with curly braces

#### Headers Section <a href="#headers-section" id="headers-section"></a>

* **How it works:** Add/remove header key-value pairs
* **Used for:** Authentication, content-type specification, and API requirements
* **Common headers:** Authorization, Content-Type, Accept, User-Agent

#### Parameters Section <a href="#parameters-section" id="parameters-section"></a>

* **How it works:** Add parameters with different types and content sources
* **Types:** String, Integer, Boolean, Array, Nested
* **Content Types:** Predefined (static), AI Generate (dynamic), Entire Context (full query)

#### Schema Import <a href="#schema-import" id="schema-import"></a>

* **How it works:** Paste JSON schema or example object to auto-generate parameters
* **Benefits:** Automatically creates proper parameter structure and types
* **Formats:** JSON Schema format or sample API request object

#### Configuration Guidance <a href="#configuration-guidance" id="configuration-guidance"></a>

* **How it works:** Rich text editor for parameter mapping instructions
* **Purpose:** Guide the agent in extracting parameters from user queries
* **Best practice:** Include multiple examples and clear extraction rules

#### Response Synthesis <a href="#response-synthesis" id="response-synthesis"></a>

* **How it works:** Optional post-processing instructions for API responses
* **Purpose:** Format raw API data into user-friendly responses
* **When to use:** When API responses need transformation or summarization

***

### Quick Reference Guide <a href="#quick-reference-guide" id="quick-reference-guide"></a>

#### HTTP Methods Comparison <a href="#http-methods-comparison" id="http-methods-comparison"></a>

| Method   | Use Case                 | Parameter Location | Idempotent |
| -------- | ------------------------ | ------------------ | ---------- |
| **GET**  | Data retrieval           | Query parameters   | Yes        |
| **POST** | Data creation/submission | Request body       | No         |
| **PUT**  | Data updates             | Request body       | Yes        |

#### Parameter Content Types <a href="#parameter-content-types" id="parameter-content-types"></a>

| Type               | Use Case       | Population Method   | Example                          |
| ------------------ | -------------- | ------------------- | -------------------------------- |
| **Predefined**     | Static values  | Manual entry        | API keys, default limits         |
| **AI Generate**    | Dynamic values | Agent intelligence  | Location from "weather in Paris" |
| **Entire Context** | Full queries   | Complete user input | Search queries, descriptions     |

#### Common API Headers <a href="#common-api-headers" id="common-api-headers"></a>

| Header            | Purpose                    | Example Value        |
| ----------------- | -------------------------- | -------------------- |
| **Authorization** | API authentication         | `Bearer abc123token` |
| **Content-Type**  | Request body format        | `application/json`   |
| **Accept**        | Response format preference | `application/json`   |
| **User-Agent**    | Client identification      | `MyApp/1.0`          |

#### Parameter Extraction Patterns <a href="#parameter-extraction-patterns" id="parameter-extraction-patterns"></a>

**Location Extraction:**

* "Weather in Paris" → `{location}` = "Paris"
* "Restaurants near downtown" → `{location}` = "downtown"

**Date/Time Extraction:**

* "Last 7 days" → `{days}` = 7
* "From January to March" → `{start_date}` = "2024-01-01", `{end_date}` = "2024-03-31"

**Search Term Extraction:**

* "Find red shoes" → `{query}` = "red shoes", `{category}` = "shoes"
* "Jobs in marketing" → `{keywords}` = "marketing", `{type}` = "jobs"

***

### Frequently Asked Questions <a href="#frequently-asked-questions" id="frequently-asked-questions"></a>

**Q: How is API Agent different from other agent modes?** A: API Agent connects to external APIs and uses their data to answer questions. It acts as an interface to external data sources.

***

**Q: Can I use multiple APIs with one agent?** A: Currently, each API Agent configuration connects to one API endpoint. You can create multiple agents for different APIs or use a single agent that routes to different endpoints based on query analysis.

***

**Q: How secure are API keys and credentials?** A: API credentials are stored securely and used only for making authenticated API calls. Never expose sensitive credentials in agent responses or logs.

***

**Q: What if the API returns an error?** A: The agent will receive the error response and can be configured to handle it gracefully through response synthesis instructions, providing user-friendly error messages.

***

**Q: Can I modify API responses before showing them to users?** A: Yes, through Response Synthesis instructions. You can filter data, change formatting, add explanations, or combine information from multiple API calls.

***

**Q: How do I handle APIs that require complex authentication?** A: Use the Headers section to configure any authentication method your API requires, including Bearer tokens, API keys, Basic authentication, or custom authentication headers.

***

**Q: What if my API has a complex nested request structure?** A: Use the "nested" parameter type to create complex object structures. You can also import JSON schemas or example objects to automatically generate the proper parameter structure.

***

**Q: Can the agent handle file uploads to APIs?** A: While the current interface focuses on JSON APIs, you can configure parameters to handle file data. For complex file upload scenarios, consider additional API configuration.

***

**Q: How do I test my API configuration?** A: Use the chat interface to test queries and see how the agent populates parameters and calls the API. Check the response formatting to ensure it meets your requirements.

***

**Q: What if the API changes its structure?** A: You'll need to update your parameter configuration and possibly your Configuration Guidance and Response Synthesis instructions to match the new API structure.
