log()

Use agent.log() to communicate with your users and debug your agent. Every message appears in your terminal, and by default also shows up in the Circuit UI for your users to see. Pass debug: true to skip sending the message to the user.

Signature

agent.log(
  message: string | object | any[], 
  options?: {
    error?: boolean;
    debug?: boolean;
  }
): Promise<LogResponse>

Parameters

Param
Type
Description

message

string | object | any[]

Content to log

options?

{ error?: boolean; debug?: boolean }

Optional logging flags

Returns

  • Promise<LogResponse>

interface LogResponse {
  success: boolean;
  error?: string; // Error message (only present on failure)
  errorMessage?: string; // Detailed error info (only present on failure)
  errorDetails?: object; // Detailed error info (only present on failure)
}

Examples

Logging Behavior

Code
You see
User sees

agent.log("msg")

in terminal

in Circuit UI

agent.log("msg", { error: true })

as error in term

as error in UI

agent.log("msg", { debug: true })

in terminal

hidden from user

agent.log("msg", { error: true, debug: true })

as error in term

hidden from user

Last updated