Skip to main content

Agent Architecture

Every agent must implement 2 required endpoints (GET /tools and POST /tools/:toolName) and 1 optional endpoint (POST /resource):

1. GET /tools (Required)

Returns available tools for the agent. Response Type: ToolsResponseDto
Example from Slack Agent:

⚠️ Important: Reserved Keywords

When defining tool parameters, be aware that certain keywords are reserved by the system and cannot be used as property names. Using these reserved keywords will result in validation errors Following keywords are reserved:
  • executionId
  • chatId
  • userId
  • toolName
💡 Tip: If you need to use a similar concept, consider prefixing or suffixing the property name Example:

2. POST /tools/:toolName (Required)

Executes a specific tool with provided parameters. Parameters:
  • toolName (path parameter): Name of the tool to execute
  • Request body: Tool-specific parameters
Response Type: BaseErrorResponseDto | BaseSuccessResponseDto<any>

3. POST /resource (Optional)

Provides contextual information about the current user or environment to help the agent work effectively. Example Use Cases:
  • GitHub agent: Return user’s profile and repositories
  • MongoDB agent: Return database schema information
  • Slack agent: Return user’s workspace info and frequent contacts

Authentication

All requests include authentication headers:

API Key Authentication

  • Header: x-api-key
    • Used to authenticate the server making the request
    • Required for all endpoints

OAuth Authentication (Optional)

  • Header: x-api-key
    • Used to authenticate the server making the request
    • Required for all endpoints
  • Header: Authorization: Bearer <token>
    • Used for agents requiring user-specific OAuth tokens
    • Examples: Twitter, Slack, GitHub agents

Variable Headers (Optional)

  • Header: x-api-key
    • Used to authenticate the server making the request
    • Required for all endpoints
  • Header: x-<variablename>
    • Used for agent-specific configuration
    • Example: x-dburi for MongoDB agent

Tool Definition Structure

Each tool in the ToolsResponseDto follows this structure:

Best Practices

  1. Error Handling: Always return proper error responses using BaseErrorResponseDto
  2. Parameter Validation: Validate all input parameters according to the tool schema
  3. Authentication: Implement proper guards for API key and OAuth validation
  4. Documentation: Provide clear descriptions for tools and parameters
  5. Response Types: Use appropriate response types (text, html, media, mixed)
  6. Confirmation: Set confirmationRequired: true for critical operations