Log

The log component provides structured, append-only event logging scoped to the current agent and session.

append()

await harness.log().append({
  event: "tool_call",
  level: "info",
  data: { tool: "web_search", query: "TypeScript best practices" },
})
Field Type Required Description
event string yes Event name
level LogLevel yes "debug", "info", "warn", or "error"
data object no Arbitrary event data

query()

const entries = await harness.log().query({
  event: "tool_call",
  level: "error",
  since: new Date("2024-01-01"),
  until: new Date(),
  limit: 100,
})
Field Type Required Description
event string no Filter by event name
level LogLevel no Filter by minimum level
since Date no Start time
until Date no End time
limit number no Max results

Each LogEntry contains:

interface LogEntry {
  id: string
  agentId: string
  sessionId: string
  event: string
  level: LogLevel
  data?: Record<string, unknown>
  createdAt: Date
}