---
name: mastra-client-js
description: Documentation for @mastra/client-js. Use when working with @mastra/client-js APIs, configuration, or implementation.
metadata:
  package: "@mastra/client-js"
  version: "1.61.0"
---

## When to use

Use this skill whenever you are working with @mastra/client-js to obtain the domain-specific knowledge.

## How to use

Read the individual reference documents for detailed explanations and code examples.

### Docs

- [JSON Web Token](references/docs-auth-jwt.md) - Secure Mastra APIs with MastraJwtAuth and a shared secret, then create JSON Web Tokens and send authenticated requests through MastraClient.
- [A2A (Agent-to-Agent)](references/docs-connections-a2a.md) - Expose Mastra agents through the Agent-to-Agent protocol and consume remote A2A agents as subagents or call them directly with the client SDK.
- [Agent Controller](references/docs-harness-agent-controller.md) - Build interactive Mastra agent applications with Agent Controller sessions, persistent threads, modes, approvals, subagents, channels, and runtime state.
- [Schedules](references/docs-harness-schedules.md) - Schedule Mastra agents with cron expressions, recurring prompts, optional thread delivery, lifecycle hooks, and APIs for managing scheduled runs.
- [Mastra client](references/docs-server-mastra-client.md) - Use the type-safe Mastra Client SDK from browser applications to call agents, workflows, tools, memory, and server APIs with streaming support.
- [Notifications](references/docs-signals-notifications.md) - Create durable Mastra notification records, resolve delivery policy, and deliver notifications or summaries to an agent thread.
- [Sending signals](references/docs-signals-sending-signals.md) - Send input to an agent thread and let Mastra decide whether to deliver it or wake the thread.
- [Thread streams](references/docs-signals-thread-streams.md) - Subscribe to a Mastra agent thread to read stored history, live output, and lifecycle events as a single ordered stream.
- [Editor](references/docs-studio-editor.md) - Use Mastra Studio Editor so collaborators can change agent instructions and tools without modifying source code, from draft testing through publication.

### Integrations

- [Auth0](references/integrations-auth-auth0.md) - Authenticate Mastra servers with Auth0 JWTs, configure credentials and authorization, and connect client applications with authenticated requests.
- [Clerk](references/integrations-auth-clerk.md) - Give Mastra agents Clerk tools through Mastra Connect, and authenticate Mastra server requests with the @mastra/auth-clerk provider and MastraClient.
- [Firebase](references/integrations-auth-firebase.md) - Authenticate Mastra applications with Firebase ID tokens, configure service credentials and authorization, and send secured client requests.
- [Neon](references/integrations-auth-neon.md) - Authenticate Mastra server requests and Studio users with Neon Auth, map Neon Auth organization roles to Mastra permissions, and connect MastraClient with a Neon Auth JWT.
- [Supabase](references/integrations-auth-supabase.md) - Give Mastra agents Supabase tools through Mastra Connect, and authenticate Mastra server requests with Supabase Auth and MastraClient.
- [WorkOS](references/integrations-auth-workos.md) - Give Mastra agents WorkOS tools through Mastra Connect, and authenticate Mastra with WorkOS access tokens, fine-grained authorization, and JWT templates.

### Reference

- [Reference: toAISdkMessages()](references/reference-ai-sdk-to-ai-sdk-messages.md) - Converts messages from input formats to AI SDK UI message format. toAISdkMessages() keeps the existing AI SDK v5/default behavior.
- [Reference: toAISdkStream()](references/reference-ai-sdk-to-ai-sdk-stream.md) - Converts Mastra streams (agent, network, or workflow) to AI SDK-compatible streams.
- [Reference: toAISdkV4Messages()](references/reference-ai-sdk-to-ai-sdk-v4-messages.md) - Use toAISdkV4Messages() to convert strings and Mastra or AI SDK messages into AI SDK v4 UIMessage objects for useChat().
- [Reference: toAISdkV5Messages()](references/reference-ai-sdk-to-ai-sdk-v5-messages.md) - Converts messages from input formats to AI SDK V5 (and later) UI message format.
- [Reference: Agent Controller API](references/reference-client-js-agent-controller.md) - The Agent Controller API connects a UI in another process to an agent controller session over HTTP, streaming its events and sending messages, approvals, and suspension responses.
- [Reference: Agents API](references/reference-client-js-agents.md) - The Agents API provides methods to interact with Mastra AI agents, including generating responses and streaming interactions.
- [Reference: OpenAI Responses API Conversations](references/reference-client-js-conversations.md) - The OpenAI Responses API Conversations surface gives you the conversation-management side of Mastra Agents as a Responses API.
- [Reference: Datasets API](references/reference-client-js-datasets.md) - The Datasets API exposes Mastra's dataset and experiment routes from MastraClient.
- [Reference: Error handling](references/reference-client-js-error-handling.md) - The Mastra Client SDK includes built-in retry mechanism and error handling capabilities.
- [Reference: Logs API](references/reference-client-js-logs.md) - The Logs API provides methods to access and query system logs and debugging information in Mastra.
- [Reference: Mastra client SDK](references/reference-client-js-mastra-client.md) - The Mastra Client SDK provides a type-safe interface for interacting with your Mastra Server from your client environment.
- [Reference: Memory API](references/reference-client-js-memory.md) - The Memory API provides methods to manage conversation threads and message history in Mastra.
- [Reference: Observability API](references/reference-client-js-observability.md) - The Observability API provides methods to retrieve traces, monitor application performance, score traces for evaluation, and record feedback linked to traces and spans.
- [Reference: OpenAI Responses API](references/reference-client-js-responses.md) - This OpenAI-compatible, agent-backed interface lets you use Mastra Agents as a Responses API.
- [Reference: Tools API](references/reference-client-js-tools.md) - The Tools API provides methods to interact with and execute tools available in the Mastra platform.
- [Reference: Vectors API](references/reference-client-js-vectors.md) - The Vectors API provides methods to work with vector embeddings for semantic search and similarity matching in Mastra.
- [Reference: Workflows API](references/reference-client-js-workflows.md) - The Workflows API provides methods to interact with and execute automated workflows in Mastra.
- [Reference: Versioning](references/reference-editor-versioning.md) - Editor versions stored agents and prompt blocks. Database-backed resources use draft and publish operations.
- [Reference: Metric queries](references/reference-observability-metrics-queries.md) - Metric queries read raw and aggregated metric data from the observability storage domain. For exporter and storage setup, see the Metrics overview.
- [Reference: Query traces and spans](references/reference-observability-tracing-advanced-queries.md) - Find, count, and measure completed traces and spans with structured predicates. List matching traces or spans, aggregate them into grouped measures, paginate, poll, and discover query fields.


Read [assets/SOURCE_MAP.json](assets/SOURCE_MAP.json) for source code references.