ObjectStackObjectStack

Agent

Agent protocol schemas

AI Model Configuration

Source: packages/spec/src/ai/agent.zod.ts

TypeScript Usage

import { AIModelConfigSchema, AgentSchema, StructuredOutputConfigSchema, StructuredOutputFormatSchema, TransformPipelineStepSchema } from '@objectstack/spec/ai';
import type { Agent, StructuredOutputConfig, StructuredOutputFormat, TransformPipelineStep } from '@objectstack/spec/ai';

// Validate data
const result = AIModelConfigSchema.parse(data);

AIModelConfig

Properties

PropertyTypeRequiredDescription
providerEnum<'openai' | 'azure_openai' | 'anthropic' | 'local'>optional (default: "openai")
modelstringModel name (e.g. gpt-4, claude-3-opus)
temperaturenumberoptional (default: 0.7)
maxTokensnumberoptional
topPnumberoptional

Agent

Properties

PropertyTypeRequiredDescription
namestringAgent unique identifier
labelstringAgent display name
avatarstringoptional
rolestringThe persona/role (e.g. "Senior Support Engineer")
instructionsstringSystem Prompt / Prime Directives
model{ provider: Enum<'openai' | 'azure_openai' | 'anthropic' | 'local'>; model: string; temperature: number; maxTokens?: number; … }optional
lifecycle{ id: string; description?: string; contextSchema?: Record<string, any>; initial: string; … }optional[EXPERIMENTAL — not enforced] State machine defining the agent conversation flow and constraints. Parsed but no runtime consumer yet.
surfaceEnum<'ask' | 'build'>optional (default: "ask")Product surface this agent binds ('ask' | 'build') — ADR-0063 §1
skillsstring[]optionalSkill names to attach (Agent→Skill→Tool architecture)
toolsneveroptional[REMOVED] agent.tools was removed in @objectstack/spec 17 — use skills. An agent reaches exactly the tools its surface-compatible skills declare (ADR-0064), so move each reference into a skill: a platform tool by its registered name, or action_<name> for one of your own AI-exposed Actions. This is NOT a rename — there is no key the value moves to: the migration DELETES the key and emits a notice naming each tool that was listed, and you re-declare each one in a skill by hand. Run os migrate meta --from 16 to list the mechanical edits for existing sources; apply them by hand.
knowledgeneveroptional[REMOVED] agent.knowledge was removed in @objectstack/spec 17.0.0 (audit close-out) — declaring knowledge sources/indexes on an agent never scoped retrieval: the search_knowledge tool takes sourceIds from the LLM's tool-call arguments, not from the agent record. Delete the block. Restrict retrieval at the knowledge-service / source level (per-source permissions), and describe intended grounding in instructions so the model asks for the right sources. Run os migrate meta --from 16 to list the mechanical edits for existing sources; apply them by hand.
activebooleanoptional (default: true)
accessstring[]optionalWho can chat with this agent
permissionsstring[]optionalRequired permission-set capabilities
planning{ maxIterations: integer }optionalAutonomous reasoning and planning configuration
memory{ longTerm?: object; reflectionInterval?: integer }optional[EXPERIMENTAL — not enforced] Agent memory management. Parsed but no runtime consumer yet.
guardrails{ maxTokensPerInvocation?: integer; maxExecutionTimeSec?: integer; blockedTopics?: string[] }optional[EXPERIMENTAL — not enforced] Safety guardrails for the agent. Parsed but not enforced — real limits come from the quota service.
structuredOutput{ format: Enum<'json_object' | 'json_schema' | 'regex' | 'grammar' | 'xml'>; schema?: Record<string, any>; strict: boolean; retryOnValidationFailure: boolean; … }optional[EXPERIMENTAL — not enforced] Structured output format and validation configuration. Parsed but no runtime consumer yet.
protection{ lock: Enum<'none' | 'no-overlay' | 'no-delete' | 'full'>; reason: string; docsUrl?: string }optionalPackage author protection block — lock policy for this agent.
_lockEnum<'none' | 'no-overlay' | 'no-delete' | 'full'>optionalItem-level lock — controls overlay & delete (ADR-0010).
_lockReasonstringoptionalHuman-readable reason shown when a write is refused by _lock.
_lockSourceEnum<'artifact' | 'package' | 'env-forced'>optionalLayer that set _lock (artifact | package | env-forced).
_provenanceEnum<'package' | 'org' | 'env-forced'>optionalOrigin of the item (package | org | env-forced).
_packageIdstringoptionalOwning package machine id.
_packageVersionstringoptionalOwning package version.
_lockDocsUrlstringoptionalOptional documentation link surfaced next to _lockReason.

Nested Shape: Agent.model

PropertyTypeRequiredDescription
providerEnum<'openai' | 'azure_openai' | 'anthropic' | 'local'>optional (default: "openai")
modelstringModel name (e.g. gpt-4, claude-3-opus)
temperaturenumberoptional (default: 0.7)
maxTokensnumberoptional
topPnumberoptional

Nested Shape: Agent.lifecycle

PropertyTypeRequiredDescription
idstringUnique Machine ID
descriptionstringoptional
contextSchemaRecord<string, any>optionalZod Schema for the machine context/memory
initialstringInitial State ID
statesRecord<string, { type: Enum<'atomic' | 'compound' | 'parallel' | 'final' | 'history'>; entry?: (string | object)[]; exit?: (string | object)[]; on?: Record<string, string | object | object[]>; … }>State Nodes
onRecord<string, string | { target?: string; cond?: string | object; actions?: (string | object)[]; description?: string } | { target?: string; cond?: string | object; actions?: (string | object)[]; description?: string }[]>optional

Nested Shape: Agent.planning

PropertyTypeRequiredDescription
maxIterationsintegeroptional (default: 10)Maximum planning loop iterations

Nested Shape: Agent.memory

PropertyTypeRequiredDescription
longTerm{ enabled: boolean; store: Enum<'vector' | 'database' | 'redis'>; maxEntries?: integer }optionalLong-term / persistent memory
reflectionIntervalintegeroptionalReflect every N interactions to improve behavior

Nested Shape: Agent.guardrails

PropertyTypeRequiredDescription
maxTokensPerInvocationintegeroptionalToken budget per single invocation
maxExecutionTimeSecintegeroptionalMax execution time in seconds
blockedTopicsstring[]optionalForbidden topics or action names

Nested Shape: Agent.structuredOutput

PropertyTypeRequiredDescription
formatEnum<'json_object' | 'json_schema' | 'regex' | 'grammar' | 'xml'>Expected output format
schemaRecord<string, any>optionalJSON Schema definition for output
strictbooleanoptional (default: false)Enforce exact schema compliance
retryOnValidationFailurebooleanoptional (default: true)Retry generation when output fails validation
maxRetriesintegeroptional (default: 3)Maximum retries on validation failure
fallbackFormatEnum<'json_object' | 'json_schema' | 'regex' | 'grammar' | 'xml'>optionalFallback format if primary format fails
transformPipelineEnum<'trim' | 'parse_json' | 'validate' | 'coerce_types'>[]optionalPost-processing steps applied to output

Nested Shape: Agent.protection

PropertyTypeRequiredDescription
lockEnum<'none' | 'no-overlay' | 'no-delete' | 'full'>Lock policy — none | no-overlay | no-delete | full.
reasonstringUser-visible reason shown when the lock blocks an action.
docsUrlstringoptionalOptional URL the Studio banner links to for more context.

StructuredOutputConfig

Structured output configuration for agent responses

Properties

PropertyTypeRequiredDescription
formatEnum<'json_object' | 'json_schema' | 'regex' | 'grammar' | 'xml'>Expected output format
schemaRecord<string, any>optionalJSON Schema definition for output
strictbooleanoptional (default: false)Enforce exact schema compliance
retryOnValidationFailurebooleanoptional (default: true)Retry generation when output fails validation
maxRetriesintegeroptional (default: 3)Maximum retries on validation failure
fallbackFormatEnum<'json_object' | 'json_schema' | 'regex' | 'grammar' | 'xml'>optionalFallback format if primary format fails
transformPipelineEnum<'trim' | 'parse_json' | 'validate' | 'coerce_types'>[]optionalPost-processing steps applied to output

StructuredOutputFormat

Output format for structured agent responses

Allowed Values

  • json_object
  • json_schema
  • regex
  • grammar
  • xml

TransformPipelineStep

Post-processing step for structured output

Allowed Values

  • trim
  • parse_json
  • validate
  • coerce_types

On this page