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: str | dict | list,
    error: bool = False,
    debug: bool = False
) -> LogResponse

Parameters

Param
Type
Description

message

str | dict | list

Content to log (can be str, dict, list or SDK response objects)

error?

bool

Mark this log entry as an error (logs to stderr and sends as error type)

debug?

bool

Skip sending to Circuit UI (console only)

Returns

  • LogResponse

class LogResponse:
    success: bool
    error: str | None       # Error message (only present on failure)
    error_details: dict | None  # 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 terminal

as error in UI

agent.log("msg", debug=True )

in terminal

hidden from user

agent.log("msg", error=True, debug=True )

as error in terminal

hidden from user

Last updated