Documentation
¶
Overview ¶
Package instructions owns the agent-facing instruction text the platform presents through platform_info: the platform-owned "how to operate" baseline (#646), the full instruction composition (baseline beneath the admin business context, persona tuning, and runtime notes), and the platform_info tool's own title and description. Concentrating this text and its layering rules in one package keeps it out of the pkg/platform orchestration code and lets the admin baseline endpoint render the same baseline the agent receives.
Index ¶
- Constants
- func AccessibleTools(allTools []string, p *persona.Persona, reg *persona.Registry) []string
- func Build(accessibleTools []string) string
- func Compose(baseline, rest string) string
- func ComposeForCaller(adminLayer string, allTools []string, p *persona.Persona, ...) string
- func InfoToolDescription(serverName, defaultServerName string, tags []string) string
- func InfoToolTitle(serverName, defaultServerName, fallback string) string
- func ResourcesNote(accessibleTools []string) string
Constants ¶
const ResourcePositioning = "Resources are human-uploaded inputs an agent uses as-is: report templates, " +
"brand files, data dictionaries, sample payloads, and reference documents. Assets are AI-generated " +
"outputs. Knowledge pages are curated facts to search and synthesize. Memory is per-user recall. " +
"If it existed before the conversation and the agent should use it verbatim, it is a resource."
ResourcePositioning states what managed resources are for, relative to the platform's three other content layers, in the wording every surface uses.
It is the single source of truth for that wording. The agent-facing note below embeds it, the portal renders it from ui/src/lib/positioning.ts, and docs/concepts/content-model.md quotes it; TestResourcePositioningIsVerbatim fails when any of those copies drifts from this constant.
Variables ¶
This section is empty.
Functions ¶
func AccessibleTools ¶
AccessibleTools narrows allTools to the names the caller's persona may call, so the baseline names only reachable tools. A nil persona means no persona filtering is in effect (the caller can reach every registered tool); a resolved persona is filtered fail-closed by its allow/deny rules.
func Build ¶
Build returns the platform-owned "how to operate this platform" instruction baseline (#646): the universal operating model that is true for every deployment (discover before acting, reuse what is known, capture what you learn). It is composed beneath the admin-configured business context (server.agent_instructions) rather than re-authored per deployment, and it is versioned with the binary so upgrading the platform updates it everywhere with no per-deployment edits.
It names a tool only when that tool is in accessibleTools, so the baseline never tells an agent to call a tool its persona cannot reach or that the deployment did not enable. accessibleTools is the set of tool names available to the caller: registered on the platform and, for a per-caller baseline, allowed by the caller's persona. A set with none of the baseline's tools yields an empty baseline, since there is nothing to say without a tool to name.
func Compose ¶
Compose joins the platform baseline above the rest of the instruction stack (admin business context + persona tuning + runtime notes). The baseline is always first and is never overridden by the admin or persona layers; either side may be empty.
func ComposeForCaller ¶
func ComposeForCaller(adminLayer string, allTools []string, p *persona.Persona, reg *persona.Registry, notes ...string) string
ComposeForCaller assembles the full agent-instruction stack one caller sees in platform_info, layering it in a fixed order so the rule lives in one place:
- the platform baseline (gated to the tools this persona may call),
- the admin business/deployment context, with the persona's suffix/override applied to that layer only,
- runtime notes (for example the uploaded-resources hint), appended last.
The baseline is always present and is never replaced by the admin or persona layers. p may be nil (no persona filtering or tuning). Blank notes are skipped.
func InfoToolDescription ¶
InfoToolDescription builds the platform_info tool's description. It is itself operating-model text (platform_info is the mandatory first call, then search), so it lives here next to the baseline that carries the same guidance. A custom server name and tags are woven in for discovery.
func InfoToolTitle ¶
InfoToolTitle returns the display name for the platform_info tool. A custom server name is used as the title (so a client shows e.g. "ACME Data Platform" instead of "platform_info"); the default server name falls back to fallback.
func ResourcesNote ¶ added in v1.116.0
ResourcesNote returns the managed-resources section of the agent instructions: the positioning statement above plus the operating rule that makes it actionable (consult a template before formatting a deliverable, resolve a file the user names by its own vocabulary, treat prompt attachments as authoritative).
The caller appends it as a runtime note only when the deployment actually has managed resources. Like Build, it names a tool only when that tool is in accessibleTools: a caller who can reach `search` is steered through discovery, and a caller who cannot is steered to the resources/list protocol method, which is persona-filtered but is not a tool and is therefore always reachable.
Types ¶
This section is empty.