Skip to content

AI Model

Updated

Which AI model answers for the agent; every agent needs one.

Type
comp-ai-model
Script class
AIModelComponent
Per entity
One
Version
1.0.0

Read about it in Creating an agent: what it does, how to use it from a script, and examples.

Sent to the entity’s Signal Emitter as { entityId, eventType, data }. Compare eventType with the EventType constants.

  • AIAgent::prompt
  • AIAgent::thinking
  • AIAgent::response
  • AIAgent::talking
  • AIAgent::writing
  • AIAgent::error
  • AIAgent::idle
  • AIAgent::cancelled
  • AIAgent::translation-requested
  • AIAgent::translation-completed
  • AIAgent::translation-failed
  • AIAgent::translation-cancelled
  • AIAgent::turn-started
  • AIAgent::turn-completed
  • AIAgent::turn-failed
  • AIAgent::turn-cancelled
  • AIAgent::instructions-used
  • AIAgent::instructions-updated
  • AIAgent::skill-updated
  • AIAgent::tool-updated
  • AIAgent::skill-requested
  • AIAgent::skill-loaded
  • AIAgent::skill-load-failed
  • AIAgent::tool-definition-loaded
  • AIAgent::tool-definition-failed
  • AIAgent::tool-requested
  • AIAgent::tool-completed
  • AIAgent::tool-failed
  • AIAgent::tool-cancelled
  • AIAgent::memory-read-requested
  • AIAgent::memory-read
  • AIAgent::memory-read-failed
  • AIAgent::memory-write-requested
  • AIAgent::memory-written
  • AIAgent::memory-write-failed
  • AIAgent::context-updated

Run it in the browser, read its scripts, and download it as an XR Creator project.

#pragma lifecycle(startup)
function startup() {
const component = self.parent.getComponent(AIModelComponent);
if (component) log(component.props);
}