> 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. # 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** **`debug`** `boolean` — default: false When `true`, print debug information to the console during [`renderMarkdown()`](/docs/server-sdks/reference/typescript/agents/pom-object-model/render-markdown). --- ## **Properties** **`sections`** `Section[]` The top-level [`Section`][section] objects in the model. --- **`debug`** `boolean` Whether debug output is printed during rendering. --- ## **Methods** #### [addSection](/docs/server-sdks/reference/typescript/agents/pom-object-model/add-section) Add a top-level section to the model. #### [findSection](/docs/server-sdks/reference/typescript/agents/pom-object-model/find-section) Find a section by title (recursive search). #### [addPomAsSubsection](/docs/server-sdks/reference/typescript/agents/pom-object-model/add-pom-as-subsection) Append another model's sections as subsections. #### [toDict](/docs/server-sdks/reference/typescript/agents/pom-object-model/to-dict) Convert the model to an array of section data objects. #### [toJson](/docs/server-sdks/reference/typescript/agents/pom-object-model/to-json) Serialize the model to a JSON string. #### [toYaml](/docs/server-sdks/reference/typescript/agents/pom-object-model/to-yaml) Serialize the model to a YAML string. #### [renderMarkdown](/docs/server-sdks/reference/typescript/agents/pom-object-model/render-markdown) Render the model as a Markdown string. #### [renderXml](/docs/server-sdks/reference/typescript/agents/pom-object-model/render-xml) Render the model as an XML document. #### [fromJson](/docs/server-sdks/reference/typescript/agents/pom-object-model/from-json) Build a model from JSON data (static). #### [fromYaml](/docs/server-sdks/reference/typescript/agents/pom-object-model/from-yaml) 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. **`title`** `string` Section heading. Omitted for the (optional) untitled first section. --- **`body`** `string` Section body paragraph text. --- **`bullets`** `string[]` List of bullet point strings. --- **`subsections`** `SectionData[]` Nested child sections, same shape. --- **`numbered`** `boolean` Whether this section is numbered when rendered. --- **`numberedBullets`** `boolean` 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()); ``` > The low-level structured prompt model: nested sections rendered to Markdown, XML, JSON, or YAML. ## Docs - [addPomAsSubsection](https://signalwire.com/docs/server-sdks/reference/typescript/agents/pom-object-model/add-pom-as-subsection.md): Append another model's sections as subsections of a target section. - [addSection](https://signalwire.com/docs/server-sdks/reference/typescript/agents/pom-object-model/add-section.md): Add a top-level section to the model. - [findSection](https://signalwire.com/docs/server-sdks/reference/typescript/agents/pom-object-model/find-section.md): Recursively search all sections and subsections for a matching title. - [fromJson](https://signalwire.com/docs/server-sdks/reference/typescript/agents/pom-object-model/from-json.md): Build a PromptObjectModel from JSON data (static). - [fromYaml](https://signalwire.com/docs/server-sdks/reference/typescript/agents/pom-object-model/from-yaml.md): Build a PromptObjectModel from YAML data (static). - [renderMarkdown](https://signalwire.com/docs/server-sdks/reference/typescript/agents/pom-object-model/render-markdown.md): Render the entire model as a Markdown string. - [renderXml](https://signalwire.com/docs/server-sdks/reference/typescript/agents/pom-object-model/render-xml.md): Render the entire model as an XML document. - [Section](https://signalwire.com/docs/server-sdks/reference/typescript/agents/pom-object-model/section.md): A single section in a PromptObjectModel: title, body, bullets, and nested subsections. - [toDict](https://signalwire.com/docs/server-sdks/reference/typescript/agents/pom-object-model/to-dict.md): Convert the model to an array of section data objects. - [toJson](https://signalwire.com/docs/server-sdks/reference/typescript/agents/pom-object-model/to-json.md): Serialize the model to a JSON string. - [toYaml](https://signalwire.com/docs/server-sdks/reference/typescript/agents/pom-object-model/to-yaml.md): Serialize the model to a YAML string.