Skip to content

AWS.CloudWatchOmni reference

Source: packages/aws/src/CloudWatchOmni/BatchGetOmniSloReport.ts

Runtime binding for cloudwatch:BatchGetOmniSloReport — read the bound Slo’s measurements as of now: state, attainment, error budget consumed, burn rate over one recent window, and the estimated time the budget runs out. The SLO’s space and ID are injected automatically.

GetOmniSlo reports the measurement taken when the state last changed; this reports the live figure.

Provide the implementation with Effect.provide(AWS.CloudWatchOmni.BatchGetOmniSloReportHttp).

// init — bind the operation to the SLO
const getReport = yield* AWS.CloudWatchOmni.BatchGetOmniSloReport(availability);
// runtime
const { reports } = yield* getReport({ burnRate: { windowMinutes: 60 } });
const report = reports[0];
yield* Effect.log(report?.errorBudgetConsumedRatio, report?.burnRate?.value);

Source: packages/aws/src/CloudWatchOmni/CompleteExperimentRun.ts

Runtime binding for cloudwatch:CompleteExperimentRun — complete a run of the bound Experiment that your own code reported: its status becomes COMPLETED and the service computes its summary and, when it has a rule, its verdict. The experiment’s ID is injected automatically.

Provide the implementation with Effect.provide(AWS.CloudWatchOmni.CompleteExperimentRunHttp).

CompleteExperimentRun: Running Experiments

Section titled “CompleteExperimentRun: Running Experiments”
// init — bind the operation to the experiment
const completeRun = yield* AWS.CloudWatchOmni.CompleteExperimentRun(experiment);
// runtime — after the run's cases have been reported
const { run } = yield* completeRun({ runId: "nightly-2026-12-01" });
yield* Effect.log(run.summary?.passRate);

Source: packages/aws/src/CloudWatchOmni/Domain.ts

A CloudWatch Omni domain: the identity and sign-in boundary that spaces are created in. An account has at most one account domain, so a stack that declares a second one fails with a ConflictException.

A domain people sign in to with IAM

import * as CloudWatchOmni from "@alchemy.run/aws/CloudWatchOmni";
const domain = yield* CloudWatchOmni.Domain("Observability", {
domainName: "acme-observability",
});

A domain that signs people in through IAM Identity Center

const domain = yield* CloudWatchOmni.Domain("Observability", {
domainName: "acme-observability",
identityProviders: ["IDC"],
identityProviderConfiguration: {
identityCenterConfiguration: {
identityCenterInstanceArn: "arn:aws:sso:::instance/ssoins-1234567890abcdef",
},
},
});

Domain.lookup references a domain Alchemy doesn’t manage (created in the console or by another stack), found by domainId. It is read during plan/deploy and never created, updated or deleted.

const domain = AWS.CloudWatchOmni.Domain.lookup({ domainId: "d-1a2b3c4d5e" });

Source: packages/aws/src/CloudWatchOmni/Experiment.ts

A CloudWatch Omni experiment: a target (an AI agent or service) and the configuration its runs share. Each run tests a dataset against one version of the target and scores the cases with evaluators.

An experiment whose runs your own code reports

import * as CloudWatchOmni from "@alchemy.run/aws/CloudWatchOmni";
// results log groups must be under /aws/cloudwatch/experiments/
const results = yield* AWS.Logs.LogGroup("ExperimentResults", {
logGroupName: "/aws/cloudwatch/experiments/support-agent",
});
const { accountId, region } = yield* AWS.AWSEnvironment.current;
// only CloudWatch, acting for this account's experiments, may assume it
const role = yield* AWS.IAM.Role("ExperimentRole", {
assumeRolePolicyDocument: {
Version: "2012-10-17",
Statement: [
{
Effect: "Allow",
Principal: { Service: "cloudwatch.amazonaws.com" },
Action: ["sts:AssumeRole"],
Condition: {
StringEquals: { "aws:SourceAccount": accountId },
ArnLike: { "aws:SourceArn": `arn:aws:cloudwatch:${region}:${accountId}:experiment/*` },
},
},
],
},
// CloudWatch checks, creates and writes the results log group as this role
inlinePolicies: {
results: {
Version: "2012-10-17",
Statement: [
{ Effect: "Allow", Action: ["logs:DescribeLogGroups"], Resource: ["*"] },
{
Effect: "Allow",
Action: ["logs:CreateLogGroup", "logs:CreateLogStream", "logs:PutLogEvents"],
Resource: [`arn:aws:logs:${region}:${accountId}:log-group:/aws/cloudwatch/experiments/*`],
},
],
},
},
});
const experiment = yield* CloudWatchOmni.Experiment("SupportAgent", {
description: "Regression suite for the support agent",
target: {
serviceName: "support-agent",
environment: "production",
definition: { custom: {} },
},
dataset: {
executionRoleArn: role.roleArn,
resultsLogGroup: results.logGroupName,
},
});

An experiment against a Bedrock AgentCore runtime

const experiment = yield* CloudWatchOmni.Experiment("SupportAgent", {
target: {
serviceName: "support-agent",
environment: "production",
definition: { agentCoreRuntime: { runtimeArn: runtime.agentRuntimeArn } },
},
dataset: {
executionRoleArn: role.roleArn,
resultsLogGroup: results.logGroupName,
collectTraceStats: true,
},
});
// init — bind the operations to the experiment
const putResults = yield* CloudWatchOmni.PutExperimentRunResults(experiment);
const completeRun = yield* CloudWatchOmni.CompleteExperimentRun(experiment);
// runtime — the experiment's ID is injected automatically
yield* putResults({
runId: "nightly-2026-12-01",
run: {
producer: { kind: "CUSTOM", name: "nightly-suite" },
dataset: { source: "OTHER", name: "golden-set" },
},
results: [
{
caseId: "refund-policy",
executionStatus: "COMPLETED",
// each turn names the trace your agent emitted for it
turns: [{ traceId, input: "What is the refund window?", output: "30 days." }],
},
],
});
const { run } = yield* completeRun({ runId: "nightly-2026-12-01" });

Experiment: Looking up an existing experiment

Section titled “Experiment: Looking up an existing experiment”

Experiment.lookup references an experiment Alchemy doesn’t manage (created in the console or by another stack), found by experimentId. It is read during plan/deploy and never created, updated or deleted.

const existing = AWS.CloudWatchOmni.Experiment.lookup({
experimentId: "exp-01JABCDEFGHJKMNPQRSTVWXYZ0",
});

Source: packages/aws/src/CloudWatchOmni/GetExperiment.ts

Runtime binding for cloudwatch:GetExperiment — read the bound Experiment: its target, configuration, run count, latest run and baseline run. The experiment’s ID is injected automatically.

Provide the implementation with Effect.provide(AWS.CloudWatchOmni.GetExperimentHttp).

// init — bind the operation to the experiment
const getExperiment = yield* AWS.CloudWatchOmni.GetExperiment(experiment);
// runtime
const { experiment: details } = yield* getExperiment();
yield* Effect.log(details.latestRun?.verdict);

Source: packages/aws/src/CloudWatchOmni/GetExperimentRun.ts

Runtime binding for cloudwatch:GetExperimentRun — read one run of the bound Experiment: its status, progress, case summary, evaluator metrics and, when it has a rule, its verdict. The experiment’s ID is injected automatically.

Provide the implementation with Effect.provide(AWS.CloudWatchOmni.GetExperimentRunHttp).

// init — bind the operation to the experiment
const getRun = yield* AWS.CloudWatchOmni.GetExperimentRun(experiment);
// runtime
const { run } = yield* getRun({ runId: "nightly-2026-12-01" });
yield* Effect.log(run.status, run.verdict);

Source: packages/aws/src/CloudWatchOmni/GetLookup.ts

Runtime binding for cloudwatch:GetLookup — read the metadata of the bound Lookup: its columns, row count, size and encryption key. The table’s ID is injected automatically.

Provide the implementation with Effect.provide(AWS.CloudWatchOmni.GetLookupHttp).

// init — bind the operation to the lookup table
const getLookup = yield* AWS.CloudWatchOmni.GetLookup(owners);
// runtime
const { columns, rowCount } = yield* getLookup();

Source: packages/aws/src/CloudWatchOmni/GetLookupData.ts

Runtime binding for cloudwatch:GetLookupData — read the content of the bound Lookup as CSV. The table’s ID is injected automatically.

Provide the implementation with Effect.provide(AWS.CloudWatchOmni.GetLookupDataHttp).

// init — bind the operation to the lookup table
const getLookupData = yield* AWS.CloudWatchOmni.GetLookupData(owners);
// runtime — `rows` is the table's CSV, header row first
const { rows } = yield* getLookupData();

Source: packages/aws/src/CloudWatchOmni/GetOmniSlo.ts

Runtime binding for cloudwatch:GetOmniSlo — read the bound Slo: its definition and its state as of the last state change. The SLO’s space and ID are injected automatically.

Provide the implementation with Effect.provide(AWS.CloudWatchOmni.GetOmniSloHttp).

// init — bind the operation to the SLO
const getSlo = yield* AWS.CloudWatchOmni.GetOmniSlo(availability);
// runtime
const { slo } = yield* getSlo();
yield* Effect.log(slo.state?.value);

Source: packages/aws/src/CloudWatchOmni/ListExperimentRuns.ts

Runtime binding for cloudwatch:ListExperimentRuns — list the runs of the bound Experiment, newest first. The experiment’s ID is injected automatically.

Provide the implementation with Effect.provide(AWS.CloudWatchOmni.ListExperimentRunsHttp).

ListExperimentRuns: Reading Experiment Runs

Section titled “ListExperimentRuns: Reading Experiment Runs”
// init — bind the operation to the experiment
const listRuns = yield* AWS.CloudWatchOmni.ListExperimentRuns(experiment);
// runtime
const { items } = yield* listRuns({ maxResults: 10 });

Source: packages/aws/src/CloudWatchOmni/ListOmniSlos.ts

Runtime binding for cloudwatch:ListOmniSlos — list the SLOs in the bound Space with their current state, optionally filtered and sorted. The space’s ID is injected automatically.

Provide the implementation with Effect.provide(AWS.CloudWatchOmni.ListOmniSlosHttp).

// init — bind the operation to the space
const listSlos = yield* AWS.CloudWatchOmni.ListOmniSlos(space);
// runtime
const { items } = yield* listSlos({ filterCriteria: { stateValue: ["CRITICAL"] } });

Source: packages/aws/src/CloudWatchOmni/Lookup.ts

A CloudWatch Omni lookup table: a named set of rows, loaded from CSV, that telemetry queries can join against.

A lookup table from inline CSV

import * as CloudWatchOmni from "@alchemy.run/aws/CloudWatchOmni";
const owners = yield* CloudWatchOmni.Lookup("ServiceOwners", {
description: "Which team owns each service",
body: ["service,team", "checkout,payments", "search,discovery"].join("\n"),
});

Encrypt the content with your own KMS key

const key = yield* AWS.KMS.Key("LookupKey", {});
const owners = yield* CloudWatchOmni.Lookup("ServiceOwners", {
body: "service,team\ncheckout,payments\n",
kmsKeyArn: key.keyArn,
});
// init — bind the operation to the lookup table
const getLookupData = yield* CloudWatchOmni.GetLookupData(owners);
// runtime — the table's ARN is injected automatically
const { rows } = yield* getLookupData();

Lookup: Looking up an existing lookup table

Section titled “Lookup: Looking up an existing lookup table”

Lookup.lookup references a lookup table Alchemy doesn’t manage (created in the console or by another stack), found by lookupName. It is read during plan/deploy and never created, updated or deleted.

const existing = AWS.CloudWatchOmni.Lookup.lookup({ lookupName: "service_owners" });

Source: packages/aws/src/CloudWatchOmni/PutExperimentRunResults.ts

Runtime binding for cloudwatch:PutExperimentRunResults — report a batch of up to 25 scored cases for a run of the bound Experiment that your own code executes. The first call with a new runId creates the run and must include the run block. The experiment’s ID is injected automatically.

Provide the implementation with Effect.provide(AWS.CloudWatchOmni.PutExperimentRunResultsHttp).

PutExperimentRunResults: Running Experiments

Section titled “PutExperimentRunResults: Running Experiments”
// init — bind the operation to the experiment
const putResults = yield* AWS.CloudWatchOmni.PutExperimentRunResults(experiment);
// runtime
yield* putResults({
runId: "nightly-2026-12-01",
run: {
producer: { kind: "CUSTOM", name: "nightly-suite" },
dataset: { source: "OTHER", name: "golden-set" },
},
results: [
{
caseId: "refund-policy",
executionStatus: "COMPLETED",
// each turn names the trace your agent emitted for it
turns: [{ traceId, input: "What is the refund window?", output: "30 days." }],
evaluators: [{ evaluatorId: "correctness", score: 0.92 }],
},
],
});

Source: packages/aws/src/CloudWatchOmni/Slo.ts

A CloudWatch Omni service level objective (SLO): a reliability target for one service over a time window, measured by a query over the telemetry in a space.

An availability SLO counting good requests against all requests

import * as CloudWatchOmni from "@alchemy.run/aws/CloudWatchOmni";
const availability = yield* CloudWatchOmni.Slo("CheckoutAvailability", {
spaceId,
description: "99.9% of checkout requests succeed",
serviceAttributes: {
serviceName: "checkout",
deploymentEnvironmentName: "production",
},
sli: {
events: {
good: {
language: "PROMQL",
expression: 'sum(rate(http_server_requests_total{service="checkout",status!~"5.."}[$__interval]))',
},
total: {
language: "PROMQL",
expression: 'sum(rate(http_server_requests_total{service="checkout"}[$__interval]))',
},
},
},
objective: {
target: 99.9,
timeWindow: { rolling: { days: 30 } },
},
});

A latency SLO judged period by period

const latency = yield* CloudWatchOmni.Slo("CheckoutLatency", {
spaceId,
serviceAttributes: { serviceName: "checkout" },
sli: {
periods: {
periodMinutes: 5,
query: {
language: "PROMQL",
expression:
'histogram_quantile(0.99, sum(rate(http_server_duration_bucket{service="checkout"}[$__interval])) by (le))',
},
good: { comparator: "LTE", threshold: 0.5 },
},
},
objective: {
target: 99,
warningBudgetConsumedRatio: 0.8,
timeWindow: { calendar: { unit: "MONTH", timeZone: "UTC" } },
},
});
// init — bind the operation to the SLO
const getReport = yield* CloudWatchOmni.BatchGetOmniSloReport(availability);
// runtime — the SLO's space and ID are injected automatically
const { reports } = yield* getReport({ burnRate: { windowMinutes: 60 } });
yield* Effect.log(reports[0]?.errorBudgetConsumedRatio);

Slo.lookup references an SLO Alchemy doesn’t manage (created in the console or by another stack), found by spaceId and sloName. It is read during plan/deploy and never created, updated or deleted.

const existing = AWS.CloudWatchOmni.Slo.lookup({ spaceId, sloName: "checkout-availability" });

Source: packages/aws/src/CloudWatchOmni/Space.ts

A CloudWatch Omni space: the container, inside a domain, that SLOs, alerts and dashboards live in and that telemetry queries run against.

A space with its operator role

import * as CloudWatchOmni from "@alchemy.run/aws/CloudWatchOmni";
const { accountId } = yield* AWS.AWSEnvironment.current;
const role = yield* AWS.IAM.Role("SpaceOperator", {
assumeRolePolicyDocument: {
Version: "2012-10-17",
Statement: [
{
Effect: "Allow",
Principal: { Service: "cloudwatch.amazonaws.com" },
Action: ["sts:AssumeRole", "sts:TagSession", "sts:SetSourceIdentity", "sts:SetContext"],
Condition: { StringEquals: { "aws:SourceAccount": accountId } },
},
],
},
managedPolicyArns: ["arn:aws:iam::aws:policy/CloudWatchOmniSpaceAccessPolicy"],
});
const domain = yield* CloudWatchOmni.Domain("Observability", {
domainName: "acme-observability",
});
const space = yield* CloudWatchOmni.Space("Production", {
domainId: domain.domainId,
dataAccessRoleArn: role.roleArn,
});

Encrypt the space with your own KMS key

const space = yield* CloudWatchOmni.Space("Production", {
domainId: domain.domainId,
dataAccessRoleArn: role.roleArn,
encryptionConfiguration: {
encryptionStrategy: "CUSTOMER_MANAGED",
kmsKeyArn: key.keyArn,
},
});

Space.lookup references a space Alchemy doesn’t manage (created in the console or by another stack), found by spaceName. It is read during plan/deploy and never created, updated or deleted.

const space = AWS.CloudWatchOmni.Space.lookup({ spaceName: "production" });
const slo = yield* CloudWatchOmni.Slo("CheckoutAvailability", {
spaceId: space.spaceId,
// ...
});

Source: packages/aws/src/CloudWatchOmni/StartExperimentRun.ts

Runtime binding for cloudwatch:StartExperimentRun — start a hosted run of the bound Experiment: the service runs the dataset’s cases against one version of the target with a Bedrock AgentCore batch evaluation and scores them with the given evaluators. The experiment’s ID is injected automatically.

Provide the implementation with Effect.provide(AWS.CloudWatchOmni.StartExperimentRunHttp).

// init — bind the operation to the experiment
const startRun = yield* AWS.CloudWatchOmni.StartExperimentRun(experiment);
// runtime
const { run } = yield* startRun({
target: { agentCoreRuntime: { endpointArn, version: "7" } },
dataset: { source: "AGENTCORE", id: datasetId },
evaluators: [{ evaluatorId: "Builtin.Correctness" }],
});

Source: packages/aws/src/CloudWatchOmni/StopExperimentRun.ts

Runtime binding for cloudwatch:StopExperimentRun — stop a run of the bound Experiment: it ends as DID_NOT_FINISH with the status reason STOPPED. The experiment’s ID is injected automatically.

Provide the implementation with Effect.provide(AWS.CloudWatchOmni.StopExperimentRunHttp).

// init — bind the operation to the experiment
const stopRun = yield* AWS.CloudWatchOmni.StopExperimentRun(experiment);
// runtime
yield* stopRun({ runId: "nightly-2026-12-01", detail: "superseded by a newer build" });