DEV Community

Paul Yusuf
Paul Yusuf

Posted on

Building StudySync AI: How I Created a Conversational Study Partner with Mastra and Telex

đź’ˇ What is StudySync AI?

StudySync is a conversational AI study companion powered by Mastra and Google’s Gemini 2.0 Flash, living inside Telex.im — a platform that’s rethinking how AI agents and humans collaborate.

Unlike traditional study tools that feel transactional (“complete this task”), StudySync engages in natural, contextual conversation.
It remembers your last session, understands your learning style, and provides encouragement that actually feels human.

👥 Example Interaction
User: "Hey, I'm really struggling with React hooks today"

StudySync: "I remember you were working on useState yesterday! Hooks can be confusing at first.
Want to break down useEffect together? What specific part is tripping you up?"

The magic isn’t just in the response — it’s in the memory, the context, and the flow that makes it feel like you’re talking to someone who truly understands your learning journey.

⚙️ Why Mastra and Telex?

When I started this project, I explored multiple frameworks.
Mastra stood out for its production-ready agent orchestration and built-in memory.
Telex, on the other hand, offered something unique — a space where AI agents live and work with humans, not in isolation.

đź§  Mastra: The Agent Orchestration Powerhouse

Mastra isn’t just another wrapper around LLMs — it’s a full-stack framework for building capable, context-aware AI agents.

Memory That Actually Works
// Mastra's LibSQL integration provides persistent context
const agent = createAgent({
memory: 'libsql',
model: google('gemini-2.0-flash-exp'),
instructions: You are a supportive study partner...
});

The @mastra/libsql package provides persistent conversation memory right out of the box.
That means students never have to repeat themselves — StudySync remembers their goals, struggles, and progress.

A2A Protocol for Seamless Integration
// Mastra’s @mastra/core/a2a handles Telex JSON-RPC 2.0 messaging

The @mastra/core/a2a package simplified the JSON-RPC 2.0 communication required by Telex.
Instead of wrestling with protocol details, I could focus on making StudySync feel alive.

Workflow Management for Multi-Turn Conversations
// Multi-turn study planning flows
const studyPlanning = createWorkflow({
steps: [
'assess_current_progress',
'identify_learning_goals',
'create_study_schedule',
'suggest_learning_techniques'
]
});

Mastra’s workflow system allowed me to design natural, structured conversations that guide students through study planning without sounding robotic.

đź’¬ Telex: Where AI Meets Human Collaboration

Telex is often called “Slack for AI agents” — but that description doesn’t do it justice.
It’s a collaboration platform where AI agents and humans learn, plan, and grow together.

Integration Flow

Deploy Mastra agent to Scalingo

Register the endpoint via Telex A2A Protocol

Students can now @mention StudySync in any Telex channel

Result: StudySync doesn’t live in an isolated app.
It joins study groups, answers questions, and becomes part of the learning community.

đź§© Technical Architecture

Here’s how it all connects:

Student → Telex Platform → A2A Protocol → Mastra Agent → Gemini 2.0 Flash
↑ ↓
Human Collaboration AI Processing + Memory

The Full Stack
Component Purpose
Framework Mastra (agent orchestration)
LLM Google Gemini 2.0 Flash
Memory LibSQL (persistent context)
Platform Telex.im (collaboration)
Deployment Scalingo
Protocol A2A (real-time messaging)
đź§± Building the Study Companion

Here’s the core agent configuration:

{
"id": "studySync_agent",
"category": "knowledge",
"description": "Conversational AI study partner that motivates and supports learning",
"nodes": [{
"type": "a2a/mastra-a2a-node",
"url": "https://hng13stage3.osc-fr1.scalingo.io/a2a/agent/studySyncAgent"
}]
}

StudySync Excels At:

đź§­ Goal setting: Breaking complex subjects into manageable goals

📊 Progress tracking: Remembering what you’ve achieved

đź§  Technique suggestions: Recommending effective study methods

đź’¬ Motivation: Providing encouragement that feels genuine

🛰️ API in Action

Request:

{
"jsonrpc": "2.0",
"method": "message/send",
"params": {
"message": {
"role": "user",
"parts": [{
"kind": "text",
"text": "Can you help me plan my week for computer science finals?"
}]
}
}
}

Response:

{
"jsonrpc": "2.0",
"result": {
"message": {
"role": "agent",
"parts": [{
"kind": "text",
"text": "Let's create a study plan that actually works for you..."
}]
}
}
}

The beauty of A2A lies in its simplicity — clean JSON-RPC 2.0 that just works.

đź§­ Challenges and Learnings

Memory tuning was crucial
Balancing context with performance required experimenting with Mastra’s lastMessages parameter.

Precision in message schema
Telex’s A2A schema is robust, but strict — understanding the exact JSON structure was key.

Error handling matters
Students don’t care about exceptions — they just want help.
So I made sure StudySync stays responsive even when errors occur behind the scenes.

🌍 Why This Matters for Education

Most educational tools still treat learning as a solitary activity.

But StudySync, Mastra, and Telex embrace a new model — one where AI enhances human collaboration rather than replacing it.

When StudySync joins a Telex study group, it:

Remembers the group’s shared goals

Suggests effective techniques

Offers encouragement when motivation dips

Connects learners with relevant resources

This is what the future of educational AI looks like:
Not isolated chatbots, but intelligent, collaborative companions that grow with learners.

🚀 Try It Yourself

You can test StudySync’s API directly:

curl -X POST "https://hng13stage3.osc-fr1.scalingo.io/a2a/agent/studySyncAgent" \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"method": "message/send",
"params": {
"message": {
"role": "user",
"parts": [{
"kind": "text",
"text": "I have 3 hours to study today - help me make the most of it"
}]
}
}
}'

Or, experience it in its natural environment on Telex.im
—
where AI and human collaboration truly come together.

đź§­ Final Thoughts

Learning doesn’t have to be lonely.
With tools like Mastra, Telex, and Gemini 2.0 Flash — we can build empathetic, collaborative AI companions that make studying not just efficient, but deeply human.

đź’¬ Built by: Paul Yusuf

đź§  Powered by: Mastra + Gemini 2.0 Flash + Telex.im
🚀 Live Agent: StudySync AI

Top comments (0)