AWS.CloudWatchOmni reference
BatchGetOmniSloReport
Section titled “BatchGetOmniSloReport”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).
BatchGetOmniSloReport: Reading SLOs
Section titled “BatchGetOmniSloReport: Reading SLOs”// init — bind the operation to the SLOconst getReport = yield* AWS.CloudWatchOmni.BatchGetOmniSloReport(availability);
// runtimeconst { reports } = yield* getReport({ burnRate: { windowMinutes: 60 } });const report = reports[0];yield* Effect.log(report?.errorBudgetConsumedRatio, report?.burnRate?.value);CompleteExperimentRun
Section titled “CompleteExperimentRun”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 experimentconst completeRun = yield* AWS.CloudWatchOmni.CompleteExperimentRun(experiment);
// runtime — after the run's cases have been reportedconst { run } = yield* completeRun({ runId: "nightly-2026-12-01" });yield* Effect.log(run.summary?.passRate);Domain
Section titled “Domain”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.
Domain: Creating a Domain
Section titled “Domain: Creating a Domain”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: Looking up an existing domain
Section titled “Domain: Looking up an existing domain”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" });Experiment
Section titled “Experiment”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.
Experiment: Creating Experiments
Section titled “Experiment: Creating Experiments”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 itconst 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, },});Experiment: Reporting a Run at Runtime
Section titled “Experiment: Reporting a Run at Runtime”// init — bind the operations to the experimentconst putResults = yield* CloudWatchOmni.PutExperimentRunResults(experiment);const completeRun = yield* CloudWatchOmni.CompleteExperimentRun(experiment);
// runtime — the experiment's ID is injected automaticallyyield* 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",});GetExperiment
Section titled “GetExperiment”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).
GetExperiment: Reading Experiments
Section titled “GetExperiment: Reading Experiments”// init — bind the operation to the experimentconst getExperiment = yield* AWS.CloudWatchOmni.GetExperiment(experiment);
// runtimeconst { experiment: details } = yield* getExperiment();yield* Effect.log(details.latestRun?.verdict);GetExperimentRun
Section titled “GetExperimentRun”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).
GetExperimentRun: Reading Experiment Runs
Section titled “GetExperimentRun: Reading Experiment Runs”// init — bind the operation to the experimentconst getRun = yield* AWS.CloudWatchOmni.GetExperimentRun(experiment);
// runtimeconst { run } = yield* getRun({ runId: "nightly-2026-12-01" });yield* Effect.log(run.status, run.verdict);GetLookup
Section titled “GetLookup”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).
GetLookup: Reading Lookup Tables
Section titled “GetLookup: Reading Lookup Tables”// init — bind the operation to the lookup tableconst getLookup = yield* AWS.CloudWatchOmni.GetLookup(owners);
// runtimeconst { columns, rowCount } = yield* getLookup();GetLookupData
Section titled “GetLookupData”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).
GetLookupData: Reading Lookup Tables
Section titled “GetLookupData: Reading Lookup Tables”// init — bind the operation to the lookup tableconst getLookupData = yield* AWS.CloudWatchOmni.GetLookupData(owners);
// runtime — `rows` is the table's CSV, header row firstconst { rows } = yield* getLookupData();GetOmniSlo
Section titled “GetOmniSlo”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).
GetOmniSlo: Reading SLOs
Section titled “GetOmniSlo: Reading SLOs”// init — bind the operation to the SLOconst getSlo = yield* AWS.CloudWatchOmni.GetOmniSlo(availability);
// runtimeconst { slo } = yield* getSlo();yield* Effect.log(slo.state?.value);ListExperimentRuns
Section titled “ListExperimentRuns”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 experimentconst listRuns = yield* AWS.CloudWatchOmni.ListExperimentRuns(experiment);
// runtimeconst { items } = yield* listRuns({ maxResults: 10 });ListOmniSlos
Section titled “ListOmniSlos”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).
ListOmniSlos: Listing SLOs
Section titled “ListOmniSlos: Listing SLOs”// init — bind the operation to the spaceconst listSlos = yield* AWS.CloudWatchOmni.ListOmniSlos(space);
// runtimeconst { items } = yield* listSlos({ filterCriteria: { stateValue: ["CRITICAL"] } });Lookup
Section titled “Lookup”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.
Lookup: Creating Lookup Tables
Section titled “Lookup: Creating Lookup Tables”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,});Lookup: Reading a Lookup Table at Runtime
Section titled “Lookup: Reading a Lookup Table at Runtime”// init — bind the operation to the lookup tableconst getLookupData = yield* CloudWatchOmni.GetLookupData(owners);
// runtime — the table's ARN is injected automaticallyconst { 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" });PutExperimentRunResults
Section titled “PutExperimentRunResults”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 experimentconst putResults = yield* AWS.CloudWatchOmni.PutExperimentRunResults(experiment);
// runtimeyield* 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.
Slo: Creating SLOs
Section titled “Slo: Creating SLOs”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" } }, },});Slo: Reading an SLO at Runtime
Section titled “Slo: Reading an SLO at Runtime”// init — bind the operation to the SLOconst getReport = yield* CloudWatchOmni.BatchGetOmniSloReport(availability);
// runtime — the SLO's space and ID are injected automaticallyconst { reports } = yield* getReport({ burnRate: { windowMinutes: 60 } });yield* Effect.log(reports[0]?.errorBudgetConsumedRatio);Slo: Looking up an existing SLO
Section titled “Slo: Looking up an existing SLO”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.
Space: Creating a Space
Section titled “Space: Creating a Space”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: Looking up an existing space
Section titled “Space: Looking up an existing space”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, // ...});StartExperimentRun
Section titled “StartExperimentRun”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).
StartExperimentRun: Running Experiments
Section titled “StartExperimentRun: Running Experiments”// init — bind the operation to the experimentconst startRun = yield* AWS.CloudWatchOmni.StartExperimentRun(experiment);
// runtimeconst { run } = yield* startRun({ target: { agentCoreRuntime: { endpointArn, version: "7" } }, dataset: { source: "AGENTCORE", id: datasetId }, evaluators: [{ evaluatorId: "Builtin.Correctness" }],});StopExperimentRun
Section titled “StopExperimentRun”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).
StopExperimentRun: Running Experiments
Section titled “StopExperimentRun: Running Experiments”// init — bind the operation to the experimentconst stopRun = yield* AWS.CloudWatchOmni.StopExperimentRun(experiment);
// runtimeyield* stopRun({ runId: "nightly-2026-12-01", detail: "superseded by a newer build" });