Agent API supports custom routes to direct requests based on path, method, headers, and query parameters.
Create a route
-
Log on to the AI Gateway console and select the region where your instance is located.
-
Go to the instance details page. In the navigation pane on the left, choose Agent API.
-
Click Create Route. In the Create Route panel, configure the following settings:
-
Route Name: Enter a name for the route.
-
Path: Specify the path to match in the HTTP request.
-
If multiple routes use the same match type, the route with the longer path has higher priority.
-
If routes have different match types, the priority order is Equals To > Prefix > Regular Expression Match.
-
Equals To: The path must be an exact match. For example,
/user. -
Prefix: The path must start with the specified prefix. For example,
/user. -
Regular Expression Match: The path must match the specified regular expression.
-
-
-
More Match Rules: To create multiple routes with the same path, configure Method, Header, and Query Parameters to differentiate them.
-
Services: By default, the list does not display services whose names start with "consumers".
-
Edit a route
-
Log on to the AI Gateway console and select the region where your instance is located.
-
Go to the instance details page. In the navigation pane on the left, choose Agent API.
-
On the route list page, find the target route and click Edit Route on the right. Modify the Basic Information and Backend Services settings. Click OK.
Publish a route
-
Log on to the AI Gateway console and select the region where your instance is located.
-
Go to the instance details page. In the navigation pane on the left, choose Agent API.
-
On the route list page, find the target route and click Publish Route on the right. In the confirmation dialog box, click OK.
Unpublish a route
-
Log on to the AI Gateway console and select the region where your instance is located.
-
Go to the instance details page. In the navigation pane on the left, choose Agent API.
-
On the route list page, find the target route, click the
icon, and then click Shutdown. In the Confirm unpublish dialog box, click Shutdown.
Delete a route
You can only delete unpublished routes.
-
Log on to the AI Gateway console and select the region where your instance is located.
-
Go to the instance details page. In the navigation pane on the left, choose Agent API.
-
On the route list page, find the target route, click the
icon, and then click Delete. In the confirmation dialog box, click Delete.