INTEGRITY Documentation

JSON Configuration

Instead of using the dashboard editor UI to define the route graph, you can do it using the REST API. Routes are internally represented using a simple JSON structure:

{
  "id": "<route id>",
  "name": "<route name>",
  "elements": [<array of elements>]
}

Supported elements

Dynamic routing supports several types of elements that you can combine to create sophisticated routing flows. Each element has specific inputs, outputs, and configuration options.

Start Element

Marks the beginning of a route. Every route must start with a Start element.

{
	"id": "<id>",
	"type": "start",
	"outputs": {
		"next": { "elementId": "<id>" }
	}
}

Conditional Element (If/Else)

Evaluates a condition based on request parameters and routes the request accordingly.

conditions supports MongoDB-like operators such as $eq, $ne, $in, $and, and $or.

{
	"id": "<id>",
	"type": "conditional",
	"properties": {
		"conditions": {
			"metadata.plan": { "$eq": "free" }
		}
	},
	"outputs": {
		"true": { "elementId": "<id>" },
		"false": { "elementId": "<id>" }
	}
}

Percentage Split

Routes requests probabilistically across multiple outputs, useful for A/B testing and gradual rollouts.

{
	"id": "<id>",
	"type": "percentage",
	"outputs": {
		"10%": { "elementId": "<id>" },
		"40%": { "elementId": "<id>" },
		"50%": { "elementId": "<id>" }
	}
}

Rate/Budget Limit

Apply limits based on request metadata. Supports both count-based and cost-based limits.

Properties:

{
	"id": "<id>",
	"type": "rate",
	"properties": {
		"limitType": "count",
		"key": "metadata.user_id",
		"limit": 100,
		"window": 3600
	},
	"outputs": {
		"success": { "elementId": "node_model_workers_ai" },
		"fallback": { "elementId": "node_model_openai_mini" }
	}
}

Model

Executes inference using a specified model and provider with configurable timeout and retry settings.

Properties:

{
	"id": "<id>",
	"type": "model",
	"properties": {
		"provider": "openai",
		"model": "gpt-4o-mini",
		"timeout": 60000,
		"retries": 4
	},
	"outputs": {
		"success": { "elementId": "<id>" },
		"fallback": { "elementId": "<id>" }
	}
}

End element

Marks the end of a route. Returns the last successful model response, or an error if no model response was generated.

{
	"id": "<id>",
	"type": "end",
	"outputs": {}
}