> ## Documentation Index
> Fetch the complete documentation index at: https://wb-21fd5541-typedoc-upgrade.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# createOtelExtension

> TypeScript SDK reference

> **createOtelExtension**(`opts?`): (`pi`) => `void`

Defined in: [src/integrations/piCodingAgent.ts:654](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/integrations/piCodingAgent.ts#L654)

Creates a pi coding agent extension that emits OTEL spans for the full
agent lifecycle, conforming to the GenAI semantic conventions.

When `weave.init(...)` has been called, spans are automatically exported
to the Weave trace server at `/agents/otel/v1/traces`. Otherwise, pass a
custom `tracer` in `opts`.

## Parameters

### opts?

`OtelExtensionOptions` = `{}`

## Returns

(`pi`) => `void`

## Example

```typescript twoslash theme={null}
// @noErrors
const resourceLoader = new DefaultResourceLoader({
  extensionFactories: [createOtelExtension()],
});
```
