8 min readPrimed Team

Our App's AI: A Deep Dive into the "LLM-First" Strategy with Primed

At its core, Primed operates on a fascinating and powerful principle: an LLM-first strategy. Instead of using a Large Language Model as just a feature, the app puts it in the driver's seat — making its own decisions about how to best handle your training requests.

LLM Strategy Code Interface

At its core, our application, Primed, operates on a fascinating and powerful principle: an LLM-first strategy. Instead of using a Large Language Model (LLM) as just a feature, our app puts it in the driver's seat, allowing it to make its own decisions about how to best handle your training requests.

Here's a breakdown of how it works in simple terms, based on Primed's architecture.

Key takeaways

  • LLMs sit in the driver's seat, not just behind a feature.
  • A router prepares context; tools register what the app can do.
  • The LLM picks tools and chains them across multi-step problems.
  • More flexible and more natural than rule-based coaching.

The "Brain" of the Operation: The LLMFirstRouter

Think of the LLMFirstRouter as the central hub or the "brain" of our app's AI. When you ask a question like "how should I train for my upcoming marathon?" it doesn't go through a rigid set of hard-coded commands. Instead, it's sent directly to the LLMFirstRouter.

The router's main job is to prepare the context for the LLM. It gathers all the necessary information the LLM might need to make an informed decision, such as:

  • Your request: The training question you just asked.
  • Training History: What you've been doing in recent weeks.
  • Your fitness profile: Fitness level, goals, and preferences you've shared.
  • A "Toolbox": A list of all the things the app can actually do.

Once this context is assembled, the LLMFirstRouter hands it over to the LLM and essentially asks, "Based on all this information, what's the best course of action?".

Giving the LLM a "Toolbox"

This is where the magic really happens. Our app doesn't just ask the LLM to provide a text-based answer; it gives it a set of "tools" it can use to interact with the application and your training data. These tools are the app's core functionalities, such as:

  • Creating, updating, or adjusting training plans
  • Analyzing your workout history and trends
  • Fetching data from connected devices
  • Providing recovery recommendations

Each of these tools is registered in the ToolRegistry, which acts like a catalog of available actions. This way, the LLM knows exactly what its capabilities are.

Letting the LLM Think for Itself

With the context and the toolbox, the LLM can now make its own decisions. For a request like "I'm feeling tired, should I still do intervals today?" a traditional app might follow a fixed rule. But with an LLM-first approach, the LLM has choices. It might:

  • Analyze your recent training load and suggest a recovery day
  • Check your sleep and HRV data before recommending
  • Ask for clarification: "How tired exactly? Did you sleep well?"

The LLM makes this decision based on the context, and once it decides, it tells the LLMFirstRouter which tool it wants to use and with what parameters. The router then executes the tool and returns the result to you.

Handling Complex Requests: LLM Request Chaining

What if you have a multi-step request, like "look at my last month of training and create a recovery week"? This is where LLM Request Chaining comes in.

Instead of trying to do everything at once, the LLM can break the request down into a series of steps:

  1. First Step: The LLM decides to analyze your training data from the past month.
  2. Continue the Chain: After getting the results, the LLM realizes it's not done. It identifies patterns of fatigue.
  3. Finalize the Chain: Once analysis is complete, it creates a customized recovery week plan.

This allows the LLM to tackle complex coaching problems autonomously, and even ask for more information if it gets stuck.

An Analogy: The Smart Coach in Your Corner

Imagine you have a highly intelligent coach in your corner.

  • You: "I want to improve my cycling power."
  • A Traditional App (Basic Coach): Follows a fixed training plan regardless of your current fitness.
  • Primed's LLM-First Approach (Smart Coach):
    • The coach looks at your request ("improve cycling power").
    • It checks what it knows about you (your recent rides, FTP, fatigue levels).
    • It looks at its "toolbox" (training plans, recovery protocols, nutrition advice).
    • It thinks and decides on a plan: "First, I'll analyze your current power zones. Then, I'll design targeted intervals."
    • It uses the tools one by one, and if it's unsure, it asks: "How many hours per week can you dedicate to cycling?"

Why This is a Powerful Approach

By giving the LLM the autonomy to choose its own path, our app becomes:

  • More Flexible: It can handle a wider variety of training questions without being explicitly programmed for each one.
  • More Natural: You can interact with it like you would a human coach, using natural language.
  • More Powerful: It can combine tools in creative ways to solve complex training problems that a more rigid system couldn't handle.

Summary

LLM-first means the model is the decision-maker, not a chat layer over a rule engine. It receives prepared context, picks the right tool from a registry, and chains tools across multi-step requests. That's what lets Primed handle questions a fixed feature set never could.