TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Show HN: Mastra – Open-source JS agent framework, by the developers of Gatsby

442 点作者 calcsam3 个月前
Hi HN, we’re Sam, Shane, and Abhi, and we’re building Mastra (<a href="https:&#x2F;&#x2F;mastra.ai">https:&#x2F;&#x2F;mastra.ai</a>), an open-source JavaScript SDK for building agents on top of Vercel’s AI SDK.<p>You can start a Mastra project with `npm create mastra` and create workflow graphs that can suspend&#x2F;resume, build a RAG pipeline and write evals, give agents memory, create multi-agent workflows, and view it all in a local playground.<p>Previously, we built Gatsby, the open-source React web framework. Later, we worked on an AI-powered CRM but it felt like we were having to roll all the AI bits (agentic workflows, evals, RAG) ourselves. We also noticed our friends building AI applications suffering from long iteration cycles: they were getting stuck debugging prompts, figuring out why their agents called (or didn’t call) tools, and writing lots of custom memory retrieval logic.<p>At some point we just looked at each other and were like, why aren&#x27;t we trying to make this part easier, and decided to work on Mastra.<p>Demo video: <a href="https:&#x2F;&#x2F;www.youtube.com&#x2F;watch?v=8o_Ejbcw5s8" rel="nofollow">https:&#x2F;&#x2F;www.youtube.com&#x2F;watch?v=8o_Ejbcw5s8</a><p>One thing we heard from folks is that seeing input&#x2F;output of every step, of every run of every workflow, is very useful. So we took XState and built a workflow graph primitive on top with OTel tracing. We wrote the APIs to make control flow explicit: `.step()` for branching, `.then()` for chaining, and `.after()` for merging. We also added .`.suspend()&#x2F;.resume()` for human-in-the-loop.<p>We abstracted the main RAG verbs like `.chunk()`, `embed()`, `.upsert(),’ `.query()`, and `rerank()` across document types and vector DBs. We shipped an eval runner with evals like completeness and relevance, plus the ability to write your own.<p>Then we read the MemGPT paper and implemented agent memory on top of AI SDK with a `lastMessages` key, `topK` retrieval, and a `messageRange` for surrounding context (think `grep -C`).<p>But we still weren’t sure whether our agents were behaving as expected, so we built a local dev playground that lets you curl agents&#x2F;workflows, chat with agents, view evals and traces across runs, and iterate on prompts with an assistant. The playground uses a local storage layer powered by libsql (thanks Turso team!) and runs on localhost with `npm run dev` (no Docker).<p>Mastra agents originally ran inside a Next.js app. But we noticed that AI teams’ development was increasingly decoupled from the rest of their organization, so we built Mastra so that you can also run it as a standalone endpoint or service.<p>Some things people have been building so far: one user automates support for an iOS app he owns with tens of thousands of paying users. Another bundled Mastra inside an Electron app that ingests aerospace PDFs and outputs CAD diagrams. Another is building WhatsApp bots that let you chat with objects like your house.<p>We did (for now) adopt an Elastic v2 license. The agent space is pretty new, and we wanted to let users do whatever they want with Mastra but prevent, eg, AWS from grabbing it.<p>If you want to get started: - On npm: npm create mastra@latest - Github repo: <a href="https:&#x2F;&#x2F;github.com&#x2F;mastra-ai&#x2F;mastra">https:&#x2F;&#x2F;github.com&#x2F;mastra-ai&#x2F;mastra</a> - Demo video: <a href="https:&#x2F;&#x2F;www.youtube.com&#x2F;watch?v=8o_Ejbcw5s8" rel="nofollow">https:&#x2F;&#x2F;www.youtube.com&#x2F;watch?v=8o_Ejbcw5s8</a> - Our website homepage: <a href="https:&#x2F;&#x2F;mastra.ai">https:&#x2F;&#x2F;mastra.ai</a> (includes some nice diagrams and code samples on agents, RAG, and links to examples) - And our docs: <a href="https:&#x2F;&#x2F;mastra.ai&#x2F;docs">https:&#x2F;&#x2F;mastra.ai&#x2F;docs</a><p>Excited to share Mastra with everyone here – let us know what you think!

36 条评论

Palmik3 个月前
The example from the landing page does not exactly spark joy:<p><pre><code> testWorkflow .step(llm) .then(decider) .then(agentOne) .then(workflow) .after(decider) .then(agentTwo) .then(workflow) .commit(); </code></pre> On a first glance, this looks like a very awkward way to represent the graph from the picture. And this is just a simple &quot;workflow&quot; (the structure of the graph does not depend on the results of the execution), not an agent.
评论 #43114354 未加载
评论 #43111621 未加载
评论 #43141477 未加载
评论 #43113922 未加载
评论 #43113904 未加载
评论 #43116216 未加载
kylemathews3 个月前
Very excited about Mastra! We have a number of Agent-ic things we&#x27;ll be building at ElectricSQL and Mastra looks like a breath of fresh air.<p>Also the team is top-notch — Sam was my co-founder at Gatsby and I worked closely with Shane and Abhi and I have a ton of confidence in their product &amp; engineering abilities.
评论 #43108691 未加载
评论 #43112956 未加载
joshstrange3 个月前
This looks awesome! Quick question, are there plans to support SSE MCP servers? I see Stdio [0] are supported and I can always run a proxy but SSE would be awesome.<p>[0] <a href="https:&#x2F;&#x2F;mastra.ai&#x2F;docs&#x2F;reference&#x2F;tools&#x2F;client">https:&#x2F;&#x2F;mastra.ai&#x2F;docs&#x2F;reference&#x2F;tools&#x2F;client</a>
评论 #43106636 未加载
评论 #43108525 未加载
评论 #43106183 未加载
alanwells3 个月前
Happy Mastra user here! Strikes the right balance between letting me build with higher level abstractions but providing lower level controls when needed. I looked at a handful of other frameworks before getting started and the clarity &amp; easy of use of Mastra stood out. Nice work.
评论 #43107716 未加载
brap3 个月前
I don’t really understand agents. I just don’t get why we need to pretend we have multiple personalities, especially when they’re all using the same model.<p>Can anyone please give me a usecase, that couldn’t be solved with a single API call to a modern LLM (capable of multi-step planning&#x2F;reasoning) and a proper prompt?<p>Or is this really just about building the prompt, and giving the LLM closer guidance by splitting into multiple calls?<p>I’m specifically <i>not</i> asking about function calling.
评论 #43106679 未加载
评论 #43106535 未加载
评论 #43106505 未加载
评论 #43106401 未加载
评论 #43111518 未加载
评论 #43106499 未加载
评论 #43106770 未加载
评论 #43107749 未加载
评论 #43106552 未加载
Gakho3 个月前
Congrats on launching. I&#x27;ve noticed that switching prompts without edits between different LLM providers has degradation on performance. I&#x27;m wondering if you guys have noticed how developers do these &quot;translations&quot;, I&#x27;m wondering since maybe your eval framework might have data for best practices.
评论 #43105240 未加载
epolanski3 个月前
By the developers of Gatsby is a minus, not a plus makes me think this is going to be the next abandonware.
评论 #43106872 未加载
评论 #43110654 未加载
评论 #43106363 未加载
评论 #43106193 未加载
评论 #43107987 未加载
_pdp_3 个月前
I don&#x27;t want to be that person but there are hundreds of other similar frameworks doing more or less the same thing. Do you know why? Because writing a framework that orchestrates a number of tools with a model is the easy part. In fact, most of the time you don&#x27;t even need a framework. All of these framework focus on the trivial and you can tell that simply by browsing the examples section.<p>This is like 5% of the work. The developer needs to fill the other 95% which involves a lot more things that are strictly outside of scope of the framework.
评论 #43108927 未加载
评论 #43110904 未加载
评论 #43108733 未加载
评论 #43108655 未加载
评论 #43108707 未加载
harliem3 个月前
Impressive. Have you seen any success with Mastra being used to build voice agents? Our company has been experimenting with VAPI, which just launched a workflow builder into open beta (<a href="https:&#x2F;&#x2F;docs.vapi.ai&#x2F;workflows">https:&#x2F;&#x2F;docs.vapi.ai&#x2F;workflows</a>), but it has a lot of rough edges.
评论 #43105293 未加载
评论 #43105303 未加载
eliotthehacker3 个月前
I basically learned everything about how agents work by using Mastra&#x27;s framework and going through their documentation. The founders are also super hands-on and love to help!
aranibatta3 个月前
Congrats on launching! Curious how early the Mastra team thinks people should be thinking about evals and setting up a pipeline for them.
评论 #43103589 未加载
netcraft3 个月前
This looks really great! How do you make money? Do you charge for deploying these to your platform? I couldnt find anything on pricing
评论 #43107037 未加载
monideas3 个月前
Are there any plans to add automatic retries for individual steps (with configurable max attempts and backoff strategy)?
davedx3 个月前
Why is it on top of Vercel’s platform?
评论 #43106856 未加载
评论 #43106874 未加载
PetrBrzyBrzek3 个月前
I created a similar library for orchestrations, but it’s more explicit and lightweight. <a href="https:&#x2F;&#x2F;github.com&#x2F;langtail&#x2F;ai-orchestra">https:&#x2F;&#x2F;github.com&#x2F;langtail&#x2F;ai-orchestra</a>
lmrl3 个月前
Congrats, looks promising! 1. Is it possible to create custom endpoints? I see that several endpoints are created when running “mastra dev”.<p>2. Related to previous question, since this is node based, is it possible to support websockets?
评论 #43112361 未加载
orliesaurus3 个月前
Does Mastra support libraries of tools for agents like toolhouse.ai or <a href="https:&#x2F;&#x2F;github.com&#x2F;transitive-bullshit&#x2F;agentic">https:&#x2F;&#x2F;github.com&#x2F;transitive-bullshit&#x2F;agentic</a>
评论 #43111635 未加载
dstroot3 个月前
Congrats! Side question - is the website OS as well? I&#x27;d like to &quot;borrow&quot; the Nav Bar code. I looked on GitHub and couldn&#x27;t find it in the repos and 300+ branches. Cheers!
dhorthy3 个月前
i am very long on TS as the future of agent applications. nice work team
评论 #43108415 未加载
_13 个月前
This looks really nice. We&#x27;ve been considering developing something very similar in-house. Are you guys looking at supporting MLC Web LLM, or someother local models?
评论 #43105743 未加载
realmikebernico3 个月前
Congrats! This is exactly what the AI world needs. I&#x27;m thinking about using Mastra for a class I&#x27;m working on with AI Agents.
评论 #43106296 未加载
评论 #43105253 未加载
5Qn8mNbc2FNCiVV3 个月前
I thought Kyle Matthews was the creator of Gatsby
评论 #43105202 未加载
评论 #43105250 未加载
fnikacevic3 个月前
Do the workflows support voice-to-voice models like openai&#x27;s realtime? Or if something like that exists I&#x27;d be curios.
cshimmin3 个月前
Interested to learn more about the PDF -&gt; CAD project built on mastra, can you share a link?
评论 #43112343 未加载
tobyhinloopen3 个月前
Neat, I’m going to use this
评论 #43112460 未加载
dikaio3 个月前
Got excited, was hoping to see a repository of Go Agents.
levensti3 个月前
Super excited to try out the new agent memory features
评论 #43105521 未加载
评论 #43107078 未加载
asati3 个月前
Congrats guys! really excited to try this out!
albertmz3 个月前
Kudos on using XState!
gregpr073 个月前
Any timeline for python?
评论 #43114613 未加载
评论 #43106299 未加载
fuddle3 个月前
&quot;You may not provide the software to third parties as a hosted or managed service&quot; - The Elastic v2 license isn&#x27;t actually open source like your title mentions: &quot;Open-source JS agent framework&quot;<p><a href="https:&#x2F;&#x2F;github.com&#x2F;mastra-ai&#x2F;mastra&#x2F;blob&#x2F;main&#x2F;LICENSE">https:&#x2F;&#x2F;github.com&#x2F;mastra-ai&#x2F;mastra&#x2F;blob&#x2F;main&#x2F;LICENSE</a>
评论 #43106677 未加载
delduca3 个月前
&gt; Mastra uses the Vercel AI SDK<p>It started off wrong.
评论 #43109097 未加载
jobryan3 个月前
Bamfs
评论 #43105124 未加载
pablodecm3 个月前
Very interesting set of abstractions that address lots of the pain points when building agents, also the team is super eager to help out!
评论 #43107019 未加载
yovboy3 个月前
You’re awesome guys! I had so many problems with lanchain and am very happy since switching to Mastra
评论 #43105509 未加载
评论 #43105101 未加载
bobremeika3 个月前
A TypeScript first AI framework is something that has been missing. How do you work with AI SDK?
评论 #43105581 未加载
评论 #43105095 未加载
评论 #43105205 未加载
评论 #43114157 未加载