Skip to main content

Agents — Overview

Agents — Overview

Agents are package-owned runtime artifacts. Product agents live in the K12, SDAC, TAP, and Handbook domain packages; shared, docs-chat, testing, and Reasoning Engine agents remain under src/mastra/agents/** while the monorepo transition continues.

An exported agent is not automatically live. The owning domain or cross-cutting artifact loader must build it and return it under its descriptor registryId. apps/runtime/src/mastra-runtime.ts merges the active loader results selected by MASTRA_TARGET.

Identity and configuration

Keep these identities separate:

IdentityOwnerUsed for
Descriptor profileIdAgent sourceCurrent/versioned row in Core.AgentProfiles.
Descriptor registryIdAgent source and loaderLive Mastra registry and HTTP discovery.
Database profileCore.AgentProfilesPrompt, alias, model overrides, memory settings, scope, and audit history.

The shared factory loads the current profile on each getAgent() call, recalculates its effective content hash, and reuses the cached build only when that hash still matches. Code defaults remain the fallback when SQL is unavailable or no profile exists.

Source ownership

SurfaceCurrent source
K12packages/domain-k12/src/agents/**
SDACpackages/domain-sdac/src/agents/** and packages/domain-sdac/src/agents.ts
TAPpackages/domain-tap/src/agents/**
Handbookpackages/domain-handbook/src/agents/**
Shared and docs chatsrc/mastra/agents/shared/**
Reasoning Enginesrc/mastra/agents/reasoning-engine/**

Application code should import the shared factory through @maf/platform-runtime/agents/shared/*, not through the transitional raw source path.

Operator-facing registry, seed, reconcile, and profile routes are documented in Admin API.