@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

    Methods

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

    • 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).

      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.

      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 a list of all chat history messages with the given 'memoryId'. Includes both user and & AI messages.

      Parameters

      • memoryId: string

      Returns Promise<AiChatMessage[]>

    • 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

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

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