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

Recommend, score & compare

Compare named actions and get a ranked recommendation, score a single scenario with custom weights, run many simulations at once, and compare scenarios side by side.

Once you can simulate one scenario, these four endpoints turn simulations into a decision. POST /v1/recommend runs several named actions and returns the best one with a rationale. POST /v1/score scores a single scenario with weights you choose. POST /v1/batch runs many simulations in one request. POST /v1/compare puts scenarios side by side with deltas versus the winner. Every action or item is a normal simulation request (auto or expert), and all of them run in parallel on the engine.

Before you start

You need:

  • An API key sent as Authorization: Bearer $ALGENTA_API_KEY on a verified account.

  • One or more simulation requests. The examples use auto mode (low/high bounds); expert mode works everywhere a request is accepted.

The Python and TypeScript pattern is identical for all four endpoints: POST the JSON body shown in each section to the endpoint path with the Authorization header. The Recommend section below shows all three languages; the others show the request and response.

Recommend an action

Submit 2–10 named actions. The engine ranks them by expected value and returns the top one as recommended_action, with a structured decision_plan that is the best entry point for dashboards and LLMs.

curl -sS -X POST "https://api.algenta.ai/v1/recommend" \
  -H "Authorization: Bearer $ALGENTA_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "actions": [
      {"name": "launch_now", "request": {"mode": "auto", "scenario": {
        "variables": {"revenue": {"low": 80000, "high": 200000}, "cost": {"low": 40000, "high": 90000}},
        "objective": "maximize_net_value"}}},
      {"name": "wait_a_quarter", "request": {"mode": "auto", "scenario": {
        "variables": {"revenue": {"low": 60000, "high": 240000}, "cost": {"low": 35000, "high": 70000}},
        "objective": "maximize_net_value"}}}
    ],
    "runs": 10000
  }'
import os
import requests

BASE = os.environ.get("ALGENTA_API_URL", "https://api.algenta.ai")

resp = requests.post(
    f"{BASE}/v1/recommend",
    headers={"Authorization": f"Bearer {os.environ['ALGENTA_API_KEY']}"},
    json={
        "actions": [
            {"name": "launch_now", "request": {"mode": "auto", "scenario": {
                "variables": {"revenue": {"low": 80000, "high": 200000}, "cost": {"low": 40000, "high": 90000}},
                "objective": "maximize_net_value"}}},
            {"name": "wait_a_quarter", "request": {"mode": "auto", "scenario": {
                "variables": {"revenue": {"low": 60000, "high": 240000}, "cost": {"low": 35000, "high": 70000}},
                "objective": "maximize_net_value"}}},
        ],
        "runs": 10000,
    },
)
resp.raise_for_status()
result = resp.json()
print(result["recommended_action"], result["confidence"], result["rationale"])

The 200 RecommendResponse ranks every action and names the winner:

Each ActionResult includes the full DecisionEnvelope, its rank, expected_value, probability_of_loss, and a composite score (0–1). decision_plan folds all of that into one structured summary with per-option risk (p5/p95/probability of loss) and integrity hashes.

Score a single scenario

/v1/score runs one simulation and scores it with a weighted blend of expected value and downside risk. Omit scoring_weights to use the default {"expected_value": 0.6, "downside_risk": 0.4} (weights should sum to 1.0).

Compare scenarios side by side

/v1/compare runs 2–10 named scenarios and returns each one with its delta versus the winning scenario, so you can build a comparison table directly from the response.

Run a batch

/v1/batch runs 1–100 simulation requests in one call. Partial failures are allowed — a failed item carries success: false and an error string instead of an envelope.

Next steps

Last updated

Was this helpful?