Overview
H.A.R.V.E.Y. (Holistic Analysis and Regulation Virtual Expert for You) is an AI agent that orchestrates pricing analysis workflows using the ReAct (Reasoning + Acting) pattern. Rather than relying solely on LLM knowledge, Harvey grounds its responses in structured data and mathematical solvers.Harvey acts as an MCP client, launching the Pricing MCP server via stdio and calling its tools to execute pricing workflows. This architecture ensures Harvey can reason about pricing without requiring API keys in the MCP server itself.
The ReAct Pattern
ReAct is an agent architecture that interleaves reasoning and action:
This pattern reduces hallucinations by delegating mathematical operations and data queries to specialized systems (CSP solvers, analysis engines) while using the LLM for natural language understanding and synthesis.
How Harvey Works
Harvey’s workflow consists of two main phases:Phase 1: Planning
When a user asks a question, Harvey:- Extracts context from the question (URLs, uploaded YAML files)
- Fetches Pricing2Yaml content if needed (via
iPricingtool) - Grounds feature names by examining the actual YAML structure
- Constructs a plan with specific tool invocations and filters
Phase 2: Execution and Answer Generation
After planning, Harvey:- Validates the plan (checks for required YAML uploads, valid tool names)
- Executes actions sequentially through MCP tool calls
- Collects results from each tool invocation
- Synthesizes an answer by combining:
- Tool outputs (quantitative data)
- Pricing context (YAML content for descriptions)
- User’s original question
Available Tools
Harvey can invoke five MCP tools:iPricing
Retrieves the Pricing2Yaml document from a URL or returns uploaded content
summary
Provides high-level statistics (feature counts, plan counts, price ranges)
subscriptions
Enumerates all valid subscription configurations matching filters
optimal
Finds the best (cheapest/most expensive) configuration satisfying constraints
validate
Checks mathematical and logical consistency of a pricing model
Filter Construction
A key capability of Harvey is translating natural language requirements into structured filters.Filter Schema
Natural Language to Filters
Harvey translates user requirements:Grounding Example: Harvey reads Buffer’s YAML and finds:
- Feature name is
hashtagManager(not “hashtag management”) - Usage limit name is
socialChannelsLimit(not “channels” or “channelLimit”)
Filter Semantics
Lower bound on total subscription cost (plan + selected add-ons)
Upper bound on total subscription cost
Maximum number of items in the subscription (1 plan + N add-ons). Useful for limiting complexity.
List of feature names that must be present (value = true) in the resulting subscription. Names must match
feature.name from the YAML exactly.Map of usage limit names to minimum threshold values. The subscription’s effective limit must be >= the specified value. For boolean features modeled as limits, use
1 to require them.Multi-Context Reasoning
Harvey can reason about multiple pricing models simultaneously (e.g., comparing SaaS A vs. SaaS B).Per-Context Grounding
When handling multiple pricings:Context-Specific Filters
Filters for SaaS A use SaaS A’s exact feature/limit names. Filters for SaaS B use SaaS B’s names.
MCP Client Architecture
Harvey implements the Model Context Protocol client specification:Optimization: Reducing Hallucinations
Harvey’s design minimizes LLM hallucinations through:Grounding
All feature names, limits, and prices come from the actual YAML, not LLM knowledge
Delegation
Mathematical operations (finding optimal plans, counting configurations) are delegated to CSP solvers
Structured Outputs
Plans and tool responses use JSON schemas, not free-form text
Verification
Harvey validates plans before execution (checks tool names, filter schemas, solver options)
Example: Why Grounding Matters
Without Grounding (Hallucination Risk):Configuration
Harvey’s behavior is controlled by environment variables:API key for LLM access (planning and answer generation)
Model to use for reasoning (e.g.,
gpt-4o, gpt-5.2)Python module to launch for MCP server
Path to Python binary for MCP server subprocess
Additional PYTHONPATH entries for MCP server
Usage Example
Here’s how Harvey processes a real question:Planning Phase
Harvey:
- Detects URL
https://buffer.com/pricing(implicitly from context) - Plans
iPricingaction to fetch YAML - Reads YAML, finds
socialChannelsLimitusage limit - Plans
optimalaction with{"usageLimits": {"socialChannelsLimit": 10}}filter - Sets
objective: "minimize"
Execution Phase
Harvey:
- Calls
iPricing(pricing_url="https://buffer.com/pricing") - Calls
optimal(pricing_url=..., filters={...}, objective="minimize") - Receives result:
{"optimal": {"subscription": {"plan": "AGENCY", "addOns": []}, "cost": 120.0}}
Answer Generation
Harvey synthesizes:“The cheapest Buffer plan that includes 10 channels is the AGENCY plan at **100/month if paid annually). The AGENCY plan includes 10 channels by default, making it the most cost-effective option for your requirement. The ESSENTIALS and TEAM plans only include 1 channel each and would require 9 additional channel add-ons, making them more expensive.”
Next: CSP Analysis
Learn how constraint satisfaction solvers validate and optimize pricing configurations
Further Reading
MCP Protocol
Model Context Protocol specification
API Endpoints
Harvey’s HTTP interface
ReAct Paper
Original ReAct research
Source Code
Harvey implementation