The Challenge
For my HNGi13 Stage 3 backend task, I needed to create an Agent-to-Agent (A2A) integration with Telex.IM using JavaScript/TypeScript. I had to use Mastra AI which was both exciting and a bit challenging since I was new to building AI agents.
I built a book suggestion agent that suggested 5 books to a user depending on the topic they submit.
Getting Started
Learning the Ropes with Mastra AI
I began by setting up a Mastra project, which came with a weather agent example. This was super helpful because it showed me how everything fits together. The example covered:
- How to set up an agent
- Adding tools and workflows
- Handling API requests
Building My Book Suggestion Agent
Using the weather agent as a guide, I built my book suggestion agent. Here's how it went:
- Setting Up: I organized the code and set up TypeScript to catch my mistakes early.
- The Book Tool: Created a tool that fetches book recommendations from Open Library.
- Conversation Flow: Made sure the agent could handle different types of requests.
- Error Handling: Added friendly messages for when things don't go as planned.
The Tricky Part: Telex.IM Integration
This is where things got challenging. I struggled with:
- Connecting my A2A agent to telex from my hosted mastra site
- Getting the message format just right - had some issues with the string but I figured it out
- making requests was initially slow and also giving results I did not want but with a couple of code fixes and more deploys I managed to make it work.
The HNG team provided a helpful blog post that explained how to connect Mastra with Telex.IM which made things much more easier.
What I Learned
The best part? It worked! Now I can:
- Get book recommendations through Telex.IM
- See how people interact with my agent
- Fix issues when they come up
You can check out the interaction logs here to see it in action.
My Big Takeaways
- Examples are gold: The weather agent was my best teacher.
- Ask for help: Other interns saved me hours of frustration.
- Keep trying: The solution often comes right after you want to give up.
- Use what you're given: The HNG team's resources were a lifesaver.
This project was a huge learning experience. I went from knowing nothing about AI agents to building something that actually works. These skills will be super useful in any agent I work on next!
Top comments (0)