> For the complete documentation index, see [llms.txt](https://docs.raga.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.raga.ai/ragaai-catalyst/agentic-testing/concepts/dynamic-tracing.md).

# Dynamic Tracing

**Pain Point Addressed**

Creating datasets manually for each run or configuration in an Agentic Application can be time-consuming and error-prone. Users often need to evaluate different model configurations, scenarios, or parameters, which requires creating distinct datasets for each variation. Traditionally, this process involves repeated manual intervention, making it inefficient and prone to inconsistencies.

**Dynamic Tracing** eliminates these inefficiencies by enabling users to automate dataset creation seamlessly. By dynamically setting dataset names within their code execution flow, users can automate the process, ensuring consistent and structured dataset organization.

***

#### **Benefits of Dynamic Tracing**

1. **Automation:** No need to manually create datasets for each model configuration or input variation.
2. **Consistency:** Ensures a standardized naming convention and dataset structure.
3. **Scalability:** Easily scales to multiple configurations or iterations.
4. **Efficiency:** Saves time by automating repetitive tasks.

***

#### **How to Implement Dynamic Tracing**

**1. Initialize the Tracer**

Start by initializing the `Tracer` object with the necessary configuration:

```python
from catalyst_tracing import Tracer

# Initialize the tracer
tracer = Tracer(
    project_name="your_project_name",  # Replace with your project name
    dataset_name="your_dataset_name",  # Initial dataset name
    tracer_type="Agentic",             # Specify the tracer type
)
```

**2. Use Dynamic Tracing to Automate Dataset Creation**

Within your application's main loop or execution flow, dynamically set the dataset name for each run using the `set_dataset_name` method. This ensures that each run is associated with a unique dataset.

```python
if __name__ == "__main__":
    # Automate dataset creation for multiple runs
    for i in range(3):  # Replace 3 with the number of desired iterations
        tracer.set_dataset_name(f"Dataset_{i}")  # Dynamically set dataset name
        tracer.start()
        main()          # Run your Agentic application logic
        tracer.stop()   
```

***

#### **Example Use Case**

Suppose you are testing an Agentic Application with three different model configurations. Instead of manually creating datasets for each configuration:

1. Define the `Tracer` at the global level.
2. Use a loop to iterate over the configurations.
3. Dynamically set the dataset name to reflect the configuration details.
4. Automatically generate and trace datasets for each iteration.

***


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.raga.ai/ragaai-catalyst/agentic-testing/concepts/dynamic-tracing.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
