API Reference

Embedded

Integrate the agent directly into your UI for a seamless user experience.

Prerequisite

This page assumes you’ve already installed Eucera SDK.


Installation

// using the api name of your agent
const AGENT_API_NAME = "playground";

eucera("when", "ready", () => {
  eucera.agent({
    apiName: AGENT_API_NAME, 
    mode: "EMBEDDED", 
    configuration: {
      embeddedConfiguration: {
        container: document.body,
      }
    }
  });
});

Configuration

The embedded agent supports both common and mode-specific settings. All attributes go under configuration.embeddedConfiguration:

AttributeTypeDefaultRequiredDescription
containerHTMLElementnullYesThe DOM element into which the agent will mount.
horizontalMarginstring24pxNoHorizontal spacing on either side of the embedded agent (e.g. "20%").
isMenuOpenByDefaultbooleanfalseNoWhether the menu/history panel should be expanded on initial load.
isRightSideMenubooleanfalseNoIf true, positions the menu/history panel on the right side, otherwise on the left.
eucera("when", "ready", () => {
  eucera.agent({
    apiName: AGENT_API_NAME, 
    mode: "EMBEDDED", 
    configuration: {
      embeddedConfiguration: {
        container: document.body,
        horizontalMargin: "20%",
        isMenuOpenByDefault: true,
        isRightSideMenu: false
      }
    }
  });
});

For the full list of shared options across all modes, see Common Configuration.


Programmatic Agent APIs

After you’ve initialized your embedded agent, you can call these methods on the returned instance (they all return this, so you can chain them).


Send a Message as the User

Use .message() to programmatically send text as if the user typed it. This is handy for injecting prompts, simulating user input, or responding to external events.

eucera("when", "ready", () => {
  eucera.agent({ /* …common setup… */ })
    .message("Hello, agent! Can you give me today’s summary?");
});


Live Playground

Try it out in our interactive demo: