Skip to the content.

Prompt templates — making agents experts on their task

By default an agent’s prompt is generic: its name, a one-line description, and its raw output schema. That’s enough to function, but not enough to be expert. The prompt_templates system lets you attach a rich, versioned, domain-specific system prompt (persona + rubric + few-shot examples) to each agent — while keeping the engine itself domain-agnostic.

The key design rule for this open-source engine:

The engine ships a generic prompt-template mechanism. Your domain ships the actual expert prompts as seed data.

So agentic-golang provides the table, the loader, the executor wiring, and one small generic example. A downstream product (e.g. a compliance platform) seeds its own specific prompts — “the Article 10 data-governance evaluator”, “the underwriting risk classifier”, etc. — without forking the engine.

Schema (generic)

CREATE TABLE prompt_templates (
    prompt_template_id   TEXT PRIMARY KEY,
    agent_type           TEXT,            -- bind by role (classifier, evaluator, …)
    agent_definition_id  TEXT,            -- or bind to a specific agent (optional)
    domain_id            TEXT,            -- optional scoping
    framework_id         TEXT,            -- optional scoping
    system_prompt        TEXT NOT NULL,   -- persona + rubric, may contain 
    few_shot_json        JSONB,           -- [{ "input": …, "output": … }, …]
    variables_json       JSONB,           -- declared template variables + defaults
    version              INT  NOT NULL DEFAULT 1,
    is_active            BOOLEAN NOT NULL DEFAULT TRUE,
    created_at           TIMESTAMPTZ NOT NULL DEFAULT NOW(),
    updated_at           TIMESTAMPTZ NOT NULL DEFAULT NOW()
);

Resolution order when the executor builds a prompt for a node:

  1. the agent’s default_prompt_template_id, if set; else
  2. the most specific active template matching agent_definition_id; else
  3. an active template matching agent_type (+ domain/framework if present); else
  4. the built-in generic fallback (current behavior).

Rendering

The chosen template’s system_prompt is rendered with session context injected via (e.g., ,), then the agent’s output schema is appended, then few_shot_json examples are added as alternating user/assistant turns. This is what lets one “evaluator” agent become the specific evaluator for whatever the current session is about.

Phases

For downstream products

Seed your expert prompts in your own migrations/seeds, not here. Keep regulated or proprietary prompt content in the private repo. The engine never needs to know your domain — it only needs default_prompt_template_id to resolve.