Skip to content
Learn Agentic AI
Learn Agentic AI14 min read6 views

AI Agent for Campus Navigation: Building Tour, Room Finding, and Event Discovery

Build a campus navigation AI agent that provides building directions, helps find rooms, integrates with event calendars, and delivers facility information to students, staff, and visitors.

University campuses are small cities. With dozens of buildings, multiple floors, renamed halls, construction detours, and hundreds of events, even returning students get lost. A campus navigation agent serves students, faculty, and visitors by providing directions, locating rooms, surfacing upcoming events, and sharing facility details like operating hours and accessibility information.

Campus Data Model

The foundation is a structured representation of buildings, rooms, and events.

Hear it before you finish reading

Talk to a live CallSphere AI voice agent in your browser — 60 seconds, no signup.

Try Live Demo →
flowchart LR
    INPUT(["User intent"])
    PARSE["Parse plus<br/>classify"]
    PLAN["Plan and tool<br/>selection"]
    AGENT["Agent loop<br/>LLM plus tools"]
    GUARD{"Guardrails<br/>and policy"}
    EXEC["Execute and<br/>verify result"]
    OBS[("Trace and metrics")]
    OUT(["Outcome plus<br/>next action"])
    INPUT --> PARSE --> PLAN --> AGENT --> GUARD
    GUARD -->|Pass| EXEC --> OUT
    GUARD -->|Fail| AGENT
    AGENT --> OBS
    style AGENT fill:#4f46e5,stroke:#4338ca,color:#fff
    style GUARD fill:#f59e0b,stroke:#d97706,color:#1f2937
    style OBS fill:#ede9fe,stroke:#7c3aed,color:#1e1b4b
    style OUT fill:#059669,stroke:#047857,color:#fff
from dataclasses import dataclass, field
from enum import Enum
from datetime import datetime, time
from typing import Optional

class BuildingType(Enum):
    ACADEMIC = "academic"
    ADMINISTRATIVE = "administrative"
    RESIDENTIAL = "residential"
    ATHLETIC = "athletic"
    LIBRARY = "library"
    DINING = "dining"
    PARKING = "parking"

class AccessibilityFeature(Enum):
    ELEVATOR = "elevator"
    RAMP = "ramp"
    AUTOMATIC_DOORS = "automatic_doors"
    BRAILLE_SIGNAGE = "braille_signage"
    ACCESSIBLE_RESTROOM = "accessible_restroom"

@dataclass
class GeoPoint:
    latitude: float
    longitude: float

@dataclass
class Building:
    building_id: str
    name: str
    short_name: str
    building_type: BuildingType
    location: GeoPoint
    floors: int
    address: str
    accessibility: list[AccessibilityFeature] = field(
        default_factory=list
    )
    departments: list[str] = field(default_factory=list)
    open_time: Optional[time] = None
    close_time: Optional[time] = None
    image_url: str = ""
    notes: str = ""

@dataclass
class Room:
    room_id: str
    building_id: str
    floor: int
    room_number: str
    room_type: str  # lecture hall, lab, office, etc.
    capacity: int = 0
    equipment: list[str] = field(default_factory=list)

@dataclass
class CampusEvent:
    event_id: str
    title: str
    description: str
    building_id: str
    room_id: Optional[str]
    start_time: datetime
    end_time: datetime
    category: str
    organizer: str
    is_public: bool = True

Direction Calculator

For campus navigation, we need a function that calculates walking directions between buildings.

import math

BUILDINGS: dict[str, Building] = {}
ROOMS: dict[str, Room] = {}
EVENTS: list[CampusEvent] = []

# Pre-defined walking paths between building pairs
WALKING_PATHS: dict[tuple[str, str], list[str]] = {}

def haversine_distance(p1: GeoPoint, p2: GeoPoint) -> float:
    """Calculate distance in meters between two GPS coordinates."""
    R = 6371000  # Earth radius in meters
    lat1, lat2 = math.radians(p1.latitude), math.radians(p2.latitude)
    dlat = math.radians(p2.latitude - p1.latitude)
    dlon = math.radians(p2.longitude - p1.longitude)
    a = (math.sin(dlat / 2) ** 2
         + math.cos(lat1) * math.cos(lat2)
         * math.sin(dlon / 2) ** 2)
    return R * 2 * math.atan2(math.sqrt(a), math.sqrt(1 - a))

def get_directions(
    from_building_id: str, to_building_id: str
) -> dict:
    from_bld = BUILDINGS.get(from_building_id)
    to_bld = BUILDINGS.get(to_building_id)
    if not from_bld or not to_bld:
        return {"error": "Building not found"}

    distance = haversine_distance(from_bld.location, to_bld.location)
    walk_minutes = round(distance / 80)  # ~80 m/min walking

    path_key = (from_building_id, to_building_id)
    steps = WALKING_PATHS.get(
        path_key,
        [f"Head toward {to_bld.name} from {from_bld.name}"]
    )

    return {
        "from": from_bld.name,
        "to": to_bld.name,
        "distance_meters": round(distance),
        "walking_minutes": max(1, walk_minutes),
        "steps": steps,
        "destination_address": to_bld.address,
    }

Agent Tools

from agents import Agent, function_tool, Runner
import json

@function_tool
def find_building(query: str) -> str:
    """Find a building by name, short name, or department."""
    query_lower = query.lower()
    matches = []
    for bld in BUILDINGS.values():
        if (query_lower in bld.name.lower()
                or query_lower in bld.short_name.lower()
                or any(query_lower in d.lower()
                       for d in bld.departments)):
            matches.append({
                "id": bld.building_id,
                "name": bld.name,
                "type": bld.building_type.value,
                "floors": bld.floors,
                "departments": bld.departments,
                "hours": (
                    f"{bld.open_time}-{bld.close_time}"
                    if bld.open_time else "24/7"
                ),
                "accessibility": [
                    a.value for a in bld.accessibility
                ],
            })
    return json.dumps(matches) if matches else "No buildings found."

@function_tool
def find_room(building_name: str, room_number: str) -> str:
    """Find a specific room within a building."""
    for room in ROOMS.values():
        bld = BUILDINGS.get(room.building_id)
        if not bld:
            continue
        if (building_name.lower() in bld.name.lower()
                and room_number in room.room_number):
            return json.dumps({
                "building": bld.name,
                "room": room.room_number,
                "floor": room.floor,
                "type": room.room_type,
                "capacity": room.capacity,
                "equipment": room.equipment,
                "directions": f"Enter {bld.name}, go to floor "
                    f"{room.floor}, room {room.room_number}",
            })
    return "Room not found. Check the building name and room number."

@function_tool
def get_upcoming_events(
    category: str = "", building_id: str = ""
) -> str:
    """Get upcoming campus events, optionally filtered."""
    now = datetime.now()
    upcoming = []
    for event in EVENTS:
        if event.start_time < now or not event.is_public:
            continue
        if category and category.lower() not in event.category.lower():
            continue
        if building_id and event.building_id != building_id:
            continue
        bld = BUILDINGS.get(event.building_id)
        upcoming.append({
            "title": event.title,
            "when": event.start_time.strftime("%B %d at %I:%M %p"),
            "where": bld.name if bld else "TBD",
            "category": event.category,
            "organizer": event.organizer,
        })
    upcoming.sort(key=lambda e: e["when"])
    return json.dumps(upcoming[:10]) if upcoming else "No upcoming events."

campus_agent = Agent(
    name="Campus Navigator",
    instructions="""You are a campus navigation assistant. Help
    people find buildings, locate rooms, get walking directions,
    and discover campus events. Always mention accessibility
    features when giving directions. If someone seems lost,
    ask where they are starting from to give accurate directions.
    Share building hours proactively so visitors do not arrive
    to a closed building.""",
    tools=[find_building, find_room, get_upcoming_events],
)

FAQ

How does the agent account for construction or temporary closures?

Add a closures list to the Building model with start/end dates and detour instructions. Before giving directions, the agent checks for active closures and automatically reroutes. It can also proactively warn users about upcoming closures that might affect their route.

Can this agent work with real mapping services?

Yes. Replace the haversine calculation with calls to Google Maps, Mapbox, or OpenStreetMap APIs for turn-by-turn walking directions. Indoor navigation can use Bluetooth beacons or WiFi positioning with APIs from Mappedin or Meridian.

Still reading? Stop comparing — try CallSphere live.

CallSphere ships complete AI voice agents per industry — 14 tools for healthcare, 10 agents for real estate, 4 specialists for salons. See how it actually handles a call before you book a demo.

How do you handle buildings with multiple entrances?

Model each entrance as a sub-location with its own GPS coordinates and an entrance_type field (main, side, accessible, loading). The directions tool selects the entrance closest to the user starting point, prioritizing accessible entrances when accessibility features are relevant.


#AIAgents #EdTech #CampusNavigation #Python #Geolocation #AgenticAI #LearnAI #AIEngineering

Share

Try CallSphere AI Voice Agents

See how AI voice agents work for your industry. Live demo available -- no signup required.

Related Articles You May Like

Agentic AI

Multi-Agent Handoffs with the OpenAI Agents SDK: The Pattern That Actually Scales (2026)

Handoffs done right — when one agent should hand control to another, how to preserve context, and how to evaluate the handoff decision itself.

AI Strategy

AI Agent M&A Activity 2026: Aircall–Vogent, Meta–PlayAI, OpenAI's Six Deals

Q1 2026 saw a record acquisition wave: Aircall bought Vogent (May), Meta acquired Manus and PlayAI, OpenAI closed six deals. The voice AI consolidation phase has begun.

Agentic AI

Building Your First Agent with the OpenAI Agents SDK in 2026: A Hands-On Walkthrough

Step-by-step build of a working agent with the OpenAI Agents SDK — Agent class, tools, handoffs, tracing — plus an eval pipeline that catches regressions before merge.

Agentic AI

LangGraph Checkpointers in Production: Durable, Resumable Agents with Eval Replay

Use LangGraph's checkpointer to make agents resumable across crashes and human-in-the-loop pauses, then replay any checkpoint into your eval pipeline.

Agentic AI

LangGraph State-Machine Architecture: A Principal-Engineer Deep Dive (2026)

How LangGraph's StateGraph, channels, and reducers actually work — with a working multi-step agent, eval hooks at every node, and the patterns that survive production.

Agentic AI

LangGraph Supervisor Pattern: Orchestrating Multi-Agent Teams in 2026

The supervisor pattern in LangGraph for coordinating specialist agents, with full code, an eval pipeline that scores routing accuracy, and the failure modes to watch for.