# Conditional Logic

The conditional logic provides an additional layer of granular control over the combined conditions criteria that should be met for the execution of the Lit Action. The Lit Action execution can be tailored to respond to varying situations, such as when a certain threshold has been exceeded or a specific condition has been satisfied, and the conditions can be checked according to a specified time interval.

{% hint style="info" %}
The default condition logic is set with type `EVERY` and no interval (i.e. continuous monitoring).
{% endhint %}

{% hint style="warning" %}
Keep in mind, if you've configured a `WebhookCondition` or `ContractCondition` with a very low interval, there's a possibility that your requests will get rejected due to rate limiting constraints from your provider or the endpoint that you're calling.
{% endhint %}

{% code overflow="wrap" fullWidth="true" %}

```typescript
newCircuit.setConditionalLogic({
    type: "TARGET",
    targetCondition: "1",
    interval: 120000 // milliseconds, Circuit loop called every two minutes
})
```

{% endcode %}

**Conditional Logic Parameters:**

<pre class="language-typescript" data-overflow="wrap" data-full-width="true"><code class="lang-typescript"><strong>/* The type of the conditional logic. It can be "THRESHOLD", "TARGET", or "EVERY.*/
</strong><strong>type: "THRESHOLD" | "TARGET" | "EVERY".
</strong><strong>
</strong><strong>/* Used when the type is "THRESHOLD". It's the threshold number of conditions that 
</strong><strong>    must have passed in order for the Lit Action to run.*/
</strong><strong>value?: number;
</strong>
/* Used when the type is "TARGET". It's the specific Condition Id (In order of Conditions Added to Array starting from id "1") that must be met in order for the Lit Action to run.*/
targetCondition?: string;

/* Optional. It's the frequency of condition checks. If omitted, the condition is checked 
    every 30 minutes (1,800,000 ms). Resolves in milliseconds.*/
interval?: number;
</code></pre>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.irrevocable.dev/sdk-reference/conditional-logic.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
