Create an agent

Agents are contract templates. They define the condition and settlement window for your outcomes.

Agents are created and managed in the dashboard at app.thewitn.com/dashboard/agents.

What is an agent?

An agent is a named template. It defines three things:

  • The billable condition: the boolean rule that must be satisfied for the outcome to confirm.
  • The settlement window: how long witn waits after the latest event before making the current result final.
  • The attribution method: how billing quantities are counted when multiple events carry a value.

The snapshot model

When the first event opens an outcome, witn copies the agent's contract onto the outcome. After that, the outcome is independent. Changing the agent does not affect open outcomes.

This means you can update an agent at any time without changing the behavior of existing outcomes.

Each outcome uses the contract that was in effect when it was opened. If you need a different contract for new outcomes, update the agent before sending their first events.

Contract fields

FieldTypeDescription
settlement_periodinteger (seconds)How long witn waits after the latest event before the outcome resolves. Default: 259,200 (72 hours). Min 1, max 15,552,000 (180 days).
conditionobjectThe billable condition. See Billable conditions.
attribution_method"first", "last", "min", "max", "sum"How multiple events are aggregated for billing. Default: "last".

When the settlement window expires, if the condition was met the outcome confirms; if not, it is missed.

attribution_method

When you submit more than one event with the same action, attribution_method controls which value is used for billing:

ValueMeaning
lastMost recent properties.attribution value (default)
firstFirst properties.attribution value
minSmallest properties.attribution value across all events
maxLargest properties.attribution value across all events
sumSum of all properties.attribution values

Prices live on rate cards

Agents do not have a price. The price is set on the rate card entry for that agent. This means you can charge different customers different prices for the same agent.

To set a price, create or update a rate card and add an entry for the agent.

Creating an agent

Go to Agents in the dashboard and click New agent. Enter a name and configure the contract fields. The condition builder lets you construct AND, OR, and NOT trees visually.

On this page