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

# DSPy Visualization Quickstart

> Quickly visualize DSPy notebooks and optimization experiments in LangWatch to support debugging and agent evaluation.

[<img align="center" src="https://colab.research.google.com/assets/colab-badge.svg" />](https://colab.research.google.com/github/langwatch/langwatch/blob/main/python-sdk/examples/dspy_visualization.ipynb)

LangWatch DSPy Visualization allows you to start tracking your DSPy experiments in real-time and easily follow the progress, track costs and debug each step.

## 1. Install the Python library

<Tabs>
  <Tab title="Notebook">
    ```bash  theme={null}
    !pip install langwatch
    ```
  </Tab>

  <Tab title="Command Line">
    ```bash  theme={null}
    pip install langwatch
    ```
  </Tab>
</Tabs>

## 2. Login to LangWatch

Import and authenticate the LangWatch SDK:

```python  theme={null}
import langwatch

langwatch.login()
```

Be sure to login or create an account on the link that will be displayed, then provide your API key when prompted.

## 3. Start tracking

Before your DSPy program compilation starts, initialize langwatch with your experiment name and the optimizer to be tracked:

```python  theme={null}
# Initialize langwatch for this run, to track the optimizer compilation
langwatch.dspy.init(experiment="my-awesome-experiment", optimizer=optimizer)

compiled_rag = optimizer.compile(RAG(), trainset=trainset)
```

## Follow your experiment

Open the link provided when the compilation starts or go to your [LangWatch dashboard](https://app.langwatch.ai) to follow the progress of your experiments:

<Frame>
  <img src="https://mintcdn.com/langwatch/yNF_rRIoKmcNweQl/images/dspy-visualizer.png?fit=max&auto=format&n=yNF_rRIoKmcNweQl&q=85&s=c59037e9253de3f030aa39881db01ec1" data-og-width="1573" width="1573" data-og-height="972" height="972" data-path="images/dspy-visualizer.png" data-optimize="true" data-opv="3" srcset="https://mintcdn.com/langwatch/yNF_rRIoKmcNweQl/images/dspy-visualizer.png?w=280&fit=max&auto=format&n=yNF_rRIoKmcNweQl&q=85&s=4935e96b2e8b66780002312044e73d21 280w, https://mintcdn.com/langwatch/yNF_rRIoKmcNweQl/images/dspy-visualizer.png?w=560&fit=max&auto=format&n=yNF_rRIoKmcNweQl&q=85&s=a188176fa89dd2918c42ae054a6fe738 560w, https://mintcdn.com/langwatch/yNF_rRIoKmcNweQl/images/dspy-visualizer.png?w=840&fit=max&auto=format&n=yNF_rRIoKmcNweQl&q=85&s=26222c963f522a8e4a5d427af75b3a91 840w, https://mintcdn.com/langwatch/yNF_rRIoKmcNweQl/images/dspy-visualizer.png?w=1100&fit=max&auto=format&n=yNF_rRIoKmcNweQl&q=85&s=0827e410c6d5c04b5861651629594db3 1100w, https://mintcdn.com/langwatch/yNF_rRIoKmcNweQl/images/dspy-visualizer.png?w=1650&fit=max&auto=format&n=yNF_rRIoKmcNweQl&q=85&s=d2f95ae6877950713809f6c8ac71e5d3 1650w, https://mintcdn.com/langwatch/yNF_rRIoKmcNweQl/images/dspy-visualizer.png?w=2500&fit=max&auto=format&n=yNF_rRIoKmcNweQl&q=85&s=3da7434fffe4cffb31383b7a720a1ea7 2500w" />
</Frame>

## Wrapping up

With your experiments tracked on LangWatch, now it's time to explore how is the training going, take a look at the examples, the llm calls,
the different steps and so on, so you can understand and hypothesize where you could improve your DSPy program, and keep iterating!

<Note>
  When you are ready to deploy your DSPy program, you can monitor the inference traces on LangWatch dashboard as well. Check out the [Python Integration Guide](/integration/python/guide) for more details.
</Note>

For any questions or issues, feel free to contact our support, join our channel on [Discord](https://discord.com/invite/kT4PhDS2gH) or [open an issue](https://github.com/langwatch/langwatch/issues) on our GitHub.
