Skip to content

symfonic.core.prompt.sections

sections

Built-in PromptSection implementations.

AgentsSection dataclass

AgentsSection(
    name: str = "Available Agents",
    required: bool = False,
    priority: int = 45,
    cache_breakpoint: bool = False,
)

Section that renders available agents from state.

render async

render(state: PromptState) -> str

Render available agents list.

Source code in src/symfonic/core/prompt/sections.py
async def render(self, state: PromptState) -> str:
    """Render available agents list."""
    agents = state.get("agents_context", [])
    if not agents:
        return ""
    return "\n".join(f"- {a}" for a in agents)

LinkedContextSection dataclass

LinkedContextSection(
    name: str = "Associated Context",
    required: bool = False,
    priority: int = 35,
    cache_breakpoint: bool = False,
)

Section that renders spreading activation results as associated facts.

Formats neighbor nodes compactly to minimize token usage: [linked] Marinos -> prefers: Pescado, Ribeye (via: food_preference)

render async

render(state: PromptState) -> str

Render linked context from spreading activation results.

Source code in src/symfonic/core/prompt/sections.py
async def render(self, state: PromptState) -> str:
    """Render linked context from spreading activation results."""
    linked = state.get("linked_context")
    if not linked:
        return ""

    if isinstance(linked, str):
        return linked

    if isinstance(linked, list):
        lines: list[str] = []
        for item in linked:
            if isinstance(item, dict):
                source = item.get("source", "?")
                target = item.get("target", "?")
                rel = item.get("relationship", "associated")
                lines.append(f"[linked] {source} -> {rel}: {target}")
            else:
                lines.append(f"[linked] {item}")
        return "\n".join(lines)

    return str(linked)

MemorySection dataclass

MemorySection(
    name: str = "Memory Context",
    required: bool = False,
    priority: int = 30,
    cache_breakpoint: bool = False,
)

Section that renders memory context from state.

render async

render(state: PromptState) -> str

Render memory context entries.

Source code in src/symfonic/core/prompt/sections.py
async def render(self, state: PromptState) -> str:
    """Render memory context entries."""
    ctx = state.get("memory_context")
    if not ctx:
        return ""
    if isinstance(ctx, dict):
        return "\n".join(f"- {k}: {v}" for k, v in ctx.items())
    return str(ctx)

ScopeSection dataclass

ScopeSection(
    name: str = "Scope",
    required: bool = False,
    priority: int = 10,
    cache_breakpoint: bool = False,
)

Section that renders tenant scope from state.

render async

render(state: PromptState) -> str

Render tenant scope.

Source code in src/symfonic/core/prompt/sections.py
async def render(self, state: PromptState) -> str:
    """Render tenant scope."""
    tenant = state.get("tenant_id")
    if not tenant:
        return ""
    sub = state.get("sub_tenant_id", "")
    return f"Tenant: {tenant}" + (f"\nSub-tenant: {sub}" if sub else "")

SkillsSection dataclass

SkillsSection(
    name: str = "Available Skills",
    required: bool = False,
    priority: int = 40,
    cache_breakpoint: bool = False,
)

Section that renders available skills from state.

render async

render(state: PromptState) -> str

Render available skills list.

Source code in src/symfonic/core/prompt/sections.py
async def render(self, state: PromptState) -> str:
    """Render available skills list."""
    skills = state.get("skills_context", [])
    if not skills:
        return ""
    return "\n".join(f"- {s}" for s in skills)

StaticSection dataclass

StaticSection(
    name: str,
    required: bool = False,
    priority: int = 50,
    content: str = "",
    cache_breakpoint: bool = False,
    cache_ttl: Literal["5m", "1h"] | None = None,
)

Section with fixed content.

v7.24.0: cache_ttl (None / "5m" / "1h") propagates into the section's terminal CacheBlock via the getattr path in :class:PromptBuilder. None (default) preserves v7.23 wire shape -- the bare {"type":"ephemeral"} marker. "1h" flips the marker to {"type":"ephemeral","ttl":"1h"} when the section actually carries a cache breakpoint. Used by the stratigraphic L1 section to honour FrameworkConfig.system_prefix_cache_ttl.

render async

render(state: PromptState) -> str

Return the fixed content.

Source code in src/symfonic/core/prompt/sections.py
async def render(self, state: PromptState) -> str:
    """Return the fixed content."""
    return self.content