Quite familiar with the Mastra API so just leafing through the Tanstack AI docs for a quick comparison ahead of actually using it:
- Mastra is clearly extending ai-sdk and is explicitly compatible with ai-sdk (including useChat), tanstack is replacing it, so bit more of a refactor if you're already on ai-sdk
- I like tanstack's implementation of server vs client side tool implementation, the
.server.clientnotation is interesting. It's a litttttle boilerplate-y to have a separate definition and implementation but I can see why they wanted to do it that way - Their useChat seems good
- Mastra supports conditional tool approval, Tanstack has tool approval as a boolean
- That being said, Tanstack's tool approval flow is way less complicated DX-wise, very nice
- Tanstack supports parallel tool calling, Mastra does not. This is very interesting, because now the LLM will need to decide if it wants multiple tools independently from each other or in sequence. I'd love to see how LLMs actually perform when doing this
- Good multimodal support in both, not exactly clear how to use it in useChat
- Default interface is SSE which is nice, I believe mastra default is HTTP, and both support HTTP
- Their default adapters support headers, which can be finicky doing manually for SSE (had to write some custom code for this in the ai-showcase repo)
- Tanstack supports a websocket adapter out of the box, very nice, I don't believe mastra does this
- Both offer provider-specific options, though I think Tanstack has type-safety here which is really nice
With it being new/alpha, it's of course missing a bunch of stuff mastra has:
- Auto-persisting conversations to a database
- Workflow + workflow streaming
- Networks (multi agents auto working together)
- RAG layer
- Memory layer, including auto-threading and semantic recall
- Guardrail layer
- MCP layer
- Local playground
- Voice layer
- Evals
Overall seems like Tanstack has a foundation for really nice DX! Of the things it's missing:
- The biggest one is a good memory/DB layer, though you can implement that yourself
- Workflows are super important, however mastra actually built them as primitives, unrelated to its own ecosystem, so you could actually use mastra's workflows with Tanstack agents inside it haha
- That being said Mastra's workflows have streaming built in, and I think that would be quite a loss and difficult to build yourself
- Same with evals, I believe you can use mastra's evals with anything
It's also notable that mastra extends AI SDK, so you almost get two teams in one, where Tanstack is building their own top to bottom, though that also has its own advantages of course.