View Agent
Open in Wonderful Platform
Overview
| Field | Value |
|---|---|
| Market | Israel - Public Transportation |
| Vertical | Transportation |
| Company | Egged (אגד) |
| Model | GPT-4 Realtime |
| Persona | Female, Friendly, Calm |
| Language | Hebrew |
| Channel | Voice |
Skills
Egged - Core transportation skill containing 11 tools for bus line lookups, route planning, station details, and data validationKey Tools
| Tool | Purpose |
|---|---|
| stop_details() | Get details about specific bus stations |
| field_judge() | Determine query type and validate required fields |
| missing_data_policy() | Identify missing information in user requests |
| transportation_data() | Retrieve general transportation data |
Prompting Techniques
Strict data grounding - The agent is explicitly prohibited from hallucinating and must only use tool-retrieved data:Lessons Learned
What worked- Explicit step-by-step workflows ensure consistent tool calling order
- Strict “no hallucination” rules with fallback responses maintain accuracy
- Audience-specific tone guidelines (elderly, Haredi) improve accessibility
- Language policy (Hebrew only) prevents confusion in multilingual scenarios
- Duration formatting rules (“x שעות ו-y דקות”) ensure consistent output
- Multiple similar tools (two line_details tools exist) - consolidated naming needed
- Balancing completeness vs. information overload for accessibility-focused audience
- Hebrew grammar maintenance (female gender) requires explicit instruction
Deep Dive
1. field_judge(query) - Query Parser & Intent Classifier
Purpose: This is the brain of the query understanding pipeline. It takes raw user input and extracts structured transportation features while classifying the intent - the final propose is building a ready payload and send it automatically to the API call.What it does:
- Time Context Calculation - Computes current Israel local time, date, and weekday in both Hebrew and English, accounting for DST
- Relative Date Resolution - Converts Hebrew/English relative dates to concrete YYYY-MM-DD format:
- “היום/today” → current date
- “מחר/tomorrow” → +1 day
- “מחרתיים” → +2 days
- Weekday names like “יום ראשון” → next occurrence of that day
- “שבוע הבא” (next week) handling
- LLM Feature Extraction - Uses GPT with structured output to extract:
- Intent Classification - Parallel LLM call to classify as:
- LINE_SCHEDULE - Questions about specific bus lines, schedules, first/last departures
- DIRECTIONS - Route planning from A to B
- Station Name Refinement - For fuzzy station names, calls Moovit API to get candidate stops, then uses LLM to pick the best match
- Persistence - Saves extracted features and intent to context.kv for downstream tools
- Extensive rules for Hebrew date/time parsing
- Special handling for “מוצאי שבת” (Saturday night)
- Address formatting rules (comma-separated, not “in”)
- Station number priority over station name
- Line identifier preservation (keeps Hebrew suffixes like “37א”)
2. missing_data_policy(query) - Smart Data Validation - Mini Ai Agent
Purpose: Identifies what information is missing from a user’s request and generates clarifying questions.What it does:
- Street Length Check Tool - Defines an internal tool that the internal LLM uses when needed (llm choice) that uses Google Maps API to:
- Geocode street names
- Calculate street length from viewport bounds
- If street > 0.7km, prompts for building number (streets in Israel can be long)
- LLM Analysis - Uses GPT to analyze the query against a comprehensive ruleset:
- Universal Blockers:
- AM/PM ambiguity (e.g., “at 5” needs clarification)
- Station number overrides (no follow-up needed)
- One question per piece of info
- Route Planning Requirements:
- Origin city + Destination city + Time
- Street name recognition without “רחוב” prefix
- City-to-city queries are sufficient (no intra-city details needed)
- Line Schedule Requirements:
- Line number OR location is sufficient
- Station name without city → ask for city
- Universal Blockers:
- Question Generation - Returns JSON array of English questions to ask the user
- System Message Delivery - Sends questions via context.agent.sendSystemMessage()
3. transportation_data() - Moovit API Gateway
Purpose: The actual data fetcher. Calls Moovit’s API based on the intent determined by field_judge.Two execution paths:
A. runLineSchedule() - For LINE_SCHEDULE intent
- API Call - POST to Moovit’s SearchAI endpoint with:
- Response Processing:
- Filters and sorts lines (Egged first)
- Limits to 5 lines max
- Normalizes stop names (e.g., “ת.” → “תחנה ”)
- Transliterates line number suffixes (“37א” → “37 alef” for TTS)
- Detects duplicate lines (same line in opposite directions)
- Identifies live arrival data availability
- Output:
B. runDirections() - For DIRECTIONS intent
- API Call - Same endpoint but with:
- Response Processing:
- Extracts itinerary with legs
- Processes each leg (Bus, Walk, Wait, etc.)
- Flattens location names
- Removes Wait/Walk/PathWayWalk legs from final output
- Calculates total trip time from startTime/endTime
- Sorts legs by startTime
- Output:
- Retry logic (3 attempts with 100ms delay)
- 424 status special handling (surface error text)
- Hebrew stop name normalization
- Metadata persistence for debugging
- Current time in Israel timezone