project · 2025 · Data Scientist · SAP
Prompt Framework for Enterprise AI Workflows
A production prompt framework and reasoning engine powering LLM steps across enterprise AI workflows, with configurable reasoning depth, structured output enforcement, safety moderation, and reusable task templates.
Prompts in production are not just text strings. When the same reasoning capability needs to work reliably across many different workflow configurations, varying data inputs, and multiple LLM backends, the prompt layer has to be an engineered system, not a collection of ad-hoc templates. This is that system: designed, built, and technically driven from the ground up.
Architecture
┌─────────────────────────────────────────────────────┐│ Workflow Execution Engine ││ (ordered steps, shared execution state) │└─────────────────────┬───────────────────────────────┘ │ LLM step ▼┌─────────────────────────────────────────────────────┐│ Prompt Framework ││ ││ ┌─────────────────────────────────────────────┐ ││ │ System Prompt Builder │ ││ │ Reasoning level · Expert instructions │ ││ │ Task definition · Few-shot examples │ ││ └──────────────────┬──────────────────────────┘ ││ │ ││ ┌──────────────▼──────────────┐ ││ │ Three-Phase Reasoning │ ││ │ 1. Problem understanding │ ││ │ 2. Reasoning pass (opt.) │ ││ │ 3. Conclusion / output │ ││ └──────────────┬──────────────┘ ││ │ ││ ┌──────────────────▼──────────────────────────┐ ││ │ Safety and Output Layer │ ││ │ Input moderation · Anonymization │ ││ │ Schema enforcement · Output moderation │ ││ └──────────────────┬──────────────────────────┘ │└─────────────────────┼───────────────────────────────┘ │ ▼ Structured JSON Output (validated, schema-enforced result)A reasoning engine, not a template store
The core of the framework is a configurable reasoning engine that composes system prompts from reusable components: a reasoning level (low, medium, or high), expert-domain instructions, a task definition, and optional few-shot examples. This composition happens at runtime, so the same engine can be configured differently for a quick classification step versus a deep root-cause analysis without duplicating prompt logic.
The three-phase reasoning loop separates problem understanding, optional intermediate reasoning, and final conclusion. The intermediate pass is only triggered when the configured reasoning level warrants it, keeping latency predictable for simpler tasks.
Structured and safe by design
Every LLM call exits through a schema enforcement layer that validates the output against a defined JSON structure before it is passed downstream. If the model produces malformed output, the call is retried rather than propagating bad data through the workflow.
Safety is applied at both ends: input anonymization and moderation before the prompt is sent, output moderation before the result is returned. This is not bolted on as an afterthought; it is a required stage in every LLM execution path, making it impossible to bypass for any configured workflow.
Reusable task library
Common LLM operations (analyze, select, re-rank, answer) are defined as named task templates with pre-built prompt structures and output schemas. Workflow authors configure which task a step should perform rather than writing raw prompts, which keeps the prompt logic centralized and testable. Custom task overrides are supported for cases that fall outside the standard library, preserving flexibility without sacrificing the defaults.
Technical ownership
Beyond the framework itself, technical direction was provided for the broader platform it powers: defining the execution model, reviewing the architecture for new function types, and supporting the team in adopting consistent patterns across different workflow domains. The framework has been in production use across multiple active use cases since its initial release.