DEV Community

Ayomikun Adeosun
Ayomikun Adeosun

Posted on

Building BookCompass with Mastra: From AI Agent to Telex Integration

Introduction

AI agents are evolving from gimmicks into practical knowledge tools — and what used to require custom infrastructures, caching, state machines, and hand-wired API logic… can now be built in days, not weeks.

That’s exactly what happened with BookCompass — a Mastra powered Book Knowledge Assistant that uses Google Books to help readers:

  • discover books
  • retrieve authors & their titles
  • get recommendations and related titles
  • and interact conversationally

In this post, I’ll walk through how I built BookCompass using Mastra agents + tools, and then deployed it into Telex.im — a platform like Make/Zapier but optimized for AI agents & workflows.

The result?

A knowledge assistant that can sit inside a community, classroom, or reading club… and answer contextual book queries instantly.

What is Telex?

Telex.im is a new category of platform: AI co-workers.

Not chatbots.
Not LLM demos.
Not Slack integrations that only respond with boilerplate messages.

Telex lets you deploy agents that can:

  • respond in channels
  • call tools
  • fetch external data
  • chain workflows
  • talk to other agents (A2A)

And all of this is standardized with the A2A Protocol.

Because Mastra already speaks A2A out of the box — the connection was basically plug-and-play.

Project Overview

BookCompass combines:

Google Books Data + Mastra Tools + Telex Integration

The assistant currently supports:

Feature

Book Search: Search books by keywords or title

Author Books: Retrieve top N books from a specific author

Recommended Titles: Suggest similar titles based on a query

Mastra Features Used

1) Agents

Mastra’s Agent class handled the “brain” of BookCompass — instructions, tools, model config, and memory.

Model used: Google Gemini 2.5 Pro

2) Tools

I created multiple tools using createTool():

  • searchBooksTool
  • getAuthorBooksTool
  • getRecommendationsTool

All API calls hit Google Books — which conveniently requires no auth, no token.
Huge advantage for prototyping.

Mastra agent interaction

3) Workflows

While not required, I built a small one for recommendations (lookup book → then lookup similar authors).

4) Memory

Using LibSQL store — BookCompass can keep conversation context (so if a user says “show me more like that one”, it resolves the last book reference).

5) Observability + Logging

Mastra captures agent execution traces, tool calls, performance stats — which made debugging API responses easier.

6) Telex Integration

This part was shockingly easy.

POST /a2a/agent/bookCompass
GET  /a2a/agent/bookCompass/card
Enter fullscreen mode Exit fullscreen mode

Telex reads the agent card → understands:

  • tools
  • capabilities
  • instructions

And now BookCompass can live inside any Telex workspace.

agent on telex interaction

API Integration Surprises

Even though Google Books is open/no auth, there were still small quirks:

  • authors are stored as arrays
  • some results return only partial metadata
  • some books have no ISBN

So I wrote a simple normalization utility that always returns:


{
  title,
  authors,
  categories,
  description,
  previewLink
}
Enter fullscreen mode Exit fullscreen mode

Small detail, big impact.

Key Learnings

Takeaway

Type Safety helps: Zod schemas caught malformed Google Books responses

A2A is powerful: Telex didn’t require ANY custom integration special casing

Memory improves UX: “show me more from that author” now works naturally

Simplicity wins: Google Books is perfect for rapid prototype agents

Future Enhancements

  • caching + local embeddings for book similarity
  • store user preferences (“favorite author”, etc)
  • integrate Goodreads style rating metadata from alternate free sources

Conclusion

Mastra + Google Books + Telex = effortless production-grade agent building.

BookCompass only uses one API — yet the depth of capability feels like more than a demo.

This is the kind of agent you can plug into:

  • reading clubs
  • online book communities
  • education projects
  • book recommendation systems
  • and immediately deliver utility, not gimmicks.

Resources

Top comments (0)