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'>
modelstringModel name (e.g. gpt-4, claude-3-opus)
temperaturenumber
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 (liveness #1878/#1893).
surfaceEnum<'ask' | 'build'>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 (#3894) — 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 rewrite existing sources automatically.
knowledgeneveroptional[REMOVED] agent.knowledge was removed in @objectstack/spec 17.0.0 (#3896 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 rewrite existing sources automatically.
activeboolean
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 (liveness #1878/#1893).
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 (liveness #1878/#1893).
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 (liveness #1878/#1893).
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.

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
strictbooleanEnforce exact schema compliance
retryOnValidationFailurebooleanRetry generation when output fails validation
maxRetriesintegerMaximum 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