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

# PromptObjectModel

> The low-level structured prompt model: nested sections rendered to Markdown, XML, JSON, or YAML.

[pombuilder]: /docs/server-sdks/reference/typescript/agents/pom-builder

[section]: /docs/server-sdks/reference/typescript/agents/pom-object-model/section

[addsection]: /docs/server-sdks/reference/typescript/agents/pom-object-model/add-section

[fromjson]: /docs/server-sdks/reference/typescript/agents/pom-object-model/from-json

[fromyaml]: /docs/server-sdks/reference/typescript/agents/pom-object-model/from-yaml

`PromptObjectModel` is the low-level, serializable representation of a Prompt
Object Model (POM) document — a tree of nested [`Section`][section] objects,
each with a title, body text, bullet points, and arbitrarily nested
subsections. It renders to Markdown or XML and round-trips through JSON and
YAML.

Most agent code uses the higher-level [`PomBuilder`][pombuilder] wrapper, but
`PromptObjectModel` is exposed directly so that callers can work with the same
structure that `agent.pom` returns and load or save POMs as JSON/YAML.

```typescript {1}
import { PromptObjectModel, Section } from '@signalwire/sdk';

const pom = new PromptObjectModel();
pom.addSection('Role', { body: 'You are a helpful assistant.' });
pom.addSection('Rules', { bullets: ['Be concise', 'Be accurate'] });

console.log(pom.renderMarkdown());
```

## **Constructor**

When `true`, print debug information to the console during
[`renderMarkdown()`](/docs/server-sdks/reference/typescript/agents/pom-object-model/render-markdown).

## **Properties**

The top-level [`Section`][section] objects in the model.

Whether debug output is printed during rendering.

## **Methods**

Add a top-level section to the model.

Find a section by title (recursive search).

Append another model's sections as subsections.

Convert the model to an array of section data objects.

Serialize the model to a JSON string.

Serialize the model to a YAML string.

Render the model as a Markdown string.

Render the model as an XML document.

Build a model from JSON data (static).

Build a model from YAML data (static).

See the [`Section`][section] page for the per-section methods (`addBody`,
`addBullets`, `addSubsection`, `toDict`, `renderMarkdown`, `renderXml`).

## **SectionData**

`SectionData` is the plain, serializable shape used by
[`toDict()`](/docs/server-sdks/reference/typescript/agents/pom-object-model/to-dict),
[`toJson()`](/docs/server-sdks/reference/typescript/agents/pom-object-model/to-json),
[`fromJson()`][fromjson], and [`fromYaml()`][fromyaml] for exchanging POM data.

Section heading. Omitted for the (optional) untitled first section.

Section body paragraph text.

List of bullet point strings.

Nested child sections, same shape.

Whether this section is numbered when rendered.

Whether bullet points are rendered as a numbered list.

## **Example**

### Round-trip through JSON

```typescript {8}
import { PromptObjectModel } from '@signalwire/sdk';

const pom = new PromptObjectModel();
pom.addSection('Intro', { body: 'Welcome.' });
pom.addSection('Rules', { bullets: ['Be nice.', 'Stay on topic.'] });

const json = pom.toJson();
const restored = PromptObjectModel.fromJson(json);
console.log(restored.renderMarkdown());
```