/health endpoint or a root / route.
AgentOS provides the on_route_conflict parameter to control how these conflicts are resolved, allowing you to choose whether your custom routes or AgentOS routes take precedence.
When to Use
Override routes when you need:- Custom health checks: Replace AgentOS’s
/healthendpoint with your own monitoring logic - Branded landing pages: Serve a custom homepage at
/instead of the default AgentOS interface - Custom authentication: Implement your own auth endpoints that conflict with AgentOS defaults
- API versioning: Control which version of an endpoint is exposed
- Custom error handlers: Define specialized error handling for specific routes
Configuration Options
AgentOS provides two values for theon_route_conflict parameter for handling route conflicts:
Non-conflicting routes from both your app and AgentOS are always included regardless of the mode.
Example
This example demonstrates usingon_route_conflict="preserve_base_app" to preserve custom routes for the home page and health endpoint.
override_routes.py