

# Service Design Specification
**airbnb-agenthub-service** documentation
**Version:** `1.0.0`

## Scope

This document provides a structured architectural overview of the `agentHub` microservice, detailing its configuration, data model, authorization logic, business rules, and API design. It has been automatically generated based on the service definition within Mindbricks, ensuring that the information reflects the source of truth used during code generation and deployment.

The document is intended to serve multiple audiences:

* **Service architects** can use it to validate design decisions and ensure alignment with broader architectural goals.
* **Developers and maintainers** will find it useful for understanding the structure and behavior of the service, facilitating easier debugging, feature extension, and integration with other systems.
* **Stakeholders and reviewers** can use it to gain a clear understanding of the service's capabilities and domain logic.

> **Note for Frontend Developers**: While this document is valuable for understanding business logic and data interactions, please refer to the [Service API Documentation](#) for endpoint-level specifications and integration details.

> **Note for Backend Developers**: Since the code for this service is automatically generated by Mindbricks, you typically won't need to implement or modify it manually. However, this document is especially valuable when you're building other services—whether within Mindbricks or externally—that need to interact with or depend on this service. It provides a clear reference to the service's data contracts, business rules, and API structure, helping ensure compatibility and correct integration.



## `AgentHub` Service Settings

AI Agent Hub

### Service Overview

This service is configured to listen for HTTP requests on port `3006`, 
serving both the main API interface and default administrative endpoints.

The following routes are available by default:

* **API Test Interface (API Face):** `/`
* **Swagger Documentation:** `/swagger`
* **Postman Collection Download:** `/getPostmanCollection`
* **Health Checks:** `/health` and `/admin/health`
* **Current Session Info:** `/currentuser`
* **Favicon:** `/favicon.ico`

The service uses a **PostgreSQL** database for data storage, with the database name set to `airbnb-agenthub-service`.

This service is accessible via the following environment-specific URLs:

* **Preview:** `https://airbnb3.prw.mindbricks.com/agenthub-api`
* **Staging:** `https://airbnb3-stage.mindbricks.co/agenthub-api`
* **Production:** `https://airbnb3.mindbricks.co/agenthub-api`

                                 

### Authentication & Security
- **Login Required**: Yes

This service requires user authentication for access. It supports both JWT and RSA-based authentication mechanisms, ensuring secure user sessions and data integrity.
If a crud route also is configured to require login, 
it will check a valid JWT token in the request query/header/bearer/cookie. If the token is valid, it will extract the user information from the token and make the fetched session data available in the request context.

  
### Service Data Objects
The service uses a **PostgreSQL** database for data storage, with the database name set to `airbnb-agenthub-service`.

Data deletion is managed using a **soft delete** strategy. Instead of removing records from the database, they are flagged as inactive by setting the `isActive` field to `false`.



| Object Name | Description | Public Access |
|-------------|-------------|---------------|
| `sys_agentOverride` | Runtime overrides for design-time agents. Null fields use the design default. | accessProtected | 
| `sys_agentExecution` | Agent execution log. Records each agent invocation with input, output, and performance metrics. | accessProtected | 
| `sys_toolCatalog` | Cached tool catalog discovered from project services. Refreshed periodically. | accessProtected | 




## sys_agentOverride Data Object

### Object Overview
**Description:** Runtime overrides for design-time agents. Null fields use the design default.

This object represents a core data structure within the service and acts as the blueprint for database interaction, API generation, and business logic enforcement. 
It is defined using the `ObjectSettings` pattern, which governs its behavior, access control, caching strategy, and integration points with other systems such as Stripe and Redis.

### Core Configuration
- **Soft Delete:** Disabled — Determines whether records are marked inactive (`isActive = false`) instead of being physically deleted.
- **Public Access:** accessProtected — If enabled, anonymous users may access this object’s data depending on API-level rules.








### Properties Schema


| Property | Type | Required | Description |
|----------|------|----------|-------------|
| `agentName` | String | Yes | Design-time agent name this override applies to. |
| `provider` | String | No | Override AI provider (e.g., openai, anthropic). |
| `model` | String | No | Override model name. |
| `systemPrompt` | Text | No | Override system prompt. |
| `temperature` | Double | No | Override temperature (0-2). |
| `maxTokens` | Integer | No | Override max tokens. |
| `responseFormat` | String | No | Override response format (text/json). |
| `selectedTools` | Object | No | Array of tool names from the catalog that this agent can use. |
| `guardrails` | Object | No | Override guardrails: { maxToolCalls, timeout, maxTokenBudget }. |
| `enabled` | Boolean | Yes | Enable or disable this agent. |
| `updatedBy` | ID | No | User who last updated this override. |
* Required properties are mandatory for creating objects and must be provided in the request body if no default value is set.



### Default Values
Default values are automatically assigned to properties when a new object is created, if no value is provided in the request body.
Since default values are applied on db level, they should be literal values, not expressions.If you want to use expressions, you can use transposed parameters in any business API to set default values dynamically.

- **agentName**: 'default'
- **enabled**: true

### Always Create with Default Values
Some of the default values are set to be always used when creating a new object, even if the property value is provided in the request body. It ensures that the property is always initialized with a default value when the object is created.

- **enabled**: Will be created with value `true`


### Constant Properties

`agentName`

Constant properties are defined to be immutable after creation, meaning they cannot be updated or changed once set. They are typically used for properties that should remain constant throughout the object's lifecycle.
A property is set to be constant if the `Allow Update` option is set to `false`.


### Auto Update Properties

`agentName` `provider` `model` `systemPrompt` `temperature` `maxTokens` `responseFormat` `selectedTools` `guardrails` `enabled` `updatedBy`

An update crud API created with the option `Auto Params` enabled will automatically update these properties with the provided values in the request body. 
If you want to update any property in your own business logic not by user input, you can set the `Allow Auto Update` option to false.
These properties will be added to the update API's body parameters and can be updated by the user if any value is provided in the request body.

 



 

 

### Elastic Search Indexing

`agentName` `enabled`

Properties that are indexed in Elastic Search will be searchable via the Elastic Search API. 
While all properties are stored in the elastic search index of the data object, only those marked for Elastic Search indexing will be available for search queries.


### Database Indexing

`agentName` `enabled`

Properties that are indexed in the database will be optimized for query performance, allowing for faster data retrieval.
Make a property indexed in the database if you want to use it frequently in query filters or sorting.


### Unique Properties

`agentName`

Unique properties are enforced to have distinct values across all instances of the data object, preventing duplicate entries.
Note that a unique property is automatically indexed in the database so you will not need to set the `Indexed in DB` option.






### Session Data Properties

`updatedBy`

Session data properties are used to store data that is specific to the user session, allowing for personalized experiences and temporary data storage.
If a property is configured as session data, it will be automatically mapped to the related field in the user session during CRUD operations.
Note that session data properties can not be mutated by the user, but only by the system.

- **updatedBy**: ID property will be mapped to the session parameter `userId`.









## sys_agentExecution Data Object

### Object Overview
**Description:** Agent execution log. Records each agent invocation with input, output, and performance metrics.

This object represents a core data structure within the service and acts as the blueprint for database interaction, API generation, and business logic enforcement. 
It is defined using the `ObjectSettings` pattern, which governs its behavior, access control, caching strategy, and integration points with other systems such as Stripe and Redis.

### Core Configuration
- **Soft Delete:** Disabled — Determines whether records are marked inactive (`isActive = false`) instead of being physically deleted.
- **Public Access:** accessProtected — If enabled, anonymous users may access this object’s data depending on API-level rules.








### Properties Schema


| Property | Type | Required | Description |
|----------|------|----------|-------------|
| `agentName` | String | Yes | Agent that was executed. |
| `agentType` | Enum | Yes | Whether this was a design-time or dynamic agent. |
| `source` | Enum | Yes | How the agent was triggered. |
| `userId` | ID | No | User who triggered the execution. |
| `input` | Object | No | Request input (truncated for large payloads). |
| `output` | Object | No | Response output (truncated for large payloads). |
| `toolCalls` | Integer | No | Number of tool calls made during execution. |
| `tokenUsage` | Object | No | Token usage: { prompt, completion, total }. |
| `durationMs` | Integer | No | Execution time in milliseconds. |
| `status` | Enum | Yes | Execution status. |
| `error` | Text | No | Error message if execution failed. |
* Required properties are mandatory for creating objects and must be provided in the request body if no default value is set.



### Default Values
Default values are automatically assigned to properties when a new object is created, if no value is provided in the request body.
Since default values are applied on db level, they should be literal values, not expressions.If you want to use expressions, you can use transposed parameters in any business API to set default values dynamically.

- **agentName**: 'default'
- **agentType**: "design"
- **source**: "rest"
- **status**: "success"


### Constant Properties

`agentName` `agentType` `source` `userId` `input` `output` `toolCalls` `tokenUsage` `durationMs` `status` `error`

Constant properties are defined to be immutable after creation, meaning they cannot be updated or changed once set. They are typically used for properties that should remain constant throughout the object's lifecycle.
A property is set to be constant if the `Allow Update` option is set to `false`.


### Auto Update Properties

`agentName` `agentType` `source` `userId` `input` `output` `toolCalls` `tokenUsage` `durationMs` `status` `error`

An update crud API created with the option `Auto Params` enabled will automatically update these properties with the provided values in the request body. 
If you want to update any property in your own business logic not by user input, you can set the `Allow Auto Update` option to false.
These properties will be added to the update API's body parameters and can be updated by the user if any value is provided in the request body.

 


### Enum Properties
Enum properties are defined with a set of allowed values, ensuring that only valid options can be assigned to them. 
The enum options value will be stored as strings in the database, 
but when a data object is created an addtional property with the same name plus an idx suffix will be created, which will hold the index of the selected enum option.
You can use the index property to sort by the enum value or when your enum options represent a sequence of values.

- **agentType**: [design, dynamic]

- **source**: [rest, sse, kafka, agent]

- **status**: [success, error, timeout]


 

 

### Elastic Search Indexing

`agentName` `agentType` `source` `userId` `toolCalls` `durationMs` `status`

Properties that are indexed in Elastic Search will be searchable via the Elastic Search API. 
While all properties are stored in the elastic search index of the data object, only those marked for Elastic Search indexing will be available for search queries.


### Database Indexing

`agentName` `agentType` `source` `userId` `status`

Properties that are indexed in the database will be optimized for query performance, allowing for faster data retrieval.
Make a property indexed in the database if you want to use it frequently in query filters or sorting.










### Filter Properties

`agentName` `agentType` `source` `userId` `status`

Filter properties are used to define parameters that can be used in query filters, allowing for dynamic data retrieval based on user input or predefined criteria.
These properties are automatically mapped as API parameters in the listing API's that have "Auto Params" enabled.

- **agentName**: String  has a filter named `agentName`

- **agentType**: Enum  has a filter named `agentType`

- **source**: Enum  has a filter named `source`

- **userId**: ID  has a filter named `userId`

- **status**: Enum  has a filter named `status`





## sys_toolCatalog Data Object

### Object Overview
**Description:** Cached tool catalog discovered from project services. Refreshed periodically.

This object represents a core data structure within the service and acts as the blueprint for database interaction, API generation, and business logic enforcement. 
It is defined using the `ObjectSettings` pattern, which governs its behavior, access control, caching strategy, and integration points with other systems such as Stripe and Redis.

### Core Configuration
- **Soft Delete:** Disabled — Determines whether records are marked inactive (`isActive = false`) instead of being physically deleted.
- **Public Access:** accessProtected — If enabled, anonymous users may access this object’s data depending on API-level rules.








### Properties Schema


| Property | Type | Required | Description |
|----------|------|----------|-------------|
| `toolName` | String | Yes | Full tool name (e.g., service:apiName). |
| `serviceName` | String | Yes | Source service name. |
| `description` | Text | No | Tool description. |
| `parameters` | Object | No | JSON Schema of tool parameters. |
| `lastRefreshed` | Date | No | When this tool was last discovered/refreshed. |
* Required properties are mandatory for creating objects and must be provided in the request body if no default value is set.



### Default Values
Default values are automatically assigned to properties when a new object is created, if no value is provided in the request body.
Since default values are applied on db level, they should be literal values, not expressions.If you want to use expressions, you can use transposed parameters in any business API to set default values dynamically.

- **toolName**: 'default'
- **serviceName**: 'default'



### Auto Update Properties

`toolName` `serviceName` `description` `parameters` `lastRefreshed`

An update crud API created with the option `Auto Params` enabled will automatically update these properties with the provided values in the request body. 
If you want to update any property in your own business logic not by user input, you can set the `Allow Auto Update` option to false.
These properties will be added to the update API's body parameters and can be updated by the user if any value is provided in the request body.

 



 

 

### Elastic Search Indexing

`toolName` `serviceName` `description`

Properties that are indexed in Elastic Search will be searchable via the Elastic Search API. 
While all properties are stored in the elastic search index of the data object, only those marked for Elastic Search indexing will be available for search queries.


### Database Indexing

`toolName` `serviceName`

Properties that are indexed in the database will be optimized for query performance, allowing for faster data retrieval.
Make a property indexed in the database if you want to use it frequently in query filters or sorting.


### Unique Properties

`toolName`

Unique properties are enforced to have distinct values across all instances of the data object, preventing duplicate entries.
Note that a unique property is automatically indexed in the database so you will not need to set the `Indexed in DB` option.









### Filter Properties

`serviceName`

Filter properties are used to define parameters that can be used in query filters, allowing for dynamic data retrieval based on user input or predefined criteria.
These properties are automatically mapped as API parameters in the listing API's that have "Auto Params" enabled.

- **serviceName**: String  has a filter named `serviceName`







## Business Logic



agentHub has got 9 Business APIs to manage its internal and crud logic. 
For the details of each business API refer to its chapter.

* [Get Agentoverride](/businessLogic/getagentoverride)

* [List Agentoverrides](/businessLogic/listagentoverrides)

* [Update Agentoverride](/businessLogic/updateagentoverride)

* [Create Agentoverride](/businessLogic/createagentoverride)

* [Delete Agentoverride](/businessLogic/deleteagentoverride)

* [List Toolcatalog](/businessLogic/listtoolcatalog)

* [Get Toolcatalogentry](/businessLogic/gettoolcatalogentry)

* [List Agentexecutions](/businessLogic/listagentexecutions)

* [Get Agentexecution](/businessLogic/getagentexecution)



















---

*This document was generated from the service architecture definition and should be kept in sync with implementation changes.*