For the complete documentation index, see llms.txt. This page is also available as Markdown.

Python SDK

Use Algenta from Python — install algenta-sdk, authenticate, and call the engine with a typed client. Includes runnable examples.

This page is the reference for the live Python package Algenta ships today: algenta-sdk (imported as decision_engine), a thin typed HTTP client for the Algenta API. Use it for direct, typed access to hosted or self-hosted Algenta.

algenta-sdk is the live PyPI package. It needs no Mojo, worker, or runtime-service setup: the client connects to an Algenta deployment whose compute runtime is already integrated.

Install

Install the published HTTP client from PyPI.

# Typed HTTP client. Imported as `decision_engine`.
pip install algenta-sdk

The package requires Python 3.12 or newer. Pull-request CI builds the wheel and verifies a fresh install of it on Python 3.12, 3.13 and 3.14. It depends on httpx>=0.28 and pydantic>=2.7.

Authentication and configuration

The client reads its API key, in order, from the api_key= argument, then ALGENTA_API_KEY, then the legacy DE_API_KEY. If none are set, the constructor raises ValueError.

1

Set your API key

Export a live or sandbox key into the environment. Live keys carry the de_live_ prefix; sandbox keys carry de_test_.

export ALGENTA_API_KEY="de_live_..."        # production key
# or, for the sandbox:
export ALGENTA_API_KEY="de_test_..."
2

Construct the client

Point base_url at the hosted API (the default) or at your own engine.

import os
from decision_engine import AlgentaClient

client = AlgentaClient(
    api_key=os.environ["ALGENTA_API_KEY"],
    base_url="https://api.algenta.ai",   # default; override for self-hosted
)
3

Verify the connection

Read the live contract version as a cheap round-trip. The client is a context manager that holds a pooled httpx.Client.

with AlgentaClient(api_key=os.environ["ALGENTA_API_KEY"]) as client:
    print(client.get_contract().contract_version)

The constructor accepts four arguments.

Argument
Type
Default
Notes

api_key

str | None

None

Falls back to ALGENTA_API_KEY, then DE_API_KEY.

base_url

str | None

https://api.algenta.ai

Point at your self-hosted engine, e.g. http://localhost:8000.

timeout

float

120.0

Request timeout in seconds.

max_retries

int

3

Retries on 429 and 5xx.

Advanced: contract constants

The package re-exports the platform contract so you can read endpoint paths and defaults without hard-coding them.

Datasets and the data contract

list_datasets

Parameter
Type
Default
Notes

page

int

1

1-based page index.

limit

int

200

Page size.

search

str | None

None

Free-text match over dataset names.

status

str | None

None

Filter by ingestion status.

source_name

str | None

None

Filter by source.

compact

bool

False

Drop heavy fields for a lighter list.

For large catalogs, iter_datasets(...) yields across pages and accepts a max_items cap.

get_dataset_summary

get_contract

get_contract() returns the live platform contract. If the deployment predates the /v1/meta/contract endpoint, the client falls back to deriving the contract from the OpenAPI document.

Querying data

The query surface targets the /v1/query family. Requests are plain dicts; you can also pass keyword arguments, which are merged into the request body.

query_with_metadata

Returns the query result plus execution metadata (request id, timing) and the raw response headers.

query_batch

Send several queries in one round trip to /v1/query/batch.

query_sql_report

Run a structured SQL-style report against /v1/query/sql-report.

Typed query filters

QueryFilterSpec and QueryFilterCondition are exported for building filters with types rather than raw dicts.

Decisions and simulation

These methods target the decision and simulation endpoints. simulate and recommend take keyword arguments; plan_decision takes a request dict.

verify (POST /v1/verify) and explain (which runs a query and annotates it) complete the decision surface:

Capability plane

The capability plane lets an agent discover, route, and execute capabilities (tools, skills, MCP-backed providers).

Capability plane method reference

Method
Endpoint
Returns

list_capability_providers()

GET /v1/capability-providers

list of CapabilityProviderResult

get_capability(capability_id, include_instruction=False)

GET /v1/capabilities/{id}

CapabilityCatalogEntryResult

list_capabilities(kinds=, provider_ids=, binding_ids=)

GET /v1/capabilities

catalog list

route_capabilities(request)

POST /v1/capabilities/route

CapabilityRoutePlanResult

execute_capability(request)

POST /v1/capabilities/execute

CapabilityExecutionResult

list_skills()

GET /v1/capabilities?kinds=skill

skill catalog

list_mcp_providers()

filtered providers

MCP providers

Agent runs

Create a run, then poll its state and event log.

create_agent_run posts to /v1/agent/runs. get_agent_run reads /v1/agent/runs/{run_id}; get_agent_run_events reads /v1/agent/runs/{run_id}/events. For a live feed, stream_agent_run_events(run_id) returns an iterator over server-sent events.

Lifecycle controls — approve_agent_run, resume_agent_run, cancel_agent_run, fork_agent_run, and replay_agent_run — round out the surface for human-in-the-loop and reproducibility workflows.

Repository intelligence

The repository methods take a repository_id and a request dict. triage_repository and apply_repository map to the same endpoints the agent uses internally.

Async client

Every method above has an async equivalent on AsyncAlgentaClient. The async client is an async context manager and exposes the same surface, split across the async_client_* modules internally.

Errors

The client raises typed exceptions, all subclasses of DecisionEngineError.

Authentication & API keysCLI referenceSelf-hostingAPI endpoint reference

Last updated

Was this helpful?