A Sample Text-to-Speech Agent in C
ICLTerm capabilities = icl_TermFromStr(“[play(tts, Msg)]”);
ICLTerm oaa_AppDoEvent(ICLTerm Event, ICLTerm Params) {
if (strcmp(icl_Str(Event), “play”) == 0) {
return playTTS(icl_ArgumentAsStr(Event, 2));
com_Connect(“parent”, connectionInfo);
oaa_Register(“parent”, “tts”, capabilities);
Notes:
To create a new OAA agent in C:
- Include libraries for OAA and choose a communications subsystem.
- Define the list of capabilities your agent can solve using ICL expressions. These may be either simple patterns to unify against an incoming request (e.g., play(tts, Msg)), or more complex specifications that include translations and synonyms, executable test conditions or constraints, etc.
- For each capability declared, the agent should parse an incoming request using the built-in icl_ routines, map the request to the API of the underlying application, and then return solutions to the request by constructing ICL return values.
- The body of the agent should initialize a connection to a Facilitator agent, register the agent’s capabilities and name with it, and then enter a loop waiting for incoming requests from other agents.
The structure of an agent has been designed to be as simple, intuitive, and as low-overhead as possible.