@molroo-ai/sdk
    Preparing search index...

    Class MolrooPersona

    SDK client for interacting with a standalone molroo persona instance.

    Unlike MolrooWorld, which manages multiple entities in a spatial world, MolrooPersona is a single-entity client for direct persona interactions.

    const persona = await MolrooPersona.create(
    { baseUrl: 'https://api.molroo.io', apiKey: 'key', llm },
    { identity: { name: 'Sera' }, personality: { O: 0.8, C: 0.6, E: 0.7 } },
    );

    const result = await persona.chat('Hello, how are you?');
    console.log(result.text);
    Index

    Constructors

    Accessors

    • get id(): string

      Unique identifier for this persona instance.

      Returns string

    • get personaId(): string

      Unique identifier for this persona instance (alias for id).

      Returns string

    Methods

    • High-level chat: getState → LLM generate → perceive with appraisal. Requires LLMAdapter. Without LLM, use perceive() directly for emotion-only interaction.

      Parameters

      • message: string
      • Optionaloptions: { from?: string; history?: ChatMessage[] }

      Returns Promise<PersonaChatResult>

    • Soft-delete this persona. Can be restored with restore.

      Returns Promise<void>

    • Get the current emotional and psychological state of the persona.

      Returns Promise<PersonaState>

      Current emotion, mood, somatic, and narrative state.

    • Send a message to the persona and get an emotion-processed response. If appraisal is provided, it is sent directly to the API. Otherwise, the message is sent as a stimulus.

      Parameters

      • message: string
      • Optionaloptions: { appraisal?: AppraisalVector; from?: string }

      Returns Promise<AgentResponse>

    • Restore a previously soft-deleted persona.

      Returns Promise<void>

    • Directly set the persona's emotion state in VAD space.

      Parameters

      • vad: Partial<{ A: number; D: number; V: number }>

        Partial VAD values to set (V: -1..1, A: 0..1, D: -1..1).

      Returns Promise<void>

    • Advance persona time by the specified number of seconds.

      Parameters

      • seconds: number

        Number of seconds to advance.

      Returns Promise<{ pendingEvents?: unknown[] }>

      Any pending events that were processed.

    • Connect to an existing persona by ID.

      Verifies the persona exists and fetches its configuration.

      Parameters

      • config: { apiKey: string; baseUrl: string; llm?: LLMAdapter }

        API connection config and optional LLM adapter.

      • personaId: string

        The ID of the persona to connect to.

      Returns Promise<MolrooPersona>

      A connected MolrooPersona instance.

    • Create a new persona on the molroo API and return a connected instance.

      Parameters

      • config: { apiKey: string; baseUrl: string; llm?: LLMAdapter }

        API connection config and optional LLM adapter.

      • personaConfig: PersonaConfigData

        Persona identity, personality, and goals.

      Returns Promise<MolrooPersona>

      A connected MolrooPersona instance.

    • List all personas for the authenticated tenant.

      Parameters

      • config: { apiKey: string; baseUrl: string }

        API connection config (baseUrl + apiKey).

      Returns Promise<{ nextCursor?: string; personas: PersonaSummary[] }>

      List of persona summaries with optional pagination cursor.