Skip to main content
Koog is a Kotlin-based framework for building single-run and complex workflow agents. Koog includes built-in OpenTelemetry (OTEL) support and can export traces directly to Weave, giving you rich visibility into prompts, completions, tool calls, and end-to-end agent execution. With the Weave exporter enabled, Koog forwards OpenTelemetry spans to your Weave project so you can debug, analyze performance, and iterate faster.
Koog

Prerequisites

Set the following environment variables before running your agent:

Install Koog (Gradle)

Add Koog to your Kotlin project (Kotlin DSL shown):
See Koog’s documentation for additional installation information.

Enable Weave export (OpenTelemetry)

Install Koog’s OpenTelemetry feature and add the Weave exporter. This maps Koog spans to Weave traces using Weave’s OpenTelemetry endpoint. The following example shows how to use the addWeaveExporter:
The function automatically reads your Weave environment variables, but you can also configure specific parameters for the exporter, like this:
The example above:
  • Uses weaveEntity and weaveProjectName to route traces to a specific team and project.
  • Sets weaveOtelBaseUrl to your trace endpoint (for example, https://<your-subdomain>.wandb.io/<path>). Use the parameter for dedicated Weave instances.
If you’re new to using Koog with Weave, we recommend reviewing the following pieces of documentation:

What gets traced

When enabled, Koog’s Weave exporter captures the same spans as Koog’s general OTEL integration, including:
  • Agent lifecycle events (start, stop, errors)
  • LLM interactions (prompts, completions, token usage, latency)
  • Tool and API calls (function calls and external requests)
  • System context (model name, Koog version, environment metadata)
You can visualize these traces in the Weave UI to understand performance and quality. See Weave’s tracing overview for an introduction to capturing traces with Weave.

Example notebook

See Koog’s documentation for a runnable notebooks that streams traces to Weave.

Troubleshooting

  • If traces are missing, first verify that WEAVE_API_KEY, WEAVE_ENTITY, and WEAVE_PROJECT_NAME are set correctly.
  • Confirm your environment can reach https://trace.wandb.ai and that the exporter is configured as shown above.
  • For additional troubleshooting and sampling guidance, see Koog’s OpenTelemetry support.