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
- Authenticates with the Scope API using your organization's API key and secret
- Fetches prompt versions by name, label
(
productionorlatest), or specific version ID - Renders templates by substituting
{{variable}}placeholders with your values - 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
- Set
SCOPE_ORG_ID,SCOPE_API_KEY,SCOPE_API_SECRET,SCOPE_API_URL, andSCOPE_AUTH_API_URLas environment variables - Create credentials from those environment variables
- Create a
ScopeClientwith the credentials - Call
get_prompt_version("prompt-name")to fetch the production version - Call
version.render(variable="value")to fill in placeholders - Pass the rendered string to your LLM provider
Available SDKs
| Language | Package | Status |
|---|---|---|
| Python | scope-client | Generally available |
| Ruby | scope-client | Generally available |
| Node.js | @scope/client | Coming soon |
| Java/JVM | io.scope:scope-client | Coming 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
- Python
- Ruby
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)
require "scope_client"
credentials = ScopeClient::Credentials::ApiKey.from_env
client = ScopeClient::Client.new(credentials: credentials)
version = client.get_prompt_version("greeting")
rendered = version.render(name: "Alice")
puts rendered
Next Steps
- Installation — install the SDK for your language
- Quickstart — end-to-end walkthrough from setup to first prompt
- Configuration — environment variables and client options
- Prompt Management — fetching, rendering, and metadata
- Error Handling — error hierarchy and recovery patterns
- Caching — cache behavior and per-request control
- Telemetry — hooks for observability and debugging
- Python Reference — complete Python SDK reference
- Ruby Reference — complete Ruby SDK reference
- Integration Examples — OpenAI, Anthropic, LangChain, and Express.js
Was this page helpful?