An OpenFloor-compliant agent that provides current time information for major cities worldwide.
Built using the agent-template architecture with a customized utterance handler.
- Current Time Queries: Ask for the time in any major city
- Multiple Cities: Supports 50+ major cities across all continents
- Timezone Aware: Accurate timezone conversion using pytz
- Natural Language: Understands various phrasings like "what time is it in Tokyo?"
- City Listings: Can list all available cities by region
New York, Los Angeles, Chicago, Toronto, Mexico City, Vancouver, San Francisco, Miami, Denver, Seattle, Boston
London, Paris, Berlin, Madrid, Rome, Amsterdam, Brussels, Vienna, Zurich, Stockholm, Oslo, Copenhagen, Dublin, Moscow, Athens
Tokyo, Beijing, Shanghai, Hong Kong, Singapore, Seoul, Bangkok, Mumbai, Delhi, Dubai, Tel Aviv, Jakarta, Manila, Kuala Lumpur
Sydney, Melbourne, Auckland, Brisbane, Perth
Cairo, Johannesburg, Lagos, Nairobi
São Paulo, Buenos Aires, Rio de Janeiro, Lima, Santiago
- Install dependencies:
pip install flask pytz
pip install events==0.5
pip install --index-url https://test.pypi.org/simple/ --no-deps openfloor==0.1.4- Run the agent:
cd time-agent
python flask_server.pyThe agent will start on http://localhost:8081
User: "What time is it in London?" TimeAgent: "The current time in London is Monday, January 12, 2026 at 03:45 PM GMT"
User: "Time in Tokyo" TimeAgent: "The current time in Tokyo is Tuesday, January 13, 2026 at 12:45 AM JST"
User: "List cities" TimeAgent: (Returns organized list of all available cities by region)
User: "Help" TimeAgent: (Returns help message with usage instructions)
This agent uses the standard agent-template architecture:
- template_agent.py: Event handling (unchanged from template)
- envelope_handler.py: JSON parsing/serialization (unchanged from template)
- utterance_handler.py: Custom time-query logic (customized for this agent)
- flask_server.py: HTTP server (port changed to 8081)
- agent_config.json: Manifest configuration (customized for TimeAgent)
The only customized file is utterance_handler.py, which implements:
- City Detection: Extracts city names from natural language queries
- Timezone Lookup: Maps cities to their timezone identifiers
- Time Formatting: Returns human-readable time strings
- Help System: Provides usage guidance
All OpenFloor protocol handling is managed by the unchanged template files.
Port: 8081 (configurable via PORT environment variable) Host: 0.0.0.0 (configurable via HOST environment variable)
To change port:
PORT=9000 python flask_server.py- Start TimeAgent:
cd time-agent
python flask_server.py- Start AssistantClient:
cd ../assistantClient
python assistantClient.py- In AssistantClient:
- Enter
http://localhost:8081in the URL field - Click "Invite"
- Type: "What time is it in Paris?"
- Click "Send Utterance"
- Enter
- Flask: HTTP server framework
- pytz: Timezone database and conversions
- openfloor: OpenFloor protocol library (install from TestPyPI)
This agent is fully OpenFloor compliant and handles all standard events:
- invite/uninvite
- utterance
- getManifests/publishManifests
- grantFloor/revokeFloor
- context
- bye
Part of the Open Voice Network implementation examples.
- agent-template: Base template for building OpenFloor agents
- assistantClient: GUI client for testing OpenFloor agents
- stella: Example astronomy agent