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

Decisions & products

TypeScript SDK methods for decision memory (log, list, outcome, execute, delete) and the high-level product endpoints for decision, optimize, retrieve, forecast, and agent runs.

These AlgentaClient methods cover two families: decision memory — persisting the decisions you make and the outcomes you observe (logDecision, listDecisions, getDecision, recordOutcome, executeDecision, deleteDecision) — and the high-level product endpoints that wrap common workflows (productDecision, productOptimize, productForecast, productRetrieve, productAgentRun). Method names are camelCase; bodies stay snake_case.

Decision memory methods

Log a decision when you make it, then record the real outcome later so the engine can learn. logDecision requires only chosen_action; recordOutcome requires actual_outcome.

import { AlgentaClient } from "algenta-sdk";

const client = new AlgentaClient({ apiKey: process.env.ALGENTA_API_KEY });

// 1. Record the decision you made.
const logged = await client.logDecision({
  chosen_action: "launch_now",
  context: "Q3 product launch",
  options_considered: ["launch_now", "wait_a_quarter"],
  expected_value: 142000,
  confidence: 0.81,
  rationale: "Upside outweighs the delay risk.",
});

// 2. Later, attach the observed outcome.
const withOutcome = await client.recordOutcome(logged.id, {
  actual_outcome: 137500,
  outcome_notes: "Slightly under forecast; supply delay.",
});
console.log(withOutcome.id, withOutcome.actual_outcome);

// 3. Browse decisions that already have an outcome.
const page = await client.listDecisions({ page: 1, limit: 25, with_outcome_only: true });
console.log(page);
Method
HTTP
Notes

logDecision(request)

POST /v1/decisions

request is a LogDecisionRequest; only chosen_action is required.

listDecisions(options?)

GET /v1/decisions

Paginate with page, limit, page_size; with_outcome_only filters to decisions with a recorded outcome.

getDecision(decisionId)

GET /v1/decisions/{id}

Fetch one logged decision.

recordOutcome(decisionId, request)

PATCH /v1/decisions/{id}/outcome

request is a RecordOutcomeRequest (actual_outcome, outcome_notes).

executeDecision(decisionId, request)

POST /v1/decisions/{id}/execute

request is an ExecuteDecisionRequest; webhook_url is required.

deleteDecision(decisionId)

DELETE /v1/decisions/{id}

Removes a logged decision.

Product methods

The product endpoints are self-contained wrappers over common decision workflows — you pass a domain-shaped request and get a domain-shaped response, no scenario wiring required.

Method
HTTP
Notes

productDecision(request)

POST /v1/decision

inputs is an array of { name, value, low?, high?, unit? }; add objective, risk_tolerance, scenarios.

productOptimize(request)

POST /v1/optimize

objective plus variables ({ name, min, max, step? }); optional constraints, iterations.

productForecast(request)

POST /v1/forecast

metric and a numeric history; optional horizon, seasonality, confidence_level.

productRetrieve(request)

POST /v1/retrieve

query plus inline documents or a collection_id; optional top_k, rerank.

productAgentRun(request)

POST /v1/agent/run

task to run through the tool loop; optional context, tools, max_steps, output_format.

Optimize over bounded variables

productOptimize searches a bounded variable space for the value of the objective. Each variable declares min/max (and optional step); constraints are expressions with an optional required flag.

Next steps

Last updated

Was this helpful?