Add Interface Command

The agent interfaces add command configures a new API interface for a specific AI Agent, enabling access to a group of related API endpoints.

Usage

xpander agent interfaces add <agent_id> <interface_name> [--config <json>] [--file <path>]

Options

OptionDescription
--config <json>Optional. Interface configuration in JSON format
--file <path>Optional. Path to configuration file

Examples

Add Articles Interface

xpander agent interfaces add agent_123 articles --config '{
  "auth": {
    "type": "oauth2",
    "client_id": "${ARTICLES_CLIENT_ID}",
    "client_secret": "${ARTICLES_CLIENT_SECRET}"
  },
  "endpoints": {
    "search_articles": {
      "enabled": true,
      "rate_limit": 100,
      "timeout": "5s"
    },
    "create_article": {
      "enabled": false
    }
  },
  "default_params": {
    "query_params": {
      "format": "json",
      "version": "v2"
    }
  }
}'

Response:

Adding Interface
===============
Agent: Support Agent (agent_123)
Interface: articles
Status: configuring

Step 1/3: Validating Configuration
✓ Auth configuration valid
✓ Endpoint settings valid
✓ Parameters valid

Step 2/3: Setting Up Interface
✓ Authentication configured
✓ Endpoints initialized
✓ Rate limits applied
✓ Default parameters set

Step 3/3: Testing Connection
✓ Authentication successful
✓ Endpoints accessible
✓ Parameters working

Interface added successfully!
Available endpoints:
1. search_articles
   - Method: GET
   - Rate Limit: 100/minute
   - Timeout: 5s
   - Status: enabled

2. create_article
   - Method: POST
   - Status: disabled

Note: Use 'agent interfaces test articles' to verify functionality

Add Knowledge Base Interface

xpander agent interfaces add agent_123 knowledge_base --file ./kb-config.json

Response:

Adding Interface
===============
Agent: Support Agent (agent_123)
Interface: knowledge_base
Status: configuring

Configuration loaded from: ./kb-config.json
✓ Configuration valid
✓ Interface added
5 endpoints configured

Available endpoints:
1. search_knowledge
   - Method: GET
   - Rate Limit: 200/minute
   - Status: enabled

2. get_article
   - Method: GET
   - Rate Limit: 300/minute
   - Status: enabled

3. list_categories
   - Method: GET
   - Rate Limit: 100/minute
   - Status: enabled

Note: Use 'agent interfaces test knowledge_base' to verify functionality

Configuration Format

{
  "auth": {
    "type": "oauth2|apikey|basic",
    "client_id": "string",
    "client_secret": "string",
    "scope": ["string"]
  },
  "endpoints": {
    "endpoint_name": {
      "enabled": boolean,
      "rate_limit": number,
      "timeout": "string",
      "retry": {
        "max_attempts": number,
        "backoff": "string"
      }
    }
  },
  "default_params": {
    "query_params": {
      "key": "value"
    },
    "headers": {
      "key": "value"
    }
  }
}

Notes

  • Each interface provides:
    • Multiple API endpoints
    • Authentication configuration
    • Rate limiting settings
    • Default parameters
  • Configuration supports:
    • Endpoint enabling/disabling
    • Rate limit customization
    • Timeout settings
    • Retry policies
  • Authentication types:
    • OAuth2
    • API Key
    • Basic Auth
  • Environment variables:
    • Use for sensitive data
    • Referenced with $
  • Testing:
    • Validates authentication
    • Checks endpoint access
    • Verifies parameters
  • Use agent interfaces list to view available interfaces
  • Use agent interfaces test to verify configuration

Changelog