Implementation:Evidentlyai Evidently SDK Local
| Knowledge Sources | |
|---|---|
| Domains | SDK, Local Storage, Artifacts, Prompts, Configs |
| Last Updated | 2026-02-14 12:00 GMT |
Overview
Provides local SDK manager implementations that work directly with storage backends without requiring a running service, offering the same interfaces as the remote SDK but backed by local ArtifactStorage.
Description
The SDK local module implements the Artifact, Prompt, and Config API interfaces for local (non-networked) usage. These managers work directly with an ArtifactStorage backend, converting between async storage operations and synchronous SDK calls using async_to_sync.
LocalArtifactAPI: Implements ArtifactAPI for local storage. It converts string UUIDs to proper UUID types, delegates to the async ArtifactStorage interface (using async_to_sync), and wraps returned artifacts as RemoteArtifact instances bound to itself. Key behaviors include:
get_or_create_artifact: Checks by name first, creates if not foundbump_artifact_version: Gets latest version number and increments, or starts at 1- All ID inputs accept both
strandUUIDtypes
LocalPromptAPI: Implements PromptAPI by composing a LocalArtifactAPI internally. It performs bidirectional conversion between artifact and prompt models:
- Artifacts are converted to
RemotePromptvia_artifact_to_prompt - Artifact versions are converted to
PromptVersionvia_artifact_version_to_prompt_version - When creating versions,
PromptContentis wrapped inArtifactPromptContent - When reading versions,
ArtifactPromptContentis unwrapped back toPromptContent
LocalConfigAPI: Implements ConfigAPI by composing a LocalArtifactAPI internally. It performs bidirectional conversion between artifact and config models, similar to the prompt API but without content wrapping. It also provides typed helper methods:
add_descriptor/get_descriptor: Store and retrieveDescriptorobjects as versioned configs_add_typed_version/_get_typed_version: Generic typed version storage helpers
Usage
These local API implementations are used by Workspace (the local workspace) to provide SDK functionality without requiring a remote service. They are ideal for development, testing, and single-machine deployments.
Code Reference
Source Location
- Repository: Evidentlyai_Evidently
- File:
src/evidently/sdk/local.py
Signature
class LocalArtifactAPI(ArtifactAPI):
def __init__(self, artifact_storage: ArtifactStorage, user_id: UserID = ZERO_UUID): ...
def list_artifacts(self, project_id: STR_UUID) -> List[RemoteArtifact]: ...
def get_or_create_artifact(self, project_id: STR_UUID, name: str) -> RemoteArtifact: ...
def get_artifact(self, project_id: STR_UUID, name: str) -> RemoteArtifact: ...
def create_artifact(self, project_id: STR_UUID, name: str) -> RemoteArtifact: ...
def bump_artifact_version(self, artifact_id, content: Any) -> ArtifactVersion: ...
class LocalPromptAPI(PromptAPI):
def __init__(self, artifact_storage: ArtifactStorage, user_id: UserID = ZERO_UUID): ...
def list_prompts(self, project_id: STR_UUID) -> List[RemotePrompt]: ...
def get_or_create_prompt(self, project_id: STR_UUID, name: str) -> RemotePrompt: ...
def get_prompt(self, project_id: STR_UUID, name: str) -> RemotePrompt: ...
def create_prompt(self, project_id: STR_UUID, name: str) -> RemotePrompt: ...
def bump_prompt_version(self, prompt_id: STR_UUID, content: Any) -> PromptVersion: ...
class LocalConfigAPI(ConfigAPI):
def __init__(self, artifact_storage: ArtifactStorage, user_id: UserID = ZERO_UUID): ...
def list_configs(self, project_id: STR_UUID) -> List[RemoteGenericConfig]: ...
def get_or_create_config(self, project_id: STR_UUID, name: str) -> RemoteGenericConfig: ...
def add_descriptor(self, project_id: STR_UUID, name: str, descriptor: Descriptor): ...
def get_descriptor(self, project_id: STR_UUID, name: str, version: VersionOrLatest) -> Descriptor: ...
Import
from evidently.sdk.local import LocalArtifactAPI
from evidently.sdk.local import LocalPromptAPI
from evidently.sdk.local import LocalConfigAPI
I/O Contract
LocalArtifactAPI Constructor
| Parameter | Type | Description |
|---|---|---|
| artifact_storage | ArtifactStorage |
Backend storage implementation for artifacts |
| user_id | UserID |
User ID for ownership tracking (defaults to ZERO_UUID) |
LocalPromptAPI Constructor
| Parameter | Type | Description |
|---|---|---|
| artifact_storage | ArtifactStorage |
Backend storage implementation |
| user_id | UserID |
User ID for ownership tracking (defaults to ZERO_UUID) |
Content Conversion Flow
| Direction | From | To | Method |
|---|---|---|---|
| Write (prompt) | PromptContent |
ArtifactPromptContent |
ArtifactPromptContent.from_value()
|
| Read (prompt) | ArtifactPromptContent |
PromptContent |
content.get_value()
|
| Write (config) | Any |
ArtifactContent |
Passed through to artifact storage |
| Read (config) | ArtifactContent |
Any |
content.get_value()
|
Usage Examples
from evidently.sdk.local import LocalArtifactAPI, LocalPromptAPI, LocalConfigAPI
from evidently.ui.service.storage.artifacts import ArtifactStorage
# Create local APIs backed by storage
storage = ArtifactStorage(...) # concrete storage implementation
artifact_api = LocalArtifactAPI(storage)
prompt_api = LocalPromptAPI(storage)
config_api = LocalConfigAPI(storage)
# Work with artifacts locally
artifact = artifact_api.get_or_create_artifact(project_id, "my-artifact")
version = artifact.bump_version(content_data)
# Work with prompts locally
prompt = prompt_api.get_or_create_prompt(project_id, "my-prompt")
prompt_version = prompt_api.bump_prompt_version(prompt.id, prompt_content)
# Work with configs and descriptors locally
config_api.add_descriptor(project_id, "my-descriptor", descriptor)
descriptor = config_api.get_descriptor(project_id, "my-descriptor")