> This page is for Server SDKs.

> Fetch clean Markdown by appending `.md` to any page URL under https://signalwire.com/docs or requesting it with the HTTP header `Accept: text/markdown`. The root index at https://signalwire.com/docs/llms.txt lists the available documentation indexes.

# setSemanticGates

> Set how the call checks the semantic gates on its SWAIG functions.

[ref-agentbase]: /docs/server-sdks/reference/typescript/agents/agent-base

[semanticgate]: /docs/server-sdks/reference/typescript/agents/semantic-gate

[ai-params]: /docs/swml/reference/calling/ai/params

Set how the call checks the [semantic gates][semanticgate] on its SWAIG functions.
Each option sets one [AI parameter][ai-params]. An option left out leaves that
setting as it is, and the platform default applies to a setting that was never
set.

## Parameters

**`opts`** `object`

The gate settings.

---

**`opts.enabled`** `boolean`

`false` runs gated functions without checking their gates. Sets
`semantic_gates_enabled`; the platform default is `true`.

---

**`opts.timeoutMs`** `number`

How long one gate check may take, an integer from 500 to 10000 milliseconds. A
check that runs out of time blocks the function. Sets
`semantic_gate_timeout_ms`; the platform default is 2500.

---

**`opts.history`** `number`

How many recent conversation entries the decision model reads, an integer from
0 to 100. Sets `semantic_gate_history`; the platform default is 20.

---

Throws when a value has the wrong type or is out of range, without changing any
setting.

## Returns

[`AgentBase`][ref-agentbase] -- Returns `this` for method chaining.

## Examples

```typescript {5}
import { AgentBase } from '@signalwire/sdk';

const agent = new AgentBase({ name: 'account-agent', route: '/account' });
agent.setPromptText('You help callers manage their account.');
agent.setSemanticGates({ timeoutMs: 4000, history: 40 });
await agent.serve();
```