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

# Getting Started

> Start tracing your AI application in 2 minutes

# Getting Started with Observability

Basalt Observability is built on OpenTelemetry and designed to be integrated into any Python application with minimal code changes.

## 1. Install the SDK

```bash theme={null}
pip install basalt-sdk
```

## 2. Initialize Basalt

Set your API key as an environment variable:

```bash theme={null}
export BASALT_API_KEY="your_api_key_here"
```

Initialize the client in your application:

```python theme={null}
import os
from basalt import Basalt

basalt = Basalt(api_key=os.environ["BASALT_API_KEY"])
```

## 3. Add Tracing to your Code

Use `@start_observe` for your entry points (like an API handler) and `@observe` for nested operations (like LLM calls or tool use).

```python theme={null}
from basalt.observability import start_observe, observe, ObserveKind

@observe(name="LLM Generation", kind=ObserveKind.GENERATION)
def call_llm(prompt: str):
    # Your LLM call logic here
    return "This is a generated response"

@start_observe(feature_slug="my-feature", name="Process Request")
def main():
    result = call_llm("Hello world")
    return result

if __name__ == "__main__":
    main()
    basalt.shutdown() # Ensure all traces are sent
```

<Warning>
  `basalt.shutdown()` permanently destroys the global OpenTelemetry
  `TracerProvider`.  Call it **exactly once**, at process exit.  Do not call it
  between loop iterations or between HTTP requests — subsequent traces would be
  silently dropped.  See [Core Concepts](/v1/observabilite/python/concepts) for
  full lifecycle guidance.
</Warning>

## 4. View your Traces

Run your script, then head over to the [Basalt Dashboard](https://app.getbasalt.ai) to see your traces in real-time.

## Next Steps

* [Core Concepts](/v1/observabilite/python/concepts) - Understand traces, spans, and context.
* [Auto-instrumentation](/v1/observabilite/python/auto-instrumentation) - Automatically trace OpenAI, Anthropic, and more.
* [Identity Tracking](/v1/observabilite/python/concepts#identity-tracking) - Attach users and organizations to your traces.
