Skip to main content
Use logging to surface status updates, errors, and debug info. Standard logs appear in the Circuit UI for end users; debug logs stay in the console during local development.

Log

def log(
    message: str | dict | list | BaseModel,
    error: bool = False,
    debug: bool = False
) -> LogResponse
Parameters:
  • message: String, object, array, or Pydantic model to log
  • error (optional): If true, log as error level
  • debug (optional): If true, only log to console (skip backend)
Response:
  • success (boolean): Whether the log was sent
  • error (string | null): Error message if sending failed
Example:
# Standard log
agent.log("Processing transaction")

# Error log
agent.log("Failed to load settings", error=True)

# Debug log (console only)
agent.log("Internal state", debug=True)

# Log dict - ONLY DO THIS WHEN DEBUGGING. The user needs to see a nicely formatted string
agent.log({"wallet": agent.sessionWalletAddress, "status": "active"}, debug=True)

Notes

  • To ensure a good user experience, make sure that any logs which do not have debug=True are clean and concise.
  • Objects and arrays are pretty-printed in the console and serialized to JSON strings when sent to the backend.
  • Pydantic models (Python) are automatically converted via .model_dump() before serialization.

See Also

  • Error Handling — Log errors with error: true so they appear in the UI
  • Agent Context — All SDK methods available on the agent object