System CoreCore Agents
Vitruvyan Docs
Prompt Governance (PromptAgent)
Last updated: Mar 10, 2026 19:00 UTC
What it does
- Provides a single entry point for prompt resolution:
get_prompt_agent()→PromptAgent. - Enforces the principle: core = capability, vertical = policy.
- The core owns: registry, resolution, policy application, audit metadata.
- Verticals own: identity text, scenario prompts, disclaimers, domain-specific constraints.
- Produces a
PromptResolutionwith full audit trail (hash, version, token estimate) for every prompt used in the system.
Architecture
Core contracts
All types are defined in contracts/prompting.py:
PromptRequest
Input for prompt resolution. Describes what is needed:
| Field | Type | Default | Purpose |
|---|---|---|---|
domain | str | "generic" | Which domain's prompts to query |
scenario | str | "" | Scenario key (e.g., "analysis", "greeting") |
language | str | "en" | ISO language code |
assistant_name | str | "Vitruvyan" | Name to inject into identity template |
template_vars | Dict[str, str] | {} | Additional template variables |
policy | PromptPolicy | no constraints | Policy constraints to apply |
PromptResolution
Output of resolution. Contains the prompt text plus everything needed for audit:
| Field | Type | Purpose |
|---|---|---|
system_prompt | str | The fully composed prompt text |
prompt_id | str | Deterministic ID: prompt.<domain>.<scenario>.v<version> |
prompt_hash | str | SHA-256 hash (first 12 chars) for change detection |
estimated_tokens | int | Token estimate (~1.3× word count) |
policy_applied | bool | Whether policy modified the prompt |
fallback_used | bool | Whether a fallback domain/scenario was used |
The .to_audit_dict() method produces a structured dict for logging/observability.
PromptPolicy
Opt-in constraints. All flags default to False:
| Flag | Effect |
|---|---|
must_declare_limitations | Appends a language-aware limitation declaration |
must_cite_evidence | Appends an evidence-citing instruction |
must_stay_in_domain | Appends a domain-boundary constraint |
required_disclaimers | Dict of language → disclaimer text |
forbidden_claims | List of claim patterns to filter |
PromptRegistry
The PromptRegistry (core/llm/prompts/registry.py) is the domain-aware prompt store:
register_domain(domain, identity, scenarios)— register a domain's prompts at boot time.resolve(domain, scenario, language, **vars)— look up and compose a prompt.- The
"generic"domain is auto-registered at import time with OS-agnostic defaults.
Adding a new domain
Usage
Basic resolution
With policy constraints
Audit trail integration
Relationship with LLMAgent
PromptAgentresolves what prompt text to use (content governance).LLMAgenthandles how to call the LLM (transport, rate limiting, caching).- They are independent gateways — neither imports the other.
- Typical flow:
PromptAgent.resolve()→LLMAgent.complete(prompt=resolution.system_prompt).
Policy engine
Policy is applied as post-processing on the resolved prompt text (core/llm/prompts/policy.py):
- If
must_declare_limitations: appends a language-aware fragment (en/it/es/fr). - If
must_cite_evidence: appends an evidence-citation instruction. - If
must_stay_in_domain: appends a domain-boundary constraint. - If
required_disclaimers: appends the disclaimer for the requested language. - Hash and token estimate are recomputed after policy application.
References
- Contract types:
vitruvyan_core/contracts/prompting.py - PromptAgent:
vitruvyan_core/core/agents/prompt_agent.py - PromptRegistry:
vitruvyan_core/core/llm/prompts/registry.py - Policy engine:
vitruvyan_core/core/llm/prompts/policy.py - LLM / AI Layer:
docs/internal/platform/LLM_LAYER.md