Docs

Basics

Runtime logging

Send runtime observer events into application logs.

Use @anvia/logger when agent lifecycle events should flow into your application logger.

When to use this

Use runtime logging for local debugging and production operations:

  • See when runs start and finish.
  • Inspect tool calls.
  • Track failures.
  • Correlate runtime behavior with application logs.

Prerequisites

Install @anvia/logger and choose the logger surface your app already uses. The examples show Pino-style logging and a local console logger.

Add a logger observer

import { AgentBuilder } from "@anvia/core";
import { createLoggerObserver, createPinoLogger } from "@anvia/logger";

const logger = createPinoLogger({
  name: "support-app",
  level: "info",
});

const agent = new AgentBuilder("support", model)
  .instructions("Answer support questions clearly.")
  .observe(createLoggerObserver(logger))
  .build();

Use console logging locally

import { AgentBuilder } from "@anvia/core";
import { createConsoleLogger, createLoggerObserver } from "@anvia/logger";

const logger = createConsoleLogger({
  name: "support-app",
  level: "debug",
});

const agent = new AgentBuilder("support", model)
  .observe(createLoggerObserver(logger))
  .build();

Payload defaults

The logger observer omits final outputs, full model requests, model responses, and tool results by default. Opt in only when your data policy allows those payloads in logs.

Check yourself

Run an agent request and confirm the logger records lifecycle events without leaking final outputs or tool results by default.

Next

Run and inspect the agent in a local browser UI.

Studio runtime