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.
Events
Section titled “Events”Sent to the entity’s Signal Emitter as { entityId, eventType, data }. Compare eventType with the EventType constants.
AIAgent::promptAIAgent::thinkingAIAgent::responseAIAgent::talkingAIAgent::writingAIAgent::errorAIAgent::idleAIAgent::cancelledAIAgent::translation-requestedAIAgent::translation-completedAIAgent::translation-failedAIAgent::translation-cancelledAIAgent::turn-startedAIAgent::turn-completedAIAgent::turn-failedAIAgent::turn-cancelledAIAgent::instructions-usedAIAgent::instructions-updatedAIAgent::skill-updatedAIAgent::tool-updatedAIAgent::skill-requestedAIAgent::skill-loadedAIAgent::skill-load-failedAIAgent::tool-definition-loadedAIAgent::tool-definition-failedAIAgent::tool-requestedAIAgent::tool-completedAIAgent::tool-failedAIAgent::tool-cancelledAIAgent::memory-read-requestedAIAgent::memory-readAIAgent::memory-read-failedAIAgent::memory-write-requestedAIAgent::memory-writtenAIAgent::memory-write-failedAIAgent::context-updated
Live example
Section titled “Live example”Run it in the browser, read its scripts, and download it as an XR Creator project.
Live example
Read an agent's setupA script logs an AI agent's setup at startup, its display name and the provider and model that would answer it, by reading the AI Model and AI Persona props.
Read the agent's setup in the log. No conversation is started, so the example needs no AI service.
From a script
Section titled “From a script”#pragma lifecycle(startup)
function startup() { const component = self.parent.getComponent(AIModelComponent); if (component) log(component.props);}