@squidcloud/client
    Preparing search index...

    Class AiAgentReference

    AiAgentReference provides methods for managing AI agents, including retrieving, updating, and deleting agents, handling agent contexts, and interacting with chat or voice-based AI functionalities.

    Index
    • Atomically adds a function to the agent.

      Parameters

      • functionId: string

      Returns Promise<void>

    • Atomically adds a global glossary to the agent's glossaryIds.

      Parameters

      • glossaryId: string

      Returns Promise<void>

    • Atomically adds an ontology to the agent's ontologyIds.

      Parameters

      • ontologyId: string

      Returns Promise<void>

    • Sends a prompt and returns a full string response.

      Type Parameters

      Parameters

      • prompt: string

        The text prompt to send to the agent.

      • Optionaloptions: AiAskOptions<T>

        Optional parameters for the AI ask request.

      • OptionaljobId: string

        (Optional) A unique identifier for this request. Use it with squid.jobs().awaitJob(jobId) or squid.jobs().getJob(jobId) to track progress. Make sure each job ID is both unique and kept private—anyone who knows it can look up the job’s status.

      Returns Promise<string>

    • Sends a prompt and not wait for the result - the result can be tracked using the job ID (squid.jobs().awaitJob(jobId) or squid.jobs().getJob(jobId)). The result is of type AiAskResponse which contains the response string and optional annotations. @param prompt The text prompt to send to the agent. @param jobId A unique identifier for this request. Use it with squid.jobs().awaitJob(jobId)or squid.jobs().getJob(jobId)` to track progress. Make sure each job ID is both unique and kept private—anyone who knows it can look up the job’s status.

      Type Parameters

      Parameters

      • prompt: string
      • jobId: string
      • Optionaloptions: AiAskOptions<T>

        Optional parameters for the AI ask request.

      Returns Promise<void>

    • Sends a prompt and returns the string response and file annotations.

      Type Parameters

      Parameters

      • prompt: string

        The text prompt to send to the agent.

      • Optionaloptions: AiAskOptions<T>

        Optional parameters for the AI ask request.

      • OptionaljobId: string

        (Optional) A unique identifier for this request. Use it with squid.jobs().awaitJob(jobId) or squid.jobs().getJob(jobId) to track progress. Make sure each job ID is both unique and kept private—anyone who knows it can look up the job’s status.

      Returns Promise<AskResponse>

    • Returns the answer, annotations, routing information, and optional validation verdict.

      Type Parameters

      Parameters

      • prompt: string
      • Optionaloptions: AiAskOptions<T>
      • OptionaljobId: string

      Returns Promise<AskResponse>

    • Sends a prompt and gets both text and voice response from the agent.

      Type Parameters

      Parameters

      • prompt: string

        The text prompt to send to the agent.

      • Optionaloptions: AiAskOptionsWithVoice<T>

        Optional parameters for the AI ask request.

      • OptionaljobId: string

        (Optional) A unique identifier for this request. Use it with squid.jobs().awaitJob(jobId) or squid.jobs().getJob(jobId) to track progress. Make sure each job ID is both unique and kept private—anyone who knows it can look up the job’s status.

      Returns Promise<AskWithVoiceResponse>

    • Uses an AI builder agent to modify this agent based on a natural language request. Requires an API Key. The builder can update instructions, connect/disconnect integrations, add/remove functions, connect other agents, manage knowledge bases, and configure guardrails.

      Parameters

      • request: string

        A natural language description of what you want to build or change.

      • OptionalmemoryId: string

        Optional memory ID for conversation history. If not provided, defaults to 'no-memory' (no persistence).

      • Optionaloptions: BuildAgentOptions

        Optional configuration for the build request.

        Options for the agent builder.

        • OptionalcanManageIntegrations?: boolean

          Whether the caller has permission to create or update integrations. Defaults to false.

      Returns Promise<string>

      A string describing what changes were made.

    • Sends a prompt to the agent and receives streamed text responses.

      Type Parameters

      Parameters

      • prompt: string

        The text prompt to send to the agent.

      • Optionaloptions: AiChatOptionsWithoutVoice<T>

        Optional parameters for the AI ask request.

      • OptionaljobId: string

        (Optional) A unique identifier for this request. Use it with squid.jobs().awaitJob(jobId) or squid.jobs().getJob(jobId) to track progress. Make sure each job ID is both unique and kept private—anyone who knows it can look up the job’s status.

      Returns Observable<string>

    • Deletes the AI agent. Does not fail if the agent does not exist.

      Returns Promise<void>

    • Deletes an automation of the agent. Does not fail if it does not exist. Requires the app API key.

      Parameters

      • automationId: string

      Returns Promise<void>

    • Deletes the custom guardrails for the agent.

      Returns Promise<void>

    • Deletes a specific revision.

      Parameters

      • revisionNumber: number

        The revision number to delete

      Returns Promise<void>

    • Retrieves metadata and configuration of the AI agent.

      Returns Promise<AiAgent<undefined> | undefined>

    • Fetches the default api key for the agent

      Returns Promise<string | undefined>

      the api key if one exists

    • Returns an automation of the agent, or undefined when it has none with that ID. Requires the app API key.

      Parameters

      • automationId: string

      Returns Promise<AiAgentAutomation | undefined>

    • Returns a list of all chat history messages with the given 'memoryId'. Includes both user and & AI messages.

      Parameters

      • memoryId: string

      Returns Promise<AiChatMessage[]>

    • Lists the agent's automations, oldest first: the prompts it runs on a schedule or when an event is emitted. Requires the app API key.

      Returns Promise<AiAgentAutomation[]>

    • Observes live status messages from the agent.

      Parameters

      • OptionaljobId: string

        The job ID to filter status updates for a specific job. If not provided, all status updates for the agent are observed.

      Returns Observable<AiStatusMessage>

    • Submits a feedback string for the agent. Requires an API Key. This feedback may update the agent's instructions, connected integrations, and may be forwarded to connected agents.

      Parameters

      • feedback: string

        The feedback to provide for the agent.

      Returns Promise<string>

    • Regenerates the api key for the agent. Will throw an error if the agent does not exist.

      Returns Promise<string>

      the new api key

    • Atomically removes a connected agent from the agent.

      Parameters

      • connectedAgentId: string

      Returns Promise<void>

    • Atomically removes a connected integration from the agent.

      Parameters

      • integrationId: string

      Returns Promise<void>

    • Atomically removes a connected knowledge base from the agent.

      Parameters

      • knowledgeBaseId: string

      Returns Promise<void>

    • Atomically removes a function from the agent.

      Parameters

      • functionId: string

      Returns Promise<void>

    • Atomically removes a glossary from the agent's glossaryIds.

      Parameters

      • glossaryId: string

      Returns Promise<void>

    • Atomically removes an ontology from the agent's ontologyIds.

      Parameters

      • ontologyId: string

      Returns Promise<void>

    • Restores the agent to a previous revision. This will create a new revision with the current state before restoring.

      Parameters

      • revisionNumber: number

        The revision number to restore to

      Returns Promise<void>

    • Sets the agent's description.

      Parameters

      • description: string

      Returns Promise<void>

    • Sets a value at a specific path within the agent's options.

      Parameters

      • path: string
      • value: unknown

      Returns Promise<void>

    • Turns an automation on or off, leaving the rest of its definition as it is. Turning a schedule automation on sets its next run from now. Requires the app API key.

      Parameters

      • automationId: string
      • enabled: boolean

      Returns Promise<AiAgentAutomation>

    • Transcribes audio and sends it to the agent for response.

      Type Parameters

      Parameters

      • fileToTranscribe: File

        The audio file to transcribe and send to the agent.

      • Optionaloptions: AiAskOptions<T>

        Optional parameters for the AI ask request.

      • OptionaljobId: string

        (Optional) A unique identifier for this request. Use it with squid.jobs().awaitJob(jobId) or squid.jobs().getJob(jobId) to track progress. Make sure each job ID is both unique and kept private—anyone who knows it can look up the job’s status.

      Returns Promise<AiTranscribeAndAskResponse>

    • Transcribes audio and gets both text and voice response from the agent.

      Type Parameters

      Parameters

      • fileToTranscribe: File

        The audio file to transcribe and send to the agent.

      • Optionaloptions: AiAskOptionsWithVoice<T>

        Optional parameters for the AI ask request.

      • OptionaljobId: string

        (Optional) A unique identifier for this request. Use it with squid.jobs().awaitJob(jobId) or squid.jobs().getJob(jobId) to track progress. Make sure each job ID is both unique and kept private—anyone who knows it can look up the job’s status.

      Returns Promise<TranscribeAndAskWithVoiceResponse>

    • Transcribes the given file and performs a chat interaction.

      Parameters

      • fileToTranscribe: File

        The audio file to transcribe and send to the agent.

      • Optionaloptions: AiChatOptionsWithoutVoice

        Optional parameters for the AI ask request.

      • OptionaljobId: string

        (Optional) A unique identifier for this request. Use it with squid.jobs().awaitJob(jobId) or squid.jobs().getJob(jobId) to track progress. Make sure each job ID is both unique and kept private—anyone who knows it can look up the job’s status.

      Returns Promise<TranscribeAndChatResponse>

    • Updates the agent's custom guardrails with the provided custom guardrail.

      Parameters

      • customGuardrail: string

      Returns Promise<void>

    • Updates the agent's guardrails with the provided options.

      Parameters

      Returns Promise<void>

    • Updates the agent's instruction prompt.

      Parameters

      • instructions: string

      Returns Promise<void>

    • Updates the agent's MCP server configuration, controlling whether the agent is exposed as an MCP server at /mcp/<agentId>. Requires an API key.

      Parameters

      Returns Promise<void>

    • Merges privacy settings. Scopes select input, context, output or tool arguments. A null classifierModel restores the default model.

      Parameters

      Returns Promise<void>

    • Creates an automation of the agent, or replaces the one with the same id. A schedule automation runs the agent with its prompt on a cron schedule; an event automation runs it whenever an event of its type is emitted with squid.events().emit, with the event appended to the prompt. Requires the app API key.

      Parameters

      Returns Promise<AiAgentAutomation>