Skip to main content

Python SDK for the Valmar platform

Project description

valmar

Python SDK for the Valmar platform.

Documentation: https://docs.getvalmar.com

Source: https://github.com/TheValmarAI/valmar-python

License: Apache-2.0

Installation

uv add valmar

Quick start

from valmar import Valmar

client = Valmar(
    api_key="valmr_proj_sk_...",
    base_url="https://your-valmar-deployment.example.com",
    organization_id="your-org-id",
    project_id="your-project-id",
)

base_url is required because Valmar is deployed per customer. Use the base URL for your own Valmar deployment.

Search context

Find relevant saved knowledge across the configured project.

results = client.context.search("deployment process")

for hit in results.hits:
    resource = client.context.read(hit.reference)
    print(f"{hit.title} ({hit.score})")
    print(resource.content_md)

    trace = client.context.trace(hit.reference)
    print(trace.source_thread_ids)

Create a context request

Create a context request that gets routed to the right people in your organization.

handle = client.context_requests.create(
    "How do we handle database migrations in production?",
    background_context="Planning a schema change for the orders table",
    hidden_metadata={"external_case_id": "CASE-4821"},
)

print(f"Request created: {handle.context_request_id}")
print(f"Status: {handle.status}")

request = client.context_requests.get(handle.context_request_id)
if request.status == "completed":
    print(request.result_summary)
    print(request.hidden_metadata["external_case_id"])

hidden_metadata is an immutable string-to-string map copied to every unstructured context snippet saved from the request. It is returned by the API and SDK for client-side matching, but is not exposed through MCP or to Valmar AI agents.

List and import people

from valmar import CreatePersonInput

people = client.people.list()

result = client.people.import_bulk(
    [
        CreatePersonInput(
            email="ada@example.com",
            display_name="Ada Lovelace",
            timezone="UTC",
            title="Principal Engineer",
        )
    ]
)

Run Knowledge Gap analysis

Use the active connection configured by a project administrator.

overview = client.knowledge_gaps.overview()
run = client.knowledge_gaps.start_run(custom_instructions="Focus on incident workflows")

# After the run completes:
ranking = client.knowledge_gaps.get_run_artifact(run.run_id, "ranking.json")
submissions = client.knowledge_gaps.submit_ranked_gaps(run.run_id, gap_ranks=[1, 2])

Context manager

with Valmar(
    api_key="valmr_proj_sk_...",
    base_url="https://your-valmar-deployment.example.com",
    organization_id="your-org-id",
    project_id="your-project-id",
) as client:
    results = client.context.search("onboarding process")

Error handling

The SDK raises httpx.HTTPStatusError for non-2xx responses.

import httpx

try:
    client.context.search("test")
except httpx.HTTPStatusError as e:
    print(f"API error {e.response.status_code}: {e.response.text}")

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

valmar-1.0.0.tar.gz (11.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

valmar-1.0.0-py3-none-any.whl (13.8 kB view details)

Uploaded Python 3

File details

Details for the file valmar-1.0.0.tar.gz.

File metadata

  • Download URL: valmar-1.0.0.tar.gz
  • Upload date:
  • Size: 11.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for valmar-1.0.0.tar.gz
Algorithm Hash digest
SHA256 100d787976abfb6790405efde8e798bbb75a2bd8bf1f9dad6eae5f136532e827
MD5 e8554041a65f85bca73cd880587bd546
BLAKE2b-256 a4050452bee682d89e099991e5f81fc4a917fbed0f94a8f856906eedd5c60f58

See more details on using hashes here.

Provenance

The following attestation bundles were made for valmar-1.0.0.tar.gz:

Publisher: publish.yml on TheValmarAI/valmar-python

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file valmar-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: valmar-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 13.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for valmar-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 526fd0b49990ca1c872098710bbae70787779a24b9ed59e3d8b92c01e7a4e36d
MD5 7e9f96736e7d04020f2ae501d264e4d5
BLAKE2b-256 253e63dfd9f677de18c5917f25349f767ddd29aada6d5f712c1a4cca193ae450

See more details on using hashes here.

Provenance

The following attestation bundles were made for valmar-1.0.0-py3-none-any.whl:

Publisher: publish.yml on TheValmarAI/valmar-python

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page