Reference project · In-house product
Agentic AI Engineering: an AI assistant built and tested with AI
hentschel.ai is an AI investment assistant that combines portfolio, market data and investment profile into traceable analyses. It was created in an agentic development process: AI coding agents deliver, multi-level test automation and LLM evals safeguard quality, and guardrails with human-in-the-loop approvals provide governance. The methods transfer to enterprise programmes – from pilot to production.
Client
Hentschel Consulting GmbH – in-house product hentschel.ai
Project Type
Building an AI product from idea to operations – with an agentic development process (AI-native SDLC), multi-level test automation and automated LLM evals (chat grading)
Project Duration
05/2026 – ongoing
Industry
Financial services / FinTech – methods transferable across industries
Project Language
German & English
Countries
Global
Role
Product ownership, solution architecture, AI quality assurance (LLM evals) and delivery with AI coding agents
Scope & Complexity
Full product lifecycle under sole responsibility: from the initial idea through architecture and development to a fully built application with subscription and payment handling. The platform maintains the user's portfolio including transactions, cash accounts and watchlist, enriches it with live quotes, fundamental, technical and news data, and puts an AI assistant alongside it that operates 55 specialised tools – from chart and balance sheet analysis through ETF look-through and bond metrics to sector, region, currency and theme breakdowns of the portfolio.
The analysis base is not produced in the dialogue but ahead of it: 26 scheduled jobs score a universe of around 2,000 securities from STOXX Europe 600, S&P 500, Nikkei 225 and MSCI Emerging Markets, update exchange rates, classify investment themes, log market catalysts and update result snapshots. The assistant reads these results – it does not invent them; every figure in an answer comes from a tool call. On top of that comes the full breadth of a product: registration with password and passkeys, subscriptions and credit packs in three currencies, monthly usage metering, notifications, email journeys, privacy policy, imprint and terms of service, and a bilingual interface with around 5,900 strings per language.
The real complexity lies in the discipline: a language model works probabilistically, yet here it has to be faithful to the facts and reproducible – same question, same figures. Its training knowledge ages while quotes change by the hour. Both can only be solved if the model contributes no facts of its own and reads exclusively from tool calls and the upstream scoring. The sections below show how this is ensured in development, testing and operations.
Concept & Methodology
Product before technology. The starting point was a concrete gap: general AI assistants advise eloquently but know neither the user's portfolio nor reliable market data; robo-advisors calculate cleanly but explain nothing.
Measure before you build (Evidence-based Engineering). Every analytical hypothesis is first tested against historical data in a separate research harness. What does not hold up does not enter the product – this has repeatedly prevented features that seemed intuitively convincing.
Traceability as an architectural principle. Scoring runs deterministically and is archived point in time – same input state, same result. The AI layer interprets and explains; it does not score.
Data protection with a deliberate choice of location (Privacy by Design). AI calls are pinned in code to a cloud provider's EU region, without retention of requests and without model training. The only disclosed exception is web research, which can be switched off.
Development with AI agents (Agentic Software Delivery). AI coding agents deliver; automated checks, a versioned knowledge base and clear approvals keep speed and quality aligned.
Quality assurance by automation rather than opinion (Evaluation-driven Development). Multi-level test automation and automated LLM evals: prompt, tool and model changes are measured against the scenario catalogue.
Operations and cost control (LLMOps and FinOps). Usage is metered and capped per user and month; model costs are checked against the actual account balance on every run.
What this project demonstrates
"AI coding agents change the economics of enterprise projects: drastically smaller teams with fewer specialists deliver complex initiatives faster. At the same time, AI models extend these projects with new functionality for handling unstructured data: they understand and generate content in virtually any digital format. The bottleneck shifts from capacity to control – only automated checks and clear approvals take AI safely from pilot to production."
Rainer Hentschel
Transformation Lead for the Autonomous Enterprise · SAP® Solutions & Agentic AI
Seven patterns for enterprise AI
Pattern A: A scalable development process with AI coding agents
Agentic Software Delivery
- Agentic AI
- AI-native SDLC
- Human-in-the-Loop
- Least Privilege
- Model Context Protocol (MCP)
- Knowledge Management
Challenge: AI coding agents deliver code faster than teams can review it the traditional way. It only scales with clear roles, automated checks and a project memory that does not get lost in chat histories.
-
Roles (Human-in-the-Loop).
- The product owner formulates requirements and findings.
- AI coding agents deliver, in the development environment and as cloud agents that create pull requests on their own.
- More than 150 pull requests have been merged, almost all of them created by cloud agents.
-
Automated checks instead of trust. Every pull request automatically goes through:
- formatting, type checking and around 2,300 unit tests (approx. 2 minutes),
- the logged-in end-to-end suite against a disposable database and a deterministic test model (approx. 12 minutes),
- a preview build.
-
Project memory as code (Knowledge Management for agents).
- Conventions, measurement results and root causes live in the repository as a versioned knowledge base: 38 files, around 29,000 lines.
- Every agent starts with the same knowledge; every change to it is a reviewable diff.
- Knowledge only enters the repository through reviewed commits.
-
Minimal permissions (Least Privilege).
- Agents have no write access to production data and only the credentials their task requires.
- Content from tickets, pull requests and error messages is treated as untrusted (prompt injection).
More details
-
Safe test environments.
- Preview environments work only with anonymised data. If the anonymisation fails, the build fails.
- Database migrations run first in agent and preview environments without a connection to production – only then is the production database changed.
-
Agent environment as code. A versioned setup provides the coding agents with tools, a disposable database and a browser; error monitoring is connected read-only via the Model Context Protocol (MCP).
-
Cadence. More than 1,700 commits, peaking at 26 merged pull requests in a single day.
Consulting value
- Operating model for AI-assisted software development: role model, definition of done for agent pull requests, required checks, knowledge base.
- Security assessment of agentic pipelines: permissions, credentials, injection paths.
- Scaling from the pilot team to programme level.
Pattern B: Test automation for probabilistic systems
AI Quality Engineering
- Test Automation
- Shift-Left Testing
- Compliance as Code
- Mock-LLM
- Regression Testing
- CI/CD
Challenge: Classic tests expect exact outputs; a language model answers the same question slightly differently every time. Quality therefore comes from several levels: deterministic where possible, statistical where necessary.
-
Policy as tests (Compliance as Code, Shift-Left). Tests check the entire codebase against fixed rules – violations surface before the merge, not in operation:
- Every AI call is pinned to the EU region, zero data retention and exclusion from model training; the only disclosed exception is web research, which can be switched off.
- Every scheduled job is monitored.
- Both language versions are complete.
- No tool description contradicts a defined process chain.
-
Unit tests. Around 2,300 test cases in 218 test files, mainly for the calculating tools.
-
End-to-end in the browser. 21 Playwright test files. The logged-in suite runs in CI against a disposable database, Redis and a deterministic mock model: reproducible and without model costs.
-
Visual checks. Automated screenshots of all screens in both languages, light and dark.
More details
-
Regression with the real model. Around 120 graded dialogue scenarios with personas and frozen market data, so that runs remain comparable over weeks.
-
Experiments. Paired A/B runs with control of run-to-run variance.
Consulting value
- Test strategy for AI applications (AI Quality Engineering): which level checks what, where deterministic and where statistical.
- Reproducible test environments for LLM systems: mock models, frozen data, disposable infrastructure.
- Corporate policies (data residency, data protection, monitoring) as automated tests.
Pattern C: Chat grading: making dialogue quality measurable
LLM Evals
- LLM-as-a-Judge
- Golden Set
- Grounding Checks
- Sycophancy Tests
- Judge Calibration
- Rubric-based Scoring
Challenge: No single assert decides whether an AI answer is good. Without reliable grading, every prompt, tool or model change remains a matter of opinion.
-
Scenario catalogue (Golden Set).
- Around 120 scenarios, as single questions and multi-turn dialogues, each with profile, portfolio and frozen market data.
- Each scenario carries up to 26 checkable expectations. Each one is graded individually: met, partially met or missed.
-
LLM-as-a-judge with a fixed rubric.
- Six dimensions: profile fit, factual accuracy, consistency, process clarity, risk transparency, advisory experience.
- 16 predefined finding categories in four groups: verifiability, content, process, form.
- The categories are enforced by schema so that findings remain comparable across all runs.
-
Deterministic checks alongside the judge (Grounding Checks).
- 34 finding categories, including: invented links, internal identifiers in the answer, a call to trade, candidates silently passed over.
- Figures are reconciled with the tool results.
- Every answer is checked against the intended tool chain: missing step, wrong order.
- Before going live, new rules are measured for false alarms against the stock of stored answers.
-
Pushback tests (sycophancy). The simulated user contradicts or pushes. The test checks whether the system sticks to the facts instead of obligingly giving in.
More details
-
Clear pass rule. Overall grade of at least 4 out of 5, no experience dimension below 3, no severe finding – neither from the judge nor from a deterministic check.
-
The judge is tested too (judge calibration).
- Repeated grading of the same answers, a second judge model, blinded samples.
- Comparison with the variance between two identical runs. Only what lies above this noise floor counts as a change.
Consulting value
- Eval framework for chatbots and AI agents: golden set from business requirements, rubric, deterministic checks, pass rule.
- Calibration of LLM-as-a-judge so that gradings are reliable and auditable.
- Chat grading as a quality gate in the release process.
Pattern D: Prompt & context engineering: a probabilistic model operates deterministic tools
Tool Calling & Context Engineering
- Tool Calling
- Context Engineering
- Guardrails
- Human-in-the-Loop
- Prompt Caching
- Single Source of Truth
Challenge: Language models phrase things convincingly but calculate unreliably and know no current data. In an enterprise, figures must be right, processes must follow an order and write access must be controlled.
-
Division of labour as an architectural principle (Tool Calling).
- The model understands the question, chooses tools and explains the results.
- Calculating, checking, filtering and booking are done by 55 tools. Every figure in an answer comes from a tool call.
-
Tool descriptions are interface contracts (Single Source of Truth).
- When in doubt, the model follows the tool's description, not the system prompt.
- That is why the process chains are stored once, centrally, as data – and a test prevents any tool description from deviating from them.
-
Receipts instead of hope. Tools report back what was checked, what was skipped and which step is still open. This deterministically steers the model back into the process.
-
Self-correction in three stages.
- Invalid inputs are rejected.
- Deviations come back as a warning.
- Where an objective target-versus-actual check is possible, a silent trial run calculates before execution.
More details
-
Approval in code (Human-in-the-Loop).
- Writing tools only run after the user's click.
- The booking must match the preview shown exactly: checked server-side, single use, valid for at most 30 minutes.
- New portfolio actions require approval by default (blocklist instead of allowlist).
-
Protection at the output (Output Guardrails). Internal identifiers are filtered out deterministically. Empty answers are detected, caught and not charged.
-
Context engineering with cache economics (Prompt Caching).
- More than 30 prompt building blocks in four segments.
- The immutable core (around 80,000 tokens) is cached for one hour and shared by all users, workflow blocks for five minutes. The user context comes last.
- Measured: a cold cache build costs around ten times as much as a cache hit.
- Live data is never in the prompt.
-
Rules with provenance. Domain rules in the prompt carry their evidence status. Prompt versions are logged so that results remain comparable.
Consulting value
- Architecture review for AI agents: boundary between model and tool, tool contracts, guardrails, approval points.
- Context engineering and cost optimisation through segmentation and prompt caching.
- Human-in-the-loop design for writing AI actions.
Pattern E: Interpreting structured and unstructured data
Grounding & Structured Outputs
- Grounding
- Structured Outputs
- Agentic Retrieval
- Data Provenance
- Hallucination Rate
- Prompt Injection Defence
Challenge: Enterprise knowledge sits in tables and key figures as much as in reports, news and free text. A language model is meant to use both – without inventing values and without treating third-party text as instructions.
-
Grounding via tools (Agentic Retrieval). The model fetches data via tools when needed instead of answering from its training knowledge; every figure can be traced back to a tool call.
-
Structured data.
- An adapter layer normalises market data, such as currency units, and makes the provider replaceable by configuration (less vendor lock-in).
- A nightly scoring run over a universe of around 2,000 securities archives key figures point in time.
- Key figures are converted to a common currency basis before comparison.
- Positions that cannot be scored are disclosed instead of being silently calculated with assumptions.
-
Unstructured becomes structured (Structured Outputs).
- Language models read news articles, annual reports and web sources and write into fixed schemas.
- Examples: the theme assignment of every security with a conviction level, market catalysts with confidence and source (Data Provenance).
-
Closed vocabulary, measured hallucination.
- The model chooses from predefined categories. If it names one that does not exist, it is discarded and counted.
- The reason: a silently rising hallucination rate is the error that looks healthiest from the outside.
More details
-
Rules where rules suffice.
- Sentiment analysis takes word boundaries, negations and language into account.
- News is classified on the article text, not on the headline.
-
Stability measured. Repeat runs show how much AI assessments fluctuate between identical runs. This noise floor is the benchmark for every supposed improvement.
-
Third-party text is data, never an instruction.
- Every sub-agent that reads third-party text follows this rule.
- Web research is additionally isolated architecturally: it only receives a sanitised market question, never user or portfolio data.
Consulting value
- Intelligent document processing: extraction from documents and free text – schema first, with validation, provenance and confidence.
- Stability and hallucination rate as operational metrics.
- Defence against prompt injection through the architecture, not just through prompt rules.
Pattern F: Responsible AI: governance, data protection and security by design
Responsible AI & Guardrails
- Privacy by Design
- Policy as Code
- Data Residency
- Zero Data Retention
- AI Security
- Supply Chain Security
Challenge: Policies that exist only in the prompt or in the manual are intentions. They become reliable when code enforces them and tests verify compliance with them.
-
Data residency as a test.
- Every AI call is pinned in code to the EU region, zero data retention and exclusion from model training. A test fails if a new call bypasses this.
- The only disclosed exception is web research, which can be switched off. It transmits only a sanitised market question without personal or portfolio data.
- This request goes directly to the model provider in the USA, likewise without retention.
-
Data protection in the data model.
- Account, card and tax numbers are masked before they are stored.
- Uploaded images are removed after analysis.
- Particularly sensitive information is never taken into memory.
- Users can choose deletion periods for their chats.
-
Protection against prompt injection.
- Via the chat: approvals, permissions and output filters are enforced in code – no prompt can override them.
- Via tools: external content such as news articles or web sources is data and never counts as an instruction.
-
Permissions checked server-side. Identifiers supplied by the model are checked against the owner. Even read paths that are not billed are rate-limited.
More details
-
Supply chain (Supply Chain Security). Dependencies are updated automatically. New package versions are only adopted after a minimum waiting period. Install scripts only run after explicit approval.
Consulting value
- AI governance framework (Responsible AI): data residency, data protection, approvals, logging – implemented as policy as code.
- AI security review along the OWASP Top 10 for LLM Applications: prompt injection, data leakage, permissions, supply chain.
Pattern G: Evidence-based decisions and cost control
Evidence-based AI & LLM-FinOps
- Model Benchmarking
- A/B Testing
- Unit Economics
- LLM-FinOps
- Observability
Challenge: With model changes, new prompts and new features, the loudest argument wins if nothing is measured. And without cost transparency, an AI system scales in the wrong direction.
-
Model choice by experiment (Model Benchmarking).
- A larger language model competed against the one in use.
- Set-up: 38 scenarios with 81 dialogue turns, two runs per variant, two different judge models.
- Quality result: in three of four comparisons, the difference lay within the variance of two identical runs, in one just above it, and it was not significant anywhere.
- Cost and time result: around 2.2 times the cost per dialogue turn, median response time around 30 seconds longer.
- Decision: no switch.
-
Statistics instead of gut feeling. Paired comparisons with exact p-values, correction for multiple testing (Benjamini-Hochberg), pre-registered comparison pairs.
-
Research before features.
- More than 200 evaluation and research scripts, including 23 studies on the predictive power of individual signals.
- Hypotheses that do not hold up do not enter the product.
-
Costs under control (Unit Economics).
- Usage is metered and capped per user and month.
- Background work such as memory and research is reported in separate budgets.
- Prompt caching and reading from the database instead of live calls reduce the cost per dialogue turn.
Consulting value
- Model selection and benchmarking based on own measurements rather than vendor claims.
- Experiment design for AI features: control group, noise floor, multiple-testing correction.
- LLM-FinOps: cost model (unit economics, TCO), budgets, caching strategy.
From programme discipline to AI discipline
The same disciplines that carry an SAP transformation also decide whether an AI initiative makes it from pilot to production (Pilot-to-Production). The project translates them into an operating model for AI systems:
| Discipline in enterprise programmes | Equivalent in AI systems | Implementation in the project |
|---|---|---|
| Acceptance criteria | Equivalent in AI systems Grading rubric and pass rule | Implementation in the project 6 dimensions, 16 finding categories, minimum grade 4 out of 5 |
| Regression testing before release | Equivalent in AI systems Scenario catalogue with the real model | Implementation in the project around 120 scenarios with frozen market data |
| Change and release management | Equivalent in AI systems Pull request with automated checks | Implementation in the project more than 150 pull requests; automated checks on every new pull request |
| Roles and approvals | Equivalent in AI systems Human in the loop for write access | Implementation in the project Approval click and preview match |
| Cutover and go-live control | Equivalent in AI systems Staged, safe migration | Implementation in the project Migrations first in agent and preview environments, only then in production |
| Knowledge management | Equivalent in AI systems Versioned knowledge base for agents | Implementation in the project 38 knowledge files in the repository |
| Compliance and internal controls | Equivalent in AI systems Policies as automated tests | Implementation in the project EU binding, job monitoring, language catalogue |
| Business case | Equivalent in AI systems Cost per transaction, decision by A/B measurement | Implementation in the project Model switch rejected: 2.2 times the cost without measurable added value |
| Hypercare and operations | Equivalent in AI systems Monitoring and feedback | Implementation in the project every job monitored, real-world failures become test cases |
The project in numbers
Continuously expanding
- merged pull requests, 146 of them by AI coding agents
- 155
- commits
- 1,758
- automated test cases
- > 2,300
- graded dialogue scenarios
- 121
- categories of deterministic checks
- 34
- tools
- 55
- securities in the scoring universe
- ~2,000
- scheduled jobs, all monitored
- 26
- lines of TypeScript, including around 120k for the evaluation and research framework
- ~360k
- knowledge files for AI agents
- 38
- database tables
- 64
- page and API routes
- 96
- language versions with around 5,900 strings each
- 2
- billing currencies
- 3
Architecture in five layers
The analysis base is produced ahead of time and deterministically. The AI layer interprets – it does not score.
Interface
Portfolio, watchlist and dialogue in a single view. Multilingual, light and dark, usable on mobile.
- Next.js
- React
- Tailwind CSS
Assistant layer
Domain guardrails, conversation flow with confirmation points and 55 tools the assistant is allowed to call.
- Tool Calling
- Human-in-the-Loop
- Receipts
Scoring engine
A nightly multi-factor ranking scores the entire universe, archived point in time and therefore reproducible.
- deterministic
- Point-in-time archive
Data & jobs
Portfolio, transactions, profile and usage in a relational database; 26 scheduled jobs keep quotes, themes and metrics current.
- PostgreSQL
- Cron
- Cache & locks
- Adapter layer for market data
Operations & governance
Password and passkey sign-in, billing in three currencies, usage metering, error diagnostics, rate limiting, monitoring of every job.
- EU region (exception: web research)
- no retention of AI requests
How an analysis runs
No proposal without a profile match, no portfolio change without approval – that is the difference from a general AI chatbot.
- Investment profileObjective, horizon, risk appetite and risk capacity, permitted vehicles, home market, currency
- Current positionPortfolio, concentration risks, sector, region and currency distribution
- Target allocationCheckpoint 1 – the strategy is submitted for approval
- Selection & reviewScreening, ranking, technical and fundamental review per security
- Security proposalCheckpoint 2 – selection with rationale and counterarguments
- ExecutionOnly after the approval click is anything written to the portfolio – exactly as shown in the preview, no broker, no order
Areas of responsibility
One product, one accountability – from product definition to operations.
Product & positioning
Target groups, value proposition, feature scope, pricing model and differentiation from general AI assistants and robo-advisors.
Solution architecture
The boundary between deterministic scoring and AI interpretation, data model, interfaces, caching and load behaviour.
Delivery
Application, scoring engine, scheduled processing, billing, notifications and interface in two languages – delivered with AI coding agents.
Agentic Software Delivery
Development process with AI coding agents: roles, automated checks, versioned knowledge base, permission concept for agents.
Legal
Terms of service, privacy policy and imprint.
Quality assurance
Multi-level test automation, LLM evals with a calibrated LLM-as-a-judge and deterministic checks, real-world failures mirrored back as test cases.
Operations & cost
Monitoring, error diagnostics, rate limiting, per-user usage metering and reconciliation of model costs against the account balance.
Technology
A deliberately narrow, well-proven stack – every component replaceable, no exotic dependencies.
- Application
- Next.js (App Router), React, TypeScript
- Interface
- Tailwind CSS, component library, light/dark, multilingual
- AI
- Anthropic models via AWS Bedrock in the EU region (exception: web research), brokered through a gateway; structured outputs for all extractions, prompt caching
- Data
- PostgreSQL with a type-safe ORM and versioned migrations; own adapter layer for market data, provider replaceable
- Development
- AI coding agents (GitHub Copilot) in the development environment and the cloud, error monitoring connected via MCP; pull request workflow with automated checks
- Sign-in
- Password and passkeys (WebAuthn)
- Billing
- Stripe – subscriptions and credit packs in CHF, EUR, USD
- Operations
- Vercel, Redis for limits and locks, email delivery; observability: error diagnostics on an EU instance, monitoring of every scheduled job
- Quality
- Unit tests, Playwright end-to-end tests with mock LLM, LLM evals (LLM-as-a-judge and deterministic checks), paired A/B experiments
Approvals and data protection
Clear rules on when the portfolio is written to and how data is handled.
- Approval before every write access – changes to the portfolio only after the user's click, exactly as shown in the preview.
- Data processing in the EU – AI calls are pinned in code to an EU cloud region, without retention and without model training. The only disclosed exception is web research, which can be switched off: it transmits only a sanitised market question without personal or portfolio data and goes directly to the model provider in the USA, likewise without retention. Error diagnostics on an EU instance, cookieless analytics without profiling. The privacy policy names every service used individually.
Inside the application
Portfolio management with the AI assistant, risk analysis and stress tests in the portfolio monitor, and two control views from the admin area.
From AI Pilot to Production
I apply the methods proven in practice in my hentschel.ai case study to enterprise AI initiatives – from AI-native software development and evaluation to architecture, governance and pilot-to-production – as transformation lead, project manager or technical sparring partner.
-
Agentic Delivery & AI-native SDLC
Introducing AI coding agents into your development – as an operating model, not a tool rollout
Deliverables
- AI readiness check
- Role and approval model
- Required checks
- Knowledge base
- Permission concept
-
LLM Evals & Chat Grading
Eval framework for your chatbots and AI agents
Deliverables
- Golden set from business scenarios
- Rubric
- Deterministic checks
- Quality gate in the release
-
Agent & Context Architecture
Cleanly separating tool calling, guardrails and human-in-the-loop
Deliverables
- Architecture review
- Tool contracts
- Approval points
- Caching concept
-
Intelligent Document Processing
Turning reports and free text into verifiable structures
Deliverables
- Schema design (Structured Outputs)
- Validation
- Provenance
- Stability and hallucination measurement
-
Responsible AI & AI Security
Enforcing policies instead of describing them
Deliverables
- Governance framework
- Policy-as-code tests
- Security review based on the OWASP Top 10 for LLM Applications
-
AI Program Management
From proof of concept to production (Pilot-to-Production)
Deliverables
- Roadmap
- Business case with unit economics
- Experiment design
- Project management
Rainer Hentschel
Transformation Lead for the Autonomous Enterprise · SAP® Solutions & Agentic AI
For 17 years, I have been leading complex international technology and transformation initiatives to success. I bridge business and IT, structure critical programs and bring them safely into operation.
On the road to the Autonomous Enterprise, Agentic AI brings the next paradigm shift: Software as a Service is increasingly becoming Service as a Software. AI agents take on tasks in development, project work and business processes. Teams are changing, and innovation and development cycles are getting shorter.
For this transformation, I combine 17 years of delivery experience from international enterprise transformations with hands-on Agentic AI engineering skills – from strategy and architecture all the way to production.