Agent API Reference¶
- class openfloor.agent.BotAgent(manifest)[source]¶
Bases:
OpenFloorAgent
BotAgent is a simple bot agent. It can be used as a class in its own right or subclassed to create more complex agents.
The class provides default event handlers that meet the Open Floor specification requirements for a bot agent.
The default on_envelope handler processes events in a specific order, checking for invite events first if the bot is not already in a conversation.
Event handlers can be customized by subclassing and overriding the default handlers.
For a minimal implementation, all that is required is the following - Implement a handler for invite events to send a greeting - Implement a handler for bye events to send a farewell - Implement a handler for utterance events to handle conversation
- class openfloor.agent.OpenFloorAgent(manifest)[source]¶
Bases:
OpenFloorEvents
- add_metadata(events)[source]¶
Split events into those intended for this agent and those for other agents
- Parameters:
events (
List
[Event
]) – List of events to split- Returns:
event: The original event
- metadata: Dictionary containing:
addressed_to_me: Boolean indicating if event is intended for this agent
- Return type:
List of tuples (event, metadata) where
- property serviceUrl: str¶
A convenient shorthand to get the serviceUrl from the manifest
- property speakerUri: str¶
A convenient shorthand to get the speakerUri from the manifest