@salesforce/agents
    Preparing search index...

    Class Agent

    A client side representation of an agent within an org. 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 = new Agent({connection, name}).getId();

    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

    Constructors

    • Create an instance of an agent in an org. Must provide a connection to an org and the agent (Bot) API name as part of AgentOptions.

      Parameters

      Returns Agent

    Methods

    • Returns the ID for this agent.

      Returns Promise<string>

      The ID of the agent (The Bot ID).

    • 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[]>