// Generate a new UUID for the Agent NPC
UUID agentNpcUuid = UUID.randomUUID();
// Set the spawn type (NATURAL, BREEDING, or MANUAL)
SpawnType spawnType = SpawnType.NATURAL;
// Register the Agent NPC spawn event
AgentNPCSpawnEvent spawnEvent = PixocracySDK.AgentNPCManager().registerSpawnEvent(
instance,
agentNpcUuid,
spawnType
);
// Access the spawned Agent NPC
AgentNPC agentNpc = spawnEvent.getAgentNpc();