Add TypeScript Mastra adapter - #207
Conversation
| StartNode -> LlmNode/ToolNode/AgentNode... -> EndNode | ||
| ``` | ||
|
|
||
| The converter rejects branching, cycles, disconnected nodes, unsupported node |
There was a problem hiding this comment.
I would mention that also data flow edges are not supported, if I am not mistaken I did not see their translation either
| id, | ||
| connectionString: connection.url, | ||
| user: connection.user, | ||
| password: connection.password, |
There was a problem hiding this comment.
It looks like user and password are ignored by mastra, as they are extracted from the URL. Can you check if that's true? I think you either have to:
- construct an authenticated URL, e.g.
postgresql://user:password@localhost:5432/agentspec(with correct URL escaping), or - use Mastra’s host-based configuration form, where username/password are supported fields.
| tools[tool.name] = this.runtime.createTool(toolConfig); | ||
| } | ||
|
|
||
| return this.runtime.createAgent({ |
There was a problem hiding this comment.
Nit: could you reject explicitly configurations that are not supported (e.g., human in the loop)? It would be good to see an explicit message saying that it's not supported, here and in the other conversions that are partially supported.
| includeModelApiKey?: boolean; | ||
| }; | ||
|
|
||
| export class MastraToAgentSpecConverter { |
There was a problem hiding this comment.
I am not sure about how exactly docstrings work in typescript, but probably worth having minimal ones in public classes and their public methods.
Adds initial Mastra adapter support for the TypeScript SDK.
This includes Agent Spec -> Mastra loading, Mastra-style config -> Agent Spec export, model/tool mapping, datastore target mapping for in-memory and Postgres storage, initial linear Flow -> Mastra Workflow conversion, docs, tests, and adapter examples.
Credit: this work was developed with Darsh Patel (@darshpatel1052). The branch is squashed under my OCA verified contributor account for contribution processing.