Skip to main content
The Netra SDK exposes a prompts API that lets you:
  • Fetch managed prompts – Retrieve prompt versions by name and label from the Netra backend
  • Use labels for versioning – Target specific prompt versions such as "production", "staging", or any custom label
  • Integrate seamlessly – Drop fetched prompts directly into your LLM calls with zero boilerplate
This page shows how to use the get_prompt utility in Netra to fetch and use your managed prompts.

Getting Started

The prompts client is initialized automatically when you call Netra.init. No additional flags are required as long as a valid OTLP endpoint and API key are configured, prompts are ready to use. Set your Netra endpoint and API key before you call Netra.init(). Without NETRA_OTLP_ENDPOINT, the SDK prints spans to the console instead of sending them to Netra, and your dashboard stays empty.
Set these wherever your app runs, including Docker containers and CI jobs.

get_prompt

Fetch a prompt version by name and label from the Netra backend.

Parameters

Return Value

Configuration

Required

get_prompt relies on the OTLP endpoint and API key configured via Netra.init or environment variables.

Error Handling

get_prompt is designed to never throw. Errors are logged and a safe fallback value is returned so your application keeps running.
Common error scenarios and their log messages:

Complete Example

Next Steps

Last modified on November 5, 2026