DEV Community

Cover image for RouteWise AI
BinaryGarge.dev
BinaryGarge.dev Subscriber

Posted on

RouteWise AI

Auth0 for AI Agents Challenge Submission

RouteWise AI - Auth0 for AI Agents Challenge Submission

This is a submission for the Auth0 for AI Agents Challenge

What I Built

RouteWise AI is an intelligent rideshare platform that revolutionizes the transportation experience through AI-powered agents that work seamlessly with Auth0 for AI Agents security. The platform addresses real-world challenges in ride-sharing by providing personalized, secure, and intelligent transportation services.

Core Problem Solved

Traditional rideshare platforms lack personalization and intelligent decision-making. RouteWise AI solves this by:

  • Intelligent Ride Matching: AI agents analyze passenger preferences and driver capabilities to optimize matches
  • Personalized Experience: AI agents curate music, climate, and conversation preferences for each ride
  • Safety Monitoring: Continuous AI-powered safety analysis throughout the journey
  • Secure Multi-Role Authentication: Role-based access control for passengers, drivers, and AI agents

Key Features

  • 🤖 Multi-Agent AI System: Specialized AI agents for different aspects of the ride experience
  • 🔐 Secure Authentication: Auth0 for AI Agents manages user authentication and agent permissions
  • 🎵 Smart Personalization: AI agents access Spotify, weather, and maps APIs on user's behalf
  • 📊 Real-time Analytics: AI agents monitor ride safety and performance metrics
  • 🌍 Multi-Service Integration: Seamless integration with Google Maps, OpenAI, Spotify, and weather services

Demo

Live Application: https://routewise-ai.vercel.app

Demo Credentials:

  • Login: driver@sample.com / Driver1234

Repository: https://github.com/binarygaragedev/RouteWise

Screenshots

1. Authentication Flow


Secure multi-role authentication powered by Auth0 for AI Agents

2. Passenger Experience


Passenger can set detailed preferences that AI agents use for personalization

3. AI Agent Preferences


Comprehensive preference system where AI agents learn user behavior

4. Driver Interface

Drivers can view AI-generated insights about passenger preferences and ride optimization

5. AI Agent in Action

AI Agent Working
Real-time view of AI agents making decisions and accessing APIs securely

How I Used Auth0 for AI Agents

1. User Authentication Security

RouteWise implements Auth0's robust authentication to secure the humans interacting with the platform:

// Multi-role authentication setup
export const authConfig = {
  domain: process.env.AUTH0_ISSUER_BASE_URL,
  clientId: process.env.AUTH0_CLIENT_ID,
  clientSecret: process.env.AUTH0_CLIENT_SECRET,
  baseURL: process.env.AUTH0_BASE_URL,
  secret: process.env.AUTH0_SECRET
};
Enter fullscreen mode Exit fullscreen mode

Role-Based Access Control:

  • Passengers: Access to booking, preferences, and ride history
  • Drivers: Access to ride assignments, passenger insights, and earnings
  • Admin: Full system access and AI agent management

2. Token Vault for API Access Control

The platform leverages Auth0's Token Vault to securely manage which APIs each AI agent can access:

// Token Vault integration for secure API access
class TokenVault {
  async getSecureToken(userId: string, service: string) {
    const response = await fetch(`${process.env.AUTH0_ISSUER_BASE_URL}/oauth/token`, {
      method: 'POST',
      headers: { 'Content-Type': 'application/json' },
      body: JSON.stringify({
        client_id: process.env.AUTH0_MANAGEMENT_CLIENT_ID,
        client_secret: process.env.AUTH0_MANAGEMENT_CLIENT_SECRET,
        audience: process.env.AUTH0_AUDIENCE,
        grant_type: 'client_credentials'
      })
    });
    return response.json();
  }
}
Enter fullscreen mode Exit fullscreen mode

Controlled API Access:

  • Spotify API: AI agents access music preferences only with user consent
  • Google Maps API: Location services restricted by user privacy settings
  • Weather API: Environmental data access for comfort optimization
  • OpenAI API: LLM access controlled by user interaction permissions

3. AI Agent Authorization Framework

Each AI agent operates within strict authorization boundaries:

Consent Negotiation Agent

export class ConsentNegotiationAgent extends BaseAgent {
  async negotiateAPIAccess(userId: string, requestedAPIs: string[]) {
    // Check user permissions through Auth0 Token Vault
    const permissions = await this.tokenVault.getUserPermissions(userId);

    // Only request access to APIs user has consented to
    const allowedAPIs = requestedAPIs.filter(api => 
      permissions.includes(api)
    );

    return this.createSecureAPISession(userId, allowedAPIs);
  }
}
Enter fullscreen mode Exit fullscreen mode

Safety Monitoring Agent

export class SafetyMonitoringAgent extends BaseAgent {
  async monitorRide(rideId: string) {
    // Access location data only if user granted permission
    const hasLocationPermission = await this.checkPermission(
      rideId, 'location_monitoring'
    );

    if (hasLocationPermission) {
      return this.analyzeRideSafety(rideId);
    }
  }
}
Enter fullscreen mode Exit fullscreen mode

4. Fine-Grained RAG Authorization

The platform implements authorization directly in the RAG pipeline:

// Authorized knowledge retrieval for AI agents
class AuthorizedRAG {
  async retrieveUserContext(userId: string, query: string) {
    // Check what user data the agent is authorized to access
    const dataPermissions = await this.auth0.getUserDataPermissions(userId);

    // Filter knowledge base by permissions
    const authorizedData = await this.vectorDB.query(query, {
      userId,
      permissions: dataPermissions,
      exclude: ['sensitive_personal_data', 'payment_info']
    });

    return authorizedData;
  }
}
Enter fullscreen mode Exit fullscreen mode

5. Passenger Preference System

Passengers can set detailed preferences that AI agents use securely:

Music Preferences:

  • Spotify integration through Token Vault
  • Genre preferences (Jazz, Rock, Classical, etc.)
  • Energy level settings (Low, Medium, High)
  • Artist preferences with secure API access

Climate Preferences:

  • Preferred temperature settings
  • AC preferences (Auto, On, Off)
  • Weather-based adjustments through authorized weather API

Conversation Preferences:

  • Interaction levels (Silent, Minimal, Friendly, Chatty)
  • Topic preferences for AI agent conversations
  • Privacy boundaries for personal data sharing

6. Driver Insights Dashboard

Drivers receive AI-generated insights while respecting passenger privacy:

Authorized Information:

  • General comfort preferences (temperature, music genre)
  • Estimated ride duration and route optimization
  • Safety scores and trip analytics
  • Non-identifying preference patterns

Protected Information:

  • Specific personal details remain encrypted
  • Location history protected by Auth0 permissions
  • Payment information completely isolated

Lessons Learned and Takeaways

Technical Challenges and Solutions

1. Multi-Agent Coordination Security

  • Challenge: Managing multiple AI agents accessing different APIs securely
  • Solution: Implemented Auth0 Token Vault to create isolated permission scopes for each agent
  • Learning: Fine-grained permissions are crucial for AI agent security

2. Real-time Permission Management

  • Challenge: Users changing permissions while AI agents are active
  • Solution: Built reactive permission system that updates agent capabilities in real-time
  • Learning: Auth0's webhook system enables seamless permission updates

3. RAG Pipeline Authorization

  • Challenge: Ensuring AI agents only access authorized user data in vector databases
  • Solution: Implemented permission-based filtering at the vector query level
  • Learning: Security must be built into every layer of the AI pipeline

Key Insights

Authentication is Foundation, Not Afterthought
Building security with Auth0 for AI Agents from the start created a robust foundation. Retrofitting security would have been significantly more complex.

Token Vault Enables True AI Agent Autonomy
The Token Vault allows AI agents to work independently while maintaining strict security boundaries. This enables sophisticated automation while preserving user control.

User Trust Through Transparency
Showing users exactly what permissions each AI agent has builds trust. The preference system makes AI behavior predictable and user-controlled.

Performance vs Security Balance
Implementing proper authorization checks adds latency, but Auth0's optimized token management keeps the impact minimal while maintaining security.

Advice for Other Developers

  1. Start with Security Architecture: Design your AI agent permissions before building features
  2. Use Token Vault Early: Integrate the Token Vault pattern from the beginning rather than retrofitting
  3. Implement Granular Permissions: Fine-grained control is essential for AI agent trust
  4. Build Permission UI: Users need clear visibility into what AI agents can access
  5. Test Edge Cases: Permission changes, expired tokens, and network failures need robust handling

Real-World Impact

RouteWise AI demonstrates how Auth0 for AI Agents solves critical real-world problems:

  • Transportation Safety: AI agents monitor rides while respecting privacy
  • Personalization at Scale: Secure access to user preferences enables mass customization
  • Service Integration: Multiple APIs work together through controlled agent access
  • User Empowerment: Users maintain control over their data while benefiting from AI automation

The platform proves that secure AI agent authentication isn't just possible—it's essential for building trust in AI-powered services that handle sensitive user data and real-world interactions.


Built with: Next.js 14, TypeScript, Auth0 for AI Agents, Supabase, OpenAI, Google Maps API, Spotify API, Vercel

Team: @binarygaragedev

Top comments (0)