# US Brand Signal Policy Simulator (`zinin/us-brand-signal-policy-simulator`) Actor

Compare deterministic threshold policies across buyer-supplied opaque signal scores without selecting a winner or verifying external data.

- **URL**: https://apify.com/zinin/us-brand-signal-policy-simulator.md
- **Developed by:** [Tim Zinin](https://apify.com/zinin) (community)
- **Categories:** MCP servers, Automation, Marketing
- **Stats:** 1 total users, 0 monthly users, 0.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

Pay per event

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.
Since this Actor supports Apify Store discounts, the price gets lower the higher subscription plan you have.

Learn more: https://docs.apify.com/platform/actors/running/actors-in-store#pay-per-event

## What's an Apify Actor?

Actors are web data automations that power AI and operations. They run on the Apify platform to scrape websites, process data, connect APIs, and automate workflows.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.
Actors are written with capital "A".

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.
The best way to integrate Actors is as follows.

- **AI agents and MCP clients** — the [Apify MCP server](https://docs.apify.com/integrations/mcp.md) at `https://mcp.apify.com` (remote, streamable HTTP, OAuth on first use).
- **Agentic workflows and local Actor development** — [Agent Skills](https://apify.com/.well-known/agent-skills/index.json) with the [Apify CLI](https://docs.apify.com/cli/docs.md): `npm install -g apify-cli`, then `apify login`.
- **JavaScript/TypeScript projects** — the official [JS/TS client](https://docs.apify.com/api/client/js/docs.md): `npm install apify-client`.
- **Python projects** — the official [Python client](https://docs.apify.com/api/client/python/docs.md): `pip install apify-client`.
- **Any other language** — the [REST API](https://docs.apify.com/api/v2.md).

For usage examples, see the [API](#api) section below.

For more details, see Apify documentation as [Markdown index](https://docs.apify.com/llms.txt) and [Markdown full-text](https://docs.apify.com/llms-full.txt).

# README

## US Brand Signal Policy Simulator

US Brand Signal Policy Simulator compares several buyer-defined threshold policies over the same opaque signal scores. It returns the accepted, review, and rejected IDs for every policy, pairwise difference counts, and a per-signal sensitivity summary. It does not choose a winner, recommend a policy, verify a score, or make a truth claim.

### What you submit and receive

You submit 1 to 100 unique rows such as `{signalId, normalizedScore}` and 1 to 20 unique policies with `reviewThreshold < acceptThreshold`. Scores and thresholds are integers from 1 to 100. The Actor sorts IDs and policy IDs, so input order does not affect the report.

You receive one Dataset report containing:

- `policyResults`: sorted `acceptedIds`, `reviewIds`, `rejectedIds`, counts, and a classification digest for every policy;
- `comparisons`: stable pairwise counts of changed and unchanged decisions, without ranking either policy;
- `sensitivitySummary`: how many policies put each signal in each outcome and its decision spread;
- SHA-256 digests for input, rows, policies, results, comparisons, sensitivity, and the complete report;
- a truthful `OUTPUT` receipt after one confirmed Dataset write.

### Run it

1. Open **Try for free** in the Actor Console.
2. Paste the exact JSON from the Input section or `examples/input.json`.
3. Start the run and read the single report row from the Dataset.
4. Read the terminal delivery receipt from `OUTPUT`.

`public-task.json` is the exact public-task input and is identical to the runnable prefill.

### Pricing

Pay per event: **$0.005 per run start plus $0.010 per delivered result** on the FREE tier. The result event is emitted only after one confirmed Dataset write. The buyer cap must cover both events.

| Tier | Discount | Start | Delivered result |
| --- | ---: | ---: | ---: |
| FREE | 0% | $0.00500 | $0.01000 |
| BRONZE | 5% | $0.00475 | $0.00950 |
| SILVER | 10% | $0.00450 | $0.00900 |
| GOLD | 15% | $0.00425 | $0.00850 |
| PLATINUM | 18% | $0.00410 | $0.00820 |
| DIAMOND | 20% | $0.00400 | $0.00800 |

Invalid input, insufficient cap, uncertain delivery, and an uncharged or multiply charged result are not reported as successful results. The Actor never retries a paid Dataset push.

### Freshness and determinism

There is no external freshness: this Actor reads only the JSON supplied in the run and does not read the clock. Rerun when the buyer's upstream scores or policies change. The same input always produces the same sorted rows and digests.

### Input

```json
{
  "schemaVersion": "1.0",
  "rows": [
    {"signalId": "signal-001", "normalizedScore": 96},
    {"signalId": "signal-002", "normalizedScore": 82},
    {"signalId": "signal-003", "normalizedScore": 61},
    {"signalId": "signal-004", "normalizedScore": 39}
  ],
  "policies": [
    {"policyId": "balanced", "reviewThreshold": 50, "acceptThreshold": 80, "thresholdOrder": "review_lt_accept"},
    {"policyId": "strict", "reviewThreshold": 70, "acceptThreshold": 90, "thresholdOrder": "review_lt_accept"},
    {"policyId": "broad", "reviewThreshold": 30, "acceptThreshold": 70, "thresholdOrder": "review_lt_accept"}
  ]
}
```

### Output

The Dataset has exactly one report item when delivery succeeds. `policyResults` are sorted by `policyId`; each outcome ID list is sorted by `signalId`. `comparisons` use the stable `policyA < policyB` order. `OUTPUT` contains the terminal delivery receipt and links represented by the Store output schema.

### Related public Actors

These Actors can feed or use the same buyer-owned signal workflow. This Actor does not call them.

| Actor | Use it for |
| --- | --- |
| [US Brand Offer Evidence Normalizer](https://apify.com/zinin/us-brand-offer-evidence-normalizer) | Normalize evidence-derived inputs before simulating threshold policies. |
| [US Brand Signal Metrics Aggregator](https://apify.com/zinin/us-brand-signal-metrics-aggregator) | Summarize score rows before policy simulation. |
| [US Brand Action Queue](https://apify.com/zinin/us-brand-action-queue) | Convert a buyer-selected outcome into next-action rows. |
| [US Brand Signal Brief Composer](https://apify.com/zinin/us-brand-signal-brief-composer) | Turn a bounded comparison report into an agent-readable brief. |
| [US Brand Evidence Snapshot Diff](https://apify.com/zinin/us-brand-evidence-snapshot-diff) | Compare two buyer-supplied snapshots before updating scores. |

### Limitations

- IDs and scores are opaque buyer input. Accepted does not mean verified, true, safe, valuable, or likely to convert.
- There are no network requests, proxies, BYOK keys, LLM calls, clock reads, state, child Actors, or Dataset input.
- The maximum input is 100 rows and 20 policies. Duplicate IDs, extra fields, non-integer values, and invalid threshold ordering fail closed.
- A complete report must fit below 64 KiB. If a valid maximum-size input would exceed this bound, the Actor returns `output_too_large` instead of truncating or charging for a partial report.
- JSON Schema validates structure; runtime validation additionally enforces sorting, digests, counts, threshold ordering, and exact report equality.

### FAQ

**Does the Actor choose the best policy?** No. It only shows outcomes and differences. The buyer or downstream workflow decides.

**What does sensitivity mean here?** It is the number of submitted policies that place one signal in accepted, review, or rejected, plus the number of distinct outcomes.

**Are scores probabilities or verified evidence?** No. They are buyer-supplied normalized integers used for deterministic simulation.

**What happens at a boundary?** Accept is inclusive at `acceptThreshold`; review is inclusive at `reviewThreshold` and exclusive at `acceptThreshold`; lower scores are rejected.

**What happens after uncertain delivery?** The Actor makes no second Dataset push and records a delivery error instead of claiming success.

Built by [zinin](https://apify.com/zinin).

# Actor input Schema

## `schemaVersion` (type: `string`):

The only supported closed contract version.

## `rows` (type: `array`):

One to 100 unique opaque IDs with integer scores from 1 to 100.

## `policies` (type: `array`):

One to 20 unique policies. Review must be strictly below accept.

## Actor input object example

```json
{
  "schemaVersion": "1.0",
  "rows": [
    {
      "signalId": "signal-001",
      "normalizedScore": 96
    },
    {
      "signalId": "signal-002",
      "normalizedScore": 82
    },
    {
      "signalId": "signal-003",
      "normalizedScore": 61
    },
    {
      "signalId": "signal-004",
      "normalizedScore": 39
    }
  ],
  "policies": [
    {
      "policyId": "balanced",
      "reviewThreshold": 50,
      "acceptThreshold": 80,
      "thresholdOrder": "review_lt_accept"
    },
    {
      "policyId": "strict",
      "reviewThreshold": 70,
      "acceptThreshold": 90,
      "thresholdOrder": "review_lt_accept"
    },
    {
      "policyId": "broad",
      "reviewThreshold": 30,
      "acceptThreshold": 70,
      "thresholdOrder": "review_lt_accept"
    }
  ]
}
```

# Actor output Schema

## `OUTPUT` (type: `string`):

API link to the terminal receipt when OUTPUT was stored.

## `report` (type: `string`):

API link to the one deterministic report row after confirmed result delivery.

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "schemaVersion": "1.0",
    "rows": [
        {
            "signalId": "signal-001",
            "normalizedScore": 96
        },
        {
            "signalId": "signal-002",
            "normalizedScore": 82
        },
        {
            "signalId": "signal-003",
            "normalizedScore": 61
        },
        {
            "signalId": "signal-004",
            "normalizedScore": 39
        }
    ],
    "policies": [
        {
            "policyId": "balanced",
            "reviewThreshold": 50,
            "acceptThreshold": 80,
            "thresholdOrder": "review_lt_accept"
        },
        {
            "policyId": "strict",
            "reviewThreshold": 70,
            "acceptThreshold": 90,
            "thresholdOrder": "review_lt_accept"
        },
        {
            "policyId": "broad",
            "reviewThreshold": 30,
            "acceptThreshold": 70,
            "thresholdOrder": "review_lt_accept"
        }
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("zinin/us-brand-signal-policy-simulator").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = {
    "schemaVersion": "1.0",
    "rows": [
        {
            "signalId": "signal-001",
            "normalizedScore": 96,
        },
        {
            "signalId": "signal-002",
            "normalizedScore": 82,
        },
        {
            "signalId": "signal-003",
            "normalizedScore": 61,
        },
        {
            "signalId": "signal-004",
            "normalizedScore": 39,
        },
    ],
    "policies": [
        {
            "policyId": "balanced",
            "reviewThreshold": 50,
            "acceptThreshold": 80,
            "thresholdOrder": "review_lt_accept",
        },
        {
            "policyId": "strict",
            "reviewThreshold": 70,
            "acceptThreshold": 90,
            "thresholdOrder": "review_lt_accept",
        },
        {
            "policyId": "broad",
            "reviewThreshold": 30,
            "acceptThreshold": 70,
            "thresholdOrder": "review_lt_accept",
        },
    ],
}

# Run the Actor and wait for it to finish
run = client.actor("zinin/us-brand-signal-policy-simulator").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print("💾 Check your data here: https://console.apify.com/storage/datasets/" + run["defaultDatasetId"])
for item in client.dataset(run["defaultDatasetId"]).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "schemaVersion": "1.0",
  "rows": [
    {
      "signalId": "signal-001",
      "normalizedScore": 96
    },
    {
      "signalId": "signal-002",
      "normalizedScore": 82
    },
    {
      "signalId": "signal-003",
      "normalizedScore": 61
    },
    {
      "signalId": "signal-004",
      "normalizedScore": 39
    }
  ],
  "policies": [
    {
      "policyId": "balanced",
      "reviewThreshold": 50,
      "acceptThreshold": 80,
      "thresholdOrder": "review_lt_accept"
    },
    {
      "policyId": "strict",
      "reviewThreshold": 70,
      "acceptThreshold": 90,
      "thresholdOrder": "review_lt_accept"
    },
    {
      "policyId": "broad",
      "reviewThreshold": 30,
      "acceptThreshold": 70,
      "thresholdOrder": "review_lt_accept"
    }
  ]
}' |
apify call zinin/us-brand-signal-policy-simulator --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "command": "npx",
            "args": [
                "mcp-remote",
                "https://mcp.apify.com/?tools=zinin/us-brand-signal-policy-simulator",
                "--header",
                "Authorization: Bearer <YOUR_API_TOKEN>"
            ]
        }
    }
}

```

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/qiXjqaL8vRNdhyP9a/builds/zU2uondwP83B7Tdsy/openapi.json
