Coaching with Code: Teaching baseball plays through AI
How a weekend project for my son’s team turned into a lesson in AI, learning, and leadership.
Like a lot of parents, I started coaching my son’s U9 hockey and baseball teams to help out. I figured I’d run some drills, make some lineups, and maybe relive a few moments from my own childhood.
I didn't expect it would lead to one of my favorite AI projects to date. It's a chat-based Baseball Tutor that teaches kids how to think about game situations using questions instead of lectures.
And in a way, the idea came from my own learning journey.
Just a couple months ago, I was a management consultant leading large-scale tech transformations. Now, I'm making AI tools. I'm not learning again because I went back to school. I'm learning by doing what Socrates did: discovering things by asking questions and getting help from a personal tutor named ChatGPT. In four weeks, I went from exploring to building, one question at a time.
The Big Idea: A Personal tutor for the Diamond
If you've ever coached kids, you know that good questions stick better than long explanations. “Where’s the force play?” “What should the catcher be ready for?” “Why do you cover second in this play?”
These are the moments where real learning happens.
I wondered if we could give every child a tutor, like a Socratic teacher, who could help them with these questions on their own time, at their own pace.
(A Socratic-style tutor doesn't just tell you the answer — it asks thoughtful questions to help you figure it out yourself.)
What if we could turn the baseball playbook into a conversation?
How it works (No tech jargon needed)
The Baseball Tutor works by combining a few simple but powerful ideas:
Knowledge Graph: A smart map of baseball situations — who's on base, how many outs, what each position is responsible for.
Reasoning Engine: Instead of giving answers, the AI asks questions based on your position, the play, and the game state.
Chat Interface: Kids (or adults!) can interact with it like they would a coach or a curious teammate.
Here’s what it sounds like:
Tutor: “You’re playing shortstop. There’s one out and a runner on second. Where should you be thinking of going if the ball is hit to you?”
Player: “To first?”
Tutor: “Interesting choice! Why first instead of holding the runner?”
Suddenly, baseball IQ becomes a conversation — not a lecture.
What’s under the hood
For the technically curious, here’s what’s powering the app:
🧠 OpenAI GPT-3.5 Turbo – for natural language reasoning
🗺️ NetworkX + custom knowledge graphs – to model positions, situations, and roles
📄 YAML + JSON – for capturing structured playbook data and guiding LLM prompts
💬 Streamlit – fast, friendly web app UI
⚙️ FastAPI – backend that makes the logic go
🐳 Docker – wraps it all up in a container
☁️ Azure App Service – cloud hosting
It was built as a fun weekend experiment — but with the same design principles I’ve used to deliver large-scale systems.
Try it yourself (screenshots below)
🎮 Launch the Baseball Tutor App: 👉 https://baseball-ai-app.azurewebsites.net
If you're short on time or the link isn’t working, the screenshots give you a sense of what it's like. It’s simple — on purpose — and a lot of fun to play with.
Scenario: Fly ball to centre field, 1 out, runner on 1st
Scenario: Ground ball to shortstop, 0 out, runners on 1st and 3rd
What this could become
The Baseball Tutor is fun — but it’s also a glimpse into something much bigger.
Imagine:
A Math Coach: A math coach that walks kids through a problem, asking questions like, “What happens if we try this approach?”
A New Manager Guide: A new manager guide that teaches leadership through real-life scenarios, like, “What would you do if a team member is struggling with a project?”
A Training Companion: A training companion that replaces dull e-learning with dynamic dialogue, such as, “How would you handle this customer complaint?”
This isn’t just about sport. It’s about how we learn — and how AI, when designed with care, can coach us in the moments that matter.
Lessons from the AI sandlot
This project was fun — but it also surfaced some important limitations that we need to be mindful of when building AI-powered tools:
Know your audience (literally)
Some of the tutor’s questions are way too complex for 8-year-olds. Prompt tuning is essential to make language, tone, and pacing age-appropriate — especially when your user is still learning the game and how to read.The AI makes confident mistakes
The model might sound like a seasoned shortstop, but it can still get things wrong — or make stuff up. That’s why AI should support, not replace, the real coach on the field.User experience matters
Streamlit made it easy to launch a prototype in a weekend — but if this were used widely, the interface would need a real upgrade to keep users engaged and on track.Context is everything
AI doesn’t “know” the full game state unless we explicitly give it that information. Forget to include the number of outs or where the runners are, and it might offer the wrong advice. Designing for context is critical.AI doesn’t know what it doesn’t know
Unlike a human coach, the model won’t always recognize when a question makes no sense or when a player misunderstood. Guardrails, feedback loops, and fallback logic are key for responsible deployment.
These kinds of insights show up fast when you start building — but scaling something like this for real-world use, especially in government or large organizations, takes a different kind of playbook.
From PoC to Something Bigger
This tool was built in ~48 hours. But taking something like this from PoC to production — especially in complex environments like government — is a whole different game.
From my experience, here are five things that matter most if you want to scale ideas like this:
Start with the user, not the tech: Understand real needs before choosing a model or framework.
Prototype fast — but with purpose: Simple, working demos build momentum and uncover hidden challenges early.
Design for transparency and trust: In high-stakes environments, people need to understand how and why the system works.
Plan for change management as early as you plan for code: AI is 10% technical, 90% human adoption.
Build your bridge to scale from Day 1: Think about data governance, integration paths, and sustainability from the start.
These aren’t hard-earned lessons — just the patterns I’ve seen work best when bridging the creative energy of AI with the delivery mindset needed to make it real.
Wrapping up (and looking ahead)
This all started as a playful way to help a baseball team. But it’s helped me reimagine what AI can do — not just for sport, but for schools, teams, organizations, and communities.
Let’s build something meaningful. Together.
I'm new to blogging, even with a very smart LLM partner. If you have feedback, questions, or ideas for what you want to see next, I'd love to hear from you. Connect with me in the comments below or reach out directly.
I hope these suggestions help! Your blog post is already great, and with a few tweaks, it can be even more engaging and inspiring.
🔗 Resources