Using your prompt

Make sure to set traceloop_sync_enabled=True when initializing the SDK or the TRACELOOP_SYNC_ENABLED environment variable to true, to enable the prompt sync.

The SDK fetches your prompts from Traceloop servers. Changes made to a prompt are available in the SDK during runtime. The SDK polls the Traceloop servers for changes every every poll interval.

The default poll interval is 60 seconds but can be configured with the TRACELOOP_SYNC_POLL_INTERVAL environment variable, or the initialization function. When in the Development environment, the poll interval is determined by the TRACELOOP_SYNC_DEV_POLL_INTERVAL environment variable or appropriate initialization argument, and defaults to 5 seconds.

Make sure you’ve configured the SDK with the right environment and API Key. See the SDK documentation for more information.

The SDK uses smart caching mechanisms to proide zero latency for fetching prompts.

Get Prompt API

Let’s say you’ve created a prompt with a key joke_generator in the UI and set ot to:

Tell me a joke about OpenTelemetry as a {{persona}}

Then, you can retrieve it with in your code using get_prompt:

The returned variable prompt_args is compatible with the API used by the foundation models SDKs (OpenAI, Anthropic, etc.) which means you should directly plug in the response to the appropriate API call.