Skip to main content

Architecture Patterns

PromptPack has grown from a simple prompt-packaging format into a full-stack specification for conversational AI systems. This page explains how the major building blocks relate to each other and when to use each one.

How the Pieces Fit Together

A PromptPack is organized in layers. Lower layers are simpler and more universal; higher layers are optional and compose on top of the lower ones.

┌─────────────────────────────────────────────┐
│ Agents Inter-system discovery (A2A) │ v1.3
├─────────────────────────────────────────────┤
│ Workflow Intra-pack state machine │ v1.3
├─────────────────────────────────────────────┤
│ Evals Async quality measurement │ v1.2
├─────────────────────────────────────────────┤
│ Validators Inline guardrails │ v1.0
├─────────────────────────────────────────────┤
│ Tools & Fragments Shared resources │ v1.0
├─────────────────────────────────────────────┤
│ Prompts Core behavior definitions │ v1.0
└─────────────────────────────────────────────┘

Prompts define what the LLM does. Tools & Fragments provide shared resources that prompts reference. Validators add inline guardrails that block bad output. Evals add async quality measurement that scores and reports. Workflow orchestrates transitions between prompts via a state machine. Agents expose prompts as discoverable services via the A2A protocol.

Each layer is optional — a valid PromptPack only requires id, name, version, template_engine, and at least one prompt. You adopt higher layers only when you need them.

Workflows vs Agents

These two v1.3 features solve different problems and can be used independently or together.

AspectWorkflowAgents
PurposeOrchestrate transitions within a packMake prompts discoverable across systems
MechanismState machine with event-driven transitionsA2A Agent Cards with metadata and tags
ScopeIntra-pack (states reference prompt keys)Inter-system (external services discover agents)
Requiresworkflow top-level fieldagents top-level field
Entry pointworkflow.entry — first state in the machineagents.entry — default agent for incoming requests
Key benefitAutomated routing without caller logicMulti-agent discovery and interoperability

Decision Matrix

ScenarioUse Workflow?Use Agents?
Single prompt, no routing needed
Multiple prompts, caller chooses which to invoke
Automated routing between prompts based on eventsYes
Prompts need to be discoverable by external systemsYes
Automated routing and external discoveryYesYes
Standalone agents communicating via A2A (no internal state machine)Yes
info

Workflow and agents are orthogonal. A prompt can participate in a workflow state and be an agent member simultaneously. The workflow manages intra-pack state; agents manage inter-system discovery.

Validators vs Evals

Both assess LLM output quality, but they operate at different points in the pipeline and serve different purposes.

AspectValidatorsEvals
Runs when?Inline, every responseAsync, on schedule or trigger
Blocks output?Yes (when fail_on_violation: true)No — scores and reports
ScopePrompt-level onlyPrompt-level or pack-level
Type systemEnum with custom escape hatchFree string (runtimes define types)
MetricsNonePrometheus-style metric declarations
Version introducedv1.0v1.2

Decision Matrix

ScenarioUse Validators?Use Evals?
Block toxic or unsafe content before it reaches usersYes
Monitor tone quality over time with dashboardsYes
Enforce character limits on social media responsesYes
Measure brand voice consistency across all promptsYes
PII detection that must never leakYes
Sample 10% of responses for LLM-judge quality scoringYes
Both block bad output and track quality trendsYesYes
info

Validators and evals are complementary, not competitive. Use validators for hard safety guardrails and evals for continuous quality monitoring. The same prompt engineer typically authors both.

Orchestration Patterns

The workflow state machine supports several common multi-prompt patterns. Choose based on your use case.

Router + Specialists

A triage prompt classifies requests and routes to specialized prompts.

         ┌─ billing ─────┐
triage ──┤ ├── closing
└─ technical ───┘

When to use: Customer support, help desks, any system where incoming requests need classification before handling.

Pipeline

Prompts execute in sequence, each processing the output of the previous one.

intake ── analyze ── draft ── review

When to use: Document processing, content generation pipelines, multi-step analysis.

Agent Mesh

Multiple agents communicate via A2A without a central workflow. Each agent discovers and invokes others through tool references.

researcher ←→ fact_checker ←→ writer

When to use: Loosely coupled agents that need to collaborate without rigid sequencing. Use the agents section without workflow.

Hybrid

Combine workflow orchestration internally with agent discovery externally.

[Workflow: triage → specialist → closing]
↕ A2A
[External systems discover and invoke agents]

When to use: Systems that need both internal routing logic and external interoperability.

Multimodal Integration

The media configuration (v1.1+) composes with all other features:

  • With Prompts: Each prompt can declare its own media config — supported types, format restrictions, size limits, and multimodal examples with parts arrays
  • With Validators: Validators run on the text output regardless of whether the input was multimodal
  • With Evals: Evals can assess multimodal interactions (e.g., an LLM judge evaluating whether the response correctly interpreted an image)
  • With Workflow: A workflow state can route to a prompt that accepts images, while another state routes to a text-only prompt
  • With Agents: Agent input/output modes (input_modes, output_modes) declare which MIME types the agent supports, complementing the prompt-level media config
info

Multimodal and text-only prompts can coexist in the same pack. A pack might have an image-aware product_lookup prompt and a text-only catalog_writer prompt — the media config is per-prompt, not per-pack.

Feature Compatibility Matrix

FeatureVersionCombines With
Promptsv1.0Everything
Tools & Fragmentsv1.0Prompts, Workflow, Agents
Validatorsv1.0Prompts
Parametersv1.0Prompts, Model Overrides
Tested Modelsv1.0Prompts
Model Overridesv1.0Prompts
Media (multimodal)v1.1Prompts, Agents (MIME types)
Evalsv1.2Prompts (prompt-level), Pack (pack-level)
Workflowv1.3Prompts (via prompt_task), Agents
Agentsv1.3Prompts (via members), Workflow

Next Steps