Skip to main content
When integrating your custom FastAPI application with AgentOS, route conflicts can occur if both your app and AgentOS define the same endpoint paths. For example, both might define a /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 /health endpoint 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 the on_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 using on_route_conflict="preserve_base_app" to preserve custom routes for the home page and health endpoint.
override_routes.py