@mastra/core
Version:
54 lines • 2.3 kB
TypeScript
import { Agent } from '../agent/index.js';
import type { AgentConfig } from '../agent/types.js';
export { buildBasePrompt, type PromptContext } from './prompt.js';
/**
* Configuration for {@link createCodingAgent}.
*
* Most fields are passed straight through to the underlying `Agent`. The
* factory fills portable defaults for the pieces a coding agent always needs —
* a local workspace, the task-list signal provider, network-retry error
* processors, and the goal judge prompt — so a caller can get a working coding
* agent by supplying only `model`, `instructions`, and `tools`.
*/
export interface CreateCodingAgentConfig extends AgentConfig {
/**
* Base path for the default workspace built when `workspace` is omitted.
* @default process.cwd()
*/
basePath?: string;
}
/**
* Creates a coding agent as a Mastra {@link Agent}, applying portable defaults
* for the workspace, task-list signal, network-retry error processors, and goal
* judge prompt.
*
* Caller-provided values always win:
* - `workspace` is used verbatim when provided; otherwise a {@link Workspace}
* backed by {@link LocalFilesystem}/{@link LocalSandbox} rooted at
* `basePath` (default `process.cwd()`) is built.
* - `signals` are merged with a {@link TaskSignalProvider} when `memory` is
* configured; otherwise the caller-provided signals are used verbatim (or
* an empty array when none are provided). This avoids wiring
* {@link TaskSignalProvider} — which requires a memory-backed thread — into
* agents that have no memory.
* - `errorProcessors` is used verbatim when provided; otherwise it defaults to
* the ECONNRESET/bad-request retry stack plus prefill + provider-history
* compatibility processors.
* - `goal.prompt` defaults to {@link DEFAULT_GOAL_JUDGE_PROMPT} when a goal is
* configured without one.
*
* @example
* ```typescript
* import { createCodingAgent } from '@mastra/core/coding-agent';
*
* const agent = createCodingAgent({
* id: 'my-coding-agent',
* name: 'My Coding Agent',
* model: 'openai/gpt-5',
* instructions: 'You are a helpful coding assistant.',
* tools: {},
* });
* ```
*/
export declare function createCodingAgent(config: CreateCodingAgentConfig): Agent;
//# sourceMappingURL=index.d.ts.map