***

title: promptHasSection
slug: /reference/typescript/agents/agent-base/prompt-has-section
description: Check whether a named section exists in the agent's prompt.
max-toc-depth: 3
---------------------

For a complete index of all SignalWire documentation pages, fetch https://signalwire.com/docs/llms.txt

[prompt-add-section]: /docs/server-sdks/reference/typescript/agents/agent-base/prompt-add-section

Check whether a named section already exists in the agent's POM (Prompt Object Model)
prompt. Useful for conditionally adding content to avoid duplicate sections.

## **Parameters**

<ParamField path="title" type="string" required={true} toc={true}>
  The section title to look up. Must match the title passed to
  [`promptAddSection()`][prompt-add-section].
</ParamField>

## **Returns**

`boolean` -- `true` if a section with the given title exists, `false` otherwise.

## **Example**

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

const agent = new AgentBase({ name: 'assistant', route: '/assistant' });
agent.promptAddSection('Greeting', { body: 'Always greet the caller by name.' });

if (!agent.promptHasSection('Policies')) {
  agent.promptAddSection('Policies', { body: 'Follow company guidelines.' });
}
await agent.serve();
```