
Research
2025 Report: Destructive Malware in Open Source Packages
Destructive malware is rising across open source registries, using delays and kill switches to wipe code, break builds, and disrupt CI/CD.
@caleblawson/core
Advanced tools
The core foundation of the Mastra framework, providing essential components and interfaces for building AI-powered applications.
The core foundation of the Mastra framework, providing essential components and interfaces for building AI-powered applications.
npm install @mastra/core
@mastra/core is the foundational package of the Mastra framework, providing:
For comprehensive documentation, visit our official documentation.
/agent)Agents are autonomous AI entities that can understand instructions, use tools, and complete tasks. They encapsulate LLM interactions and can maintain conversation history, use provided tools, and follow specific behavioral guidelines through instructions.
import { Agent } from '@mastra/core/agent';
import { openai } from '@ai-sdk/openai';
const agent = new Agent({
name: 'my-agent',
instructions: 'Your task-specific instructions',
model: openai('gpt-4o-mini'),
tools: {}, // Optional tools
});
/workflows)Workflows orchestrate complex AI tasks by combining multiple actions into a coherent sequence. They handle state management, error recovery, and can include conditional logic and parallel execution.
import { createWorkflow } from '@mastra/core/workflows';
import z from 'zod'
const workflow = createWorkflow({
id: 'my-workflow',
inputSchema: z.object({}),
outputSchema: z.object({})
steps: [
// Workflow steps
],
});
/memory)Memory management provides persistent storage and retrieval of AI interactions. It supports different storage backends and enables context-aware conversations and long-term learning.
import { Memory } from '@mastra/memory';
import { Agent } from '@mastra/core/agent';
import { openai } from '@ai-sdk/openai';
const agent = new Agent({
name: 'Project Manager',
instructions: 'You are a project manager assistant.',
model: openai('gpt-4o-mini'),
memory: new Memory({
options: {
lastMessages: 20,
semanticRecall: {
topK: 3,
messageRange: { before: 2, after: 1 },
},
},
}),
});
/tools)Tools are functions that agents can use to interact with external systems or perform specific tasks. Each tool has a clear description and schema, making it easy for AI to understand and use them effectively.
import { createTool } from '@mastra/core/tools';
import { z } from 'zod';
const weatherInfo = createTool({
id: 'Get Weather Information',
inputSchema: z.object({
city: z.string(),
}),
description: 'Fetches the current weather information for a given city',
execute: async ({ context: { city } }) => {
// Tool implementation
},
});
/eval)The evaluation system enables quantitative assessment of AI outputs. Create custom metrics to measure specific aspects of AI performance, from response quality to task completion accuracy.
import { Agent } from '@mastra/core/agent';
import { openai } from '@ai-sdk/openai';
import { SummarizationMetric } from '@mastra/evals/llm';
import { ContentSimilarityMetric, ToneConsistencyMetric } from '@mastra/evals/nlp';
const model = openai('gpt-4o');
const agent = new Agent({
name: 'ContentWriter',
instructions: 'You are a content writer that creates accurate summaries',
model,
evals: {
summarization: new SummarizationMetric(model),
contentSimilarity: new ContentSimilarityMetric(),
tone: new ToneConsistencyMetric(),
},
});
/logger)The logging system provides structured, leveled logging with multiple transport options. It supports debug information, performance monitoring, and error tracking across your AI applications.
import { LogLevel } from '@mastra/core';
import { PinoLogger } from '@mastra/loggers';
const logger = new PinoLogger({
name: 'MyApp',
level: LogLevel.INFO,
});
/telemetry)Telemetry provides OpenTelemetry (Otel) integration for comprehensive monitoring of your AI systems. Track latency, success rates, and system health with distributed tracing and metrics collection.
import { Mastra } from '@mastra/core';
const mastra = new Mastra({
telemetry: {
serviceName: 'my-service',
enabled: true,
sampling: {
type: 'ratio',
probability: 0.5,
},
export: {
type: 'otlp',
endpoint: 'https://otel-collector.example.com/v1/traces',
},
},
});
More Telemetry documentation →
FAQs
The core foundation of the Mastra framework, providing essential components and interfaces for building AI-powered applications.
We found that @caleblawson/core demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Research
Destructive malware is rising across open source registries, using delays and kill switches to wipe code, break builds, and disrupt CI/CD.

Security News
Socket CTO Ahmad Nassri shares practical AI coding techniques, tools, and team workflows, plus what still feels noisy and why shipping remains human-led.

Research
/Security News
A five-month operation turned 27 npm packages into durable hosting for browser-run lures that mimic document-sharing portals and Microsoft sign-in, targeting 25 organizations across manufacturing, industrial automation, plastics, and healthcare for credential theft.