Before you start
You need:- A workspace API key with both
config:readandpolicies:read - A saved prompt draft promoted to an immutable version
- An active deployment in the same environment as the API key
- A tracer-level
agentIdwhen the deployment targets a specific Agent
The API key determines the workspace and deployment environment used by the
runtime configuration API. Set the SDK
environment to the same value when
you enable strict target matching.Deploy a prompt
In the Lynx dashboard:- Open Prompts → Prompt library and select Add prompt.
- Enter a stable prompt name, such as
support-system, and save the draft. - Open the Versions tab and select Create version.
- Open the Deployment tab.
- Select the immutable version,
StagingorProduction, and either All agents or one Agent. - Select Deploy.
Configure the SDK
agentId. You can omit agentId when you use only All agents deployments.
runtimeConfig.enabled: true loads prompts and firewall policies before the first run(). Persistent caching is optional. When enabled without a path, the SDK stores the last validated bundle in the operating system’s user cache directory.
Load a prompt
Use the stable prompt name withgetPrompt(). Call it inside run() so Lynx pins the selected version for that run and attaches its versionId to related events.
getPrompt() accepts either the stable prompt name or its UUID.
How Lynx selects a deployment
An Agent-specific deployment takes precedence over an All agents deployment for the same prompt and environment.
The runtime configuration request uses the
agentId passed to new LynxTracer(). Setting a different agentId only in run() does not change which prompt deployment is loaded. Create one tracer per Agent when one process runs multiple Agents with different prompt deployments.
Refresh and cache behavior
The SDK:- Restores a valid last-known-good cache when available.
- Loads the current runtime bundle on first use.
- Checks for changes every 60 seconds by default.
- Uses
ETagrevalidation instead of downloading an unchanged bundle. - Verifies the prompt content hash before replacing the active bundle.
- Keeps the current version pinned until the active
run()finishes.
refreshIntervalMs to change the refresh period. The minimum interval is five seconds. Do not call the runtime configuration API before every model request.
A/B experiments
When an active A/B experiment exists, Lynx selects a version locally using the run’sassignmentKey.
assignmentKey, the SDK uses the run’s sessionId.
Handle an unavailable prompt
An automatic startup refresh fails open so a Lynx outage does not stop unrelated application work. An explicitgetPrompt() call throws when no valid cached bundle exists or the prompt is not deployed.
Keep a local fallback when your application must continue without Lynx:
Security note
Prompt content can contain confidential instructions. Do not printprompt.content, API keys, or the contents of .lynxconf in application logs. Protect the persistent cache with the same access controls as application configuration.