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

The on_route_conflict parameter accepts three values:
OptionCustom RoutesAgentOS RoutesOn Conflict
preserve_base_app✓ Preserved✗ Skipped (conflicts only)Logs at debug level
preserve_agentos (default)✗ Overridden✓ PreservedLogs a warning
errorN/AN/ARaises ValueError
Non-conflicting routes from both your app and AgentOS are always included in the two preserve modes.

Example

The example below uses on_route_conflict="preserve_base_app" to preserve custom routes for the home page and health endpoint.
override_routes.py