@salesforce/agents
    Preparing search index...

    Class Agent

    A client side representation of an agent. Also provides utilities such as creating agents, listing agents, and creating agent specs.

    Examples

    Create a new instance and get the ID (uses the Bot ID):

    const id = await Agent.init({connection, project, apiNameOrId: 'myBot' }).getId();

    Create a new instance of an agent script based agent

    const agent = await Agent.init({connection, project, aabName: 'myBot' });

    Start a preview session

    const agent = await Agent.init({connection, project, aabName: 'myBot' }); await agent.preview.start(); await agent.preview.send('hi there');

    Create a new agent in the org:

    const myAgent = await Agent.create(connection, project, options);

    List all agents in the local project:

    const agentList = await Agent.list(project);

    Index

    Constructors

    Methods

    • Creates an agent from a configuration, optionally saving the agent in an org.

      Parameters

      • connection: Connection

        a Connection to an org.

      • project: SfProject

        a SfProject for a local DX project.

      • config: AgentCreateConfig

        a configuration for creating or previewing an agent.

      Returns Promise<AgentCreateResponse>

      the agent definition

    • List all agents in the current project.

      Parameters

      • project: SfProject

        a SfProject for a local DX project.

      Returns Promise<string[]>

    • Lists all agents available for preview, combining agents from the org and local script files.

      Parameters

      • connection: Connection

        a Connection to an org.

      • project: SfProject

        a SfProject for a local DX project.

      Returns Promise<PreviewableAgent[]>

      the list of previewable agents with their source (org or script)

    • Lists all agents in the org.

      Parameters

      • connection: Connection

        a Connection to an org.

      Returns Promise<BotMetadata[]>

      the list of agents