> ## Documentation Index
> Fetch the complete documentation index at: https://docs.getnetra.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Programmatic Configuration

> Configure Netra SDK programmatically

Configure the Netra SDK programmatically when initializing for maximum control over your application's observability settings. This section covers how to set up the SDK using code parameters.

## Basic Configuration

Initialize the SDK with essential parameters:

<CodeGroup>
  ```python python theme={null}
  from netra import Netra
  from netra.instrumentation.instruments import InstrumentSet

  # Basic configuration
  Netra.init(
      app_name="my-ai-service",
      environment="production",
      resource_attributes={"team": "ai", "version": "1.0.0"},
      trace_content=True,
      disable_batch=False,
  	instruments={InstrumentSet.OPENAI}
  )
  ```
</CodeGroup>

### Available Parameters

| Parameter             | Description                                          | Default               | Type |
| --------------------- | ---------------------------------------------------- | --------------------- | ---- |
| `app_name`            | Logical name for your service                        | `llm_tracing_service` | str  |
| `environment`         | Deployment environment (prod, staging, dev)          | `local`               | str  |
| `resource_attributes` | Custom resource attributes                           | `{}`                  | dict |
| `trace_content`       | Whether to capture prompt/completion content         | `True`                | bool |
| `disable_batch`       | Disable batch span processor                         | `False`               | bool |
| `api_key`             | API key for authentication                           | `None`                | str  |
| `headers`             | Additional headers in W3C Correlation-Context format | `None`                | str  |

## Advanced Configuration

### Setting Resource Attributes

Add custom attributes to enrich your tracing data:

<CodeGroup>
  ```python python theme={null}
  # Set resource attributes
  Netra.init(
      app_name="my-ai-service",
      resource_attributes={
          "team": "ai",
          "version": "1.0.0",
          "region": "us-east",
          "environment": "production"
      },
  	instruments={InstrumentSet.OPENAI}
  )
  ```
</CodeGroup>

### Controlling Content Tracing

Control what content is captured:

<CodeGroup>
  ```python python theme={null}
  # Control content tracing
  Netra.init(
      app_name="my-ai-service",
      trace_content=True,  # Capture prompt/completion content
      disable_batch=False  # Enable batch processing,
  	instruments={InstrumentSet.OPENAI}
  )
  ```
</CodeGroup>

## Example Configurations

### Basic Production Setup

<CodeGroup>
  ```python python theme={null}
  from netra import Netra
  from netra.instrumentation.instruments import InstrumentSet

  # Basic production configuration
  Netra.init(
      app_name="my-production-service",
      environment="production",
      resource_attributes={
          "team": "ai",
          "version": "1.0.0",
          "region": "us-east"
      },
      trace_content=True,
      disable_batch=False,
  	instruments={InstrumentSet.OPENAI}
  )
  ```
</CodeGroup>

### Development Setup

<CodeGroup>
  ```python python theme={null}
  from netra import Netra
  from netra.instrumentation.instruments import InstrumentSet

  # Development configuration
  Netra.init(
      app_name="my-dev-service",
      environment="development",
      resource_attributes={
          "team": "ai",
          "version": "1.0.0-dev",
          "developer": "john.doe"
      },
      trace_content=True,
      disable_batch=True  # Disable batch in development,
  	instruments={InstrumentSet.OPENAI}
  )
  ```
</CodeGroup>
