> For the complete documentation index, see [llms.txt](https://docs.irrevocable.dev/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.irrevocable.dev/sdk-reference/conditional-logic.md).

# 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
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

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

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
