Skip to content

Interface: CardAgentLike

Minimal structural shape of the Mastra Agent this module drives.

Declared structurally rather than importing @mastra/core’s Agent: this package must not depend on the Mastra plugin (the plugin depends on nothing here either), and a turn only ever needs generate. Any object with a compatible generate satisfies it, which also makes the turn trivially testable with a stub.

generate(prompt, options): Promise<AgentResult>

string

AbortSignal

{ resource: string; thread: string; }

string

string

unknown

Mastra’s per-turn RequestContext. Opaque here - the object comes from the agent plugin (see AgentProviderLike.exports) and is only forwarded - but REQUIRED for parity with the chat endpoints: Mastra’s user-scoped tools read the AppKit user off it, so a turn without one answers “the data source is unreachable” where chat answers with data.

{ jsonPromptInjection?: boolean | "system" | "inline"; schema: ZodObject<{ actions: ZodOptional<ZodArray<ZodObject<{ title: ZodString; url: ZodString; }, $strip>>>; facts: ZodOptional<ZodArray<ZodObject<{ title: ZodString; value: ZodString; }, $strip>>>; subtitle: ZodOptional<ZodString>; text: ZodOptional<ZodString>; title: ZodString; }, $strip>; }

boolean | "system" | "inline"

ZodObject<{ actions: ZodOptional<ZodArray<ZodObject<{ title: ZodString; url: ZodString; }, $strip>>>; facts: ZodOptional<ZodArray<ZodObject<{ title: ZodString; value: ZodString; }, $strip>>>; subtitle: ZodOptional<ZodString>; text: ZodOptional<ZodString>; title: ZodString; }, $strip>

Promise<AgentResult>