AI Barista Perfection: How Machine Learning Dialed In Our Espresso
Share this article
When software meets specialty coffee, the results can be surprisingly sophisticated. In an experimental holiday project, developers transformed an open-source espresso machine into an AI-controlled barista capable of dialing in perfect shots through machine learning iteration—demonstrating how large language models (LLMs) can optimize physical processes when given precise instrumentation.
The Hardware Foundation: Instrumented Espresso
The experiment centered on a modified Ascaso Dream espresso machine running Gaggimate firmware, an open-source project that enables granular control and data collection. As CEO Matvey Kukuy explains: "Gaggimate collects high-quality data on every single cup—temperature, pressure, and liquid flow through the coffee puck. Crucially, it also allows programmatic adjustment of these parameters."
Ascaso Dream with Gaggimate firmware providing instrumentation and control
The machine captures detailed time-series data during extraction, including phase-specific metrics like:
{
"pressure": {
"min_bar": 0.1,
"max_bar": 8,
"average_bar": 4.95
},
"flow": {
"peak_flow_ml_s": 2.18,
"time_to_first_drip_seconds": 7
}
}
Building the AI Barista
The team developed a custom MCP server to bridge the hardware with AI systems, exposing critical endpoints:
- list_shot_history for extraction analysis
- update_ai_profile for parameter adjustments
- get_shot for detailed diagnostics
Rather than overwhelming the LLM with raw time-series data, engineers distilled key metrics:
"We extract three data points per phase—enough for meaningful analysis without context overload. Temperature deltas, pressure curves, and flow characteristics become actionable signals," notes Kukuy.
Training with Coffee Expertise
The "AI-James" agent (named after World Barista Champion James Hoffmann) ran on Gemini 2.5 Pro via the Archestra orchestration platform. Its system prompt codified specialty coffee knowledge:
Barista expertise encoded into AI prompt structure
Key principles included:
- Taste-first philosophy (metrics guide but don't dictate)
- Single-variable adjustment (avoid combinatorial chaos)
- Roast-specific protocols (light vs. dark bean handling)
- Quantified troubleshooting (e.g., "sour = underextracted → increase yield/temp")
Dialing In Through Iteration
In live tests, the system demonstrated nuanced decision-making:
1. Shot 1 (Light Roast): Default parameters yielded sour espresso
2. Shot 2: AI increased yield from 32g to 36g—not adjusting grind size as humans might
3. Result: Balanced flavor achieved in ≤3 attempts across bean types
Instrumentation data from a successfully dialed-in shot
Implications Beyond Coffee
This project illustrates several emerging patterns:
1. LLMs as control systems can optimize physical processes when given sensor data and adjustment authority
2. Open firmware enables experimentation with industrial equipment
3. Domain expertise encoding turns subjective craftsmanship into repeatable protocols
As Kukuy cautions: "This involved running raw software on modified high-voltage appliances—safety remains paramount." Yet the approach suggests possibilities for AI-assisted tuning in fields from chemistry to manufacturing, where parameter optimization resembles espresso's multivariate challenge.
Hardware and software references:
Gaggimate Firmware |
Gaggimate MCP Server |
Archestra Orchestrator
Source: Adapted from original experiment by Matvey Kukuy at Archestra AI