Skip to main content

Scope SDK

The Scope SDK gives your application programmatic access to prompts managed in the Scope platform. Fetch prompt versions, render templates with variables, and integrate prompt management into your AI workflows — all with a few lines of code.

What the SDK Does

  1. Authenticates with the Scope API using your organization's API key and secret
  2. Fetches prompt versions by name, label (production or latest), or specific version ID
  3. Renders templates by substituting {{variable}} placeholders with your values
  4. Caches responses in memory to minimize API calls (default TTL: 300 seconds)

Typical Workflow

Set env vars → Create credentials → Create client
→ Fetch prompt → Render → Send to LLM
  1. Set SCOPE_ORG_ID, SCOPE_API_KEY, SCOPE_API_SECRET, SCOPE_API_URL, and SCOPE_AUTH_API_URL as environment variables
  2. Create credentials from those environment variables
  3. Create a ScopeClient with the credentials
  4. Call get_prompt_version("prompt-name") to fetch the production version
  5. Call version.render(variable="value") to fill in placeholders
  6. Pass the rendered string to your LLM provider

Available SDKs

LanguagePackageStatus
Pythonscope-clientGenerally available
Rubyscope-clientGenerally available
Node.js@scope/clientComing soon
Java/JVMio.scope:scope-clientComing soon

For comprehensive single-language references, see the dedicated Python and Ruby pages.

Key Capabilities

  • Prompt fetching — retrieve prompt versions by name, label (production / latest), or specific version ID
  • Template rendering — substitute {{variable}} placeholders with type-safe variable values
  • Automatic caching — in-memory TTL cache (default 300 s) to minimize API calls
  • JWT authentication — API-key-based auth with automatic token refresh
  • Retry with backoff — configurable retry logic with exponential backoff
  • Telemetry hooks — observe every request, response, and error for logging or metrics

Quick Example

from scope_client import ScopeClient, ApiKeyCredentials

credentials = ApiKeyCredentials.from_env()
client = ScopeClient(credentials=credentials)

version = client.get_prompt_version("greeting")
rendered = version.render(name="Alice")
print(rendered)

Next Steps

Was this page helpful?