# @arizeai/openinference-instrumentation-bedrock-agent-runtime

**JavaScript · Instrumentation**

OpenInference instrumentation for AWS Bedrock Agent Runtime

- **Version**: 1.2.8
- **Instruments**: `@aws-sdk/client-bedrock-agent-runtime ^3.0.0`

[npm](https://www.npmjs.com/package/@arizeai/openinference-instrumentation-bedrock-agent-runtime) · [README](https://github.com/Arize-ai/openinference/blob/main/js/packages/openinference-instrumentation-bedrock-agent-runtime/README.md) · [Source](https://github.com/Arize-ai/openinference/tree/main/js/packages/openinference-instrumentation-bedrock-agent-runtime)

## Install

```sh
npm install @arizeai/openinference-instrumentation-bedrock-agent-runtime
```

## Usage

Register the instrumentation once, at startup, before the library is imported. The [`BedrockAgentInstrumentation`](https://openinf.dev/js/openinference-instrumentation-bedrock-agent-runtime.html.md#BedrockAgentInstrumentation) reference below lists its options.

```ts
import { registerInstrumentations } from "@opentelemetry/instrumentation";
import { NodeTracerProvider } from "@opentelemetry/sdk-trace-node";
import { BedrockAgentInstrumentation } from "@arizeai/openinference-instrumentation-bedrock-agent-runtime";

const provider = new NodeTracerProvider({
  // ...a span processor that exports to Phoenix or any OTLP backend.
});
provider.register();

registerInstrumentations({
  instrumentations: [new BedrockAgentInstrumentation()],
});
```

If the library is imported first (as ES modules often are), patch it directly with [`manuallyInstrument()`](https://openinf.dev/js/openinference-instrumentation-bedrock-agent-runtime.html.md#BedrockAgentInstrumentation.manuallyInstrument).

## `@arizeai/openinference-instrumentation-bedrock-agent-runtime`

### `isPatched`

_function_ · [Source](https://github.com/Arize-ai/openinference/blob/main/js/packages/openinference-instrumentation-bedrock-agent-runtime/src/instrumentation.ts#L42)

```typescript
function isPatched(): boolean
```

### `BedrockAgentInstrumentation`

_class_ · [Source](https://github.com/Arize-ai/openinference/blob/main/js/packages/openinference-instrumentation-bedrock-agent-runtime/src/instrumentation.ts#L46)

```typescript
class BedrockAgentInstrumentation extends InstrumentationBase<InstrumentationConfig>
```

**Properties**

| Name | Type |
| - | - |
| [`tracer`](https://openinf.dev/js/openinference-instrumentation-bedrock-agent-runtime.html.md#BedrockAgentInstrumentation.tracer) | `Tracer` |

#### `new BedrockAgentInstrumentation`

_constructor_ · [Source](https://github.com/Arize-ai/openinference/blob/main/js/packages/openinference-instrumentation-bedrock-agent-runtime/src/instrumentation.ts#L51)

```typescript
new BedrockAgentInstrumentation(
  options?: {
    instrumentationConfig?: InstrumentationConfig;
    traceConfig?: TraceConfigOptions;
    tracerProvider?: TracerProvider;
  },
): BedrockAgentInstrumentation
```

**Parameters**

| Name | Type | Description |
| - | - | - |
| `instrumentationConfig?` | `InstrumentationConfig` | The config for the instrumentation |
| `traceConfig?` | `TraceConfigOptions` | The OpenInference trace configuration. Can be used to mask or redact sensitive information on spans. |
| `tracerProvider?` | `TracerProvider` | An optional custom trace provider to be used for tracing. If not provided, a tracer will be created using the global tracer provider. This is useful if you want to use a non-global tracer provider. |

#### `manuallyInstrument`

_method_ · [Source](https://github.com/Arize-ai/openinference/blob/main/js/packages/openinference-instrumentation-bedrock-agent-runtime/src/instrumentation.ts#L86)

```typescript
manuallyInstrument(module: __module): void
```

Manually patches the BedrockAgentRuntimeClient, this allows for guaranteed patching of the module when import order is hard to control.

#### `setTracerProvider`

_method_ · [Source](https://github.com/Arize-ai/openinference/blob/main/js/packages/openinference-instrumentation-bedrock-agent-runtime/src/instrumentation.ts#L108)

```typescript
setTracerProvider(tracerProvider: TracerProvider): void
```

Sets TraceProvider to this plugin
