Verb Grammars
Agent, Workflow, Function, and Trigger schemas for automation
Verb Grammars
Verb components represent actions and automation primitives. These AI-native components execute business logic autonomously through tools, workflows, and intelligent orchestration.
Agent
Autonomous AI entity with tools, memory, and capabilities.
interface AgentProps {
$id: string
$type: 'Agent'
name: string
role: string // Agent role description
systemPrompt: string // System prompt defining behavior
model: AIModel
tools?: string[] // Tool IDs agent can use
toolConfig?: Record<string, any>
memory?: AgentMemory
capabilities?: Array<'text' | 'code' | 'analysis' | 'research' | 'planning' | 'execution' | 'multimodal'>
handoff?: {
enabled: boolean
agents?: string[] // Agents to handoff to
conditions?: string // When to handoff
}
timeout?: number // Max execution seconds (default: 300)
maxToolCalls?: number // Max tool invocations (default: 10)
streaming?: boolean // Stream responses (default: true)
costLimit?: {
maxTokens?: number
maxCost?: number // Max cost in USD
}
guardrails?: {
contentFilter?: boolean
pii?: boolean // PII detection
toxicity?: boolean // Toxicity filter
custom?: string[] // Custom guardrail IDs
}
avatar?: string // Agent avatar URL
color?: string // Brand color
}Usage:
<Agent
name="DataAnalyst"
role="Analyze metrics and generate insights"
systemPrompt="You are a data analyst who helps users understand their metrics..."
model={{
provider: 'anthropic',
model: 'claude-3-opus',
temperature: 0.7
}}
tools={['query_database', 'generate_chart', 'send_email']}
capabilities={['text', 'analysis']}
/>AI Model
interface AIModel {
provider: 'anthropic' | 'openai' | 'google' | 'cohere' | 'mistral' | 'groq' | 'together' | 'local' | 'custom'
model: string // Model identifier (claude-3-opus, gpt-4)
version?: string // Model version
temperature?: number // Response randomness (0-2, default: 0.7)
maxTokens?: number // Maximum output tokens
topP?: number // Nucleus sampling parameter
topK?: number // Top-k sampling parameter
}Agent Memory
interface AgentMemory {
type: 'none' | 'session' | 'persistent' | 'vector' // default: 'session'
maxTokens?: number // Max history tokens
vectorStore?: string // Vector store identifier
windowSize?: number // Conversation window size (turns)
}Agent Team
Coordinated team of agents with orchestration strategies.
interface AgentTeamProps {
$id: string
$type: 'AgentTeam'
name: string
purpose: string // Team mission
agents: string[] // Agent IDs in team
orchestration: 'sequential' | 'parallel' | 'hierarchical' | 'consensus' | 'dynamic'
manager?: string // Manager agent ID (for hierarchical)
communication: 'broadcast' | 'directed' | 'shared_context'
maxIterations?: number // Max team iterations (default: 10)
successCriteria?: string // When to consider task complete
}Orchestration Strategies:
sequential: Agents run in orderparallel: Agents run simultaneouslyhierarchical: Manager delegates to workersconsensus: Agents vote on decisionsdynamic: AI-driven orchestration
Usage:
<AgentTeam
name="Content Team"
purpose="Create and publish blog content"
agents={['researcher', 'writer', 'editor', 'publisher']}
orchestration="sequential"
/>Workflow
Multi-step automated process orchestrating agents, tools, and logic.
interface WorkflowProps {
$id: string
$type: 'Workflow'
name: string
description: string
version?: string // Semantic version (default: '1.0.0')
inputSchema?: any // JSON schema for inputs
outputSchema?: any // JSON schema for outputs
steps: WorkflowStep[]
startStep?: string // First step to execute
variables?: Record<string, any> // Global workflow variables
triggers?: Trigger[]
concurrency?: {
maxConcurrent?: number // Max parallel executions (default: 1)
queueBehavior?: 'queue' | 'reject' | 'cancel_running'
}
timeout?: number // Workflow timeout in ms
retry?: {
maxAttempts?: number // Default: 3
backoff?: 'fixed' | 'exponential'
}
notifications?: {
onSuccess?: string[] // Webhook URLs
onFailure?: string[] // Webhook URLs
}
active?: boolean // Workflow is enabled (default: true)
}Workflow Step
interface WorkflowStep {
id: string // Unique step ID
name: string
type: 'agent' | 'tool' | 'condition' | 'loop' | 'parallel' | 'wait' | 'human' | 'transform' | 'webhook'
description?: string
config: any // Step-specific configuration
input?: Record<string, string> // Input variable mapping
output?: string // Output variable name
retry?: {
maxAttempts?: number
backoff?: 'fixed' | 'exponential'
delay?: number // Initial delay in ms (default: 1000)
}
onError?: 'fail' | 'continue' | 'retry' | 'fallback'
fallbackStep?: string // Step to run on error
timeout?: number // Step timeout in ms
condition?: string // Expression to evaluate
}Step Types:
agent: Run an agenttool: Execute a tool directlycondition: Conditional branchingloop: Iterationparallel: Parallel executionwait: Wait for event/timehuman: Human approval/inputtransform: Data transformationwebhook: External webhook call
Usage:
<Workflow
name="Lead Qualification"
description="Qualify and route incoming leads"
steps={[
{
id: 'analyze',
name: 'Analyze Lead',
type: 'agent',
config: { agentId: 'lead_analyzer' }
},
{
id: 'score',
name: 'Calculate Score',
type: 'tool',
config: { toolId: 'lead_scoring' }
},
{
id: 'route',
name: 'Route to Sales',
type: 'condition',
config: {
if: 'score > 70',
then: 'assign_sales',
else: 'nurture_campaign'
}
}
]}
triggers={[
{ type: 'webhook', config: { path: '/leads/new' } }
]}
/>Function
Serverless execution unit with triggers and scaling.
interface FunctionProps {
$id: string
$type: 'Function'
name: string
description: string
runtime: 'nodejs20' | 'nodejs18' | 'python311' | 'python310' | 'deno' | 'bun' | 'go' | 'rust' | 'edge'
entrypoint: string // Handler function path
source: {
type: 'inline' | 'git' | 'url' | 's3'
value: string // Code or location
}
memory?: number // Memory in MB (default: 128)
timeout?: number // Timeout in seconds (default: 30)
env?: Record<string, string> // Environment variables
secrets?: string[] // Secret names to inject
http?: {
enabled?: boolean // Default: true
method?: 'GET' | 'POST' | 'PUT' | 'DELETE' | 'ANY'
path?: string // Custom path
cors?: boolean // Default: true
auth?: 'none' | 'api_key' | 'jwt' | 'custom'
}
schedule?: {
enabled?: boolean // Default: false
cron: string // Cron expression
timezone?: string // Default: 'UTC'
}
events?: Array<{
source: string // Event source
type: string // Event type
filter?: any // Event filter
}>
scaling?: {
minInstances?: number // Default: 0
maxInstances?: number // Default: 100
concurrency?: number // Default: 10
}
vpc?: {
enabled?: boolean // Default: false
subnetIds?: string[]
securityGroupIds?: string[]
}
layers?: string[] // Layer ARNs
costCenter?: string // Cost allocation tag
}Usage:
<Function
name="process_webhook"
description="Process incoming webhook data"
runtime="nodejs20"
entrypoint="index.handler"
source={{
type: 'git',
value: 'https://github.com/acme/functions.git#main:webhooks'
}}
http={{
enabled: true,
method: 'POST',
path: '/webhooks/stripe'
}}
env={{ NODE_ENV: 'production' }}
secrets={['STRIPE_SECRET']}
/>Trigger
Event-driven automation starter that watches for events.
interface TriggerProps {
$id: string
$type: 'Trigger'
name: string
description?: string
type: 'webhook' | 'schedule' | 'event' | 'email' | 'form' | 'database' | 'file' | 'manual'
config: any // Trigger-specific configuration
target: {
type: 'workflow' | 'agent' | 'function'
id: string // Target ID
}
transform?: string // JSONata/JQ expression
filter?: string // Filter expression
enabled?: boolean // Default: true
rateLimit?: {
requests: number
window: number // Time window in seconds
}
}Trigger Types:
webhook: HTTP webhookschedule: Cron scheduleevent: Event busemail: Email receivedform: Form submissiondatabase: Database changefile: File uploadmanual: Manual trigger
Usage:
<Trigger
name="Daily Report"
type="schedule"
config={{
cron: '0 9 * * *', // 9 AM daily
timezone: 'America/New_York'
}}
target={{
type: 'workflow',
id: 'generate_report'
}}
/>Tool
A capability an agent can invoke - wraps APIs, functions, or services.
interface ToolProps {
$id: string
name: string
description: string // Description for AI to understand when to use
category?: 'data' | 'communication' | 'file' | 'web' | 'code' | 'database' | 'ai' | 'integration' | 'system' | 'custom'
parameters: ToolParameter[]
returns?: {
type: string
description: string
}
permissions?: string[] // Required permissions
rateLimit?: {
requests: number // Max requests
window: number // Time window in seconds
}
requiresConfirmation?: boolean // Needs human approval (default: false)
dangerous?: boolean // Can cause irreversible changes (default: false)
examples?: Array<{
input: Record<string, any>
output?: any
}>
}Tool Parameter
interface ToolParameter {
name: string
type: 'string' | 'number' | 'boolean' | 'object' | 'array'
description: string // Parameter description for AI
required?: boolean // Default: true
default?: any
enum?: string[] // Allowed values
schema?: any // JSON schema for validation
}Usage:
<Tool
name="send_email"
description="Send an email to a recipient"
category="communication"
parameters={[
{ name: 'to', type: 'string', description: 'Recipient email' },
{ name: 'subject', type: 'string', description: 'Email subject' },
{ name: 'body', type: 'string', description: 'Email body' }
]}
requiresConfirmation={true}
/>Task
Trackable work item with status and priority.
interface TaskProps {
$id: string
$type: 'Task'
title: string
description?: string
status: 'pending' | 'in_progress' | 'completed' | 'failed' | 'cancelled'
priority: 0 | 1 | 2 | 3 | 4 // 0=critical, 4=backlog
assignee?: string // User or agent ID
dueDate?: string // ISO datetime
dependencies?: string[] // Task IDs this depends on
tags?: string[]
metadata?: Record<string, any>
}Execution Context
Context and state for agent/workflow executions.
interface ExecutionContext {
id: string // Unique execution identifier
parentId?: string // Parent execution ID (for nested)
userId?: string // Initiating user ID
workspaceId?: string // Workspace context
startedAt: string // ISO datetime
endedAt?: string // ISO datetime
status: 'pending' | 'running' | 'paused' | 'completed' | 'failed' | 'cancelled' | 'timeout'
input: any // Execution input
output?: any // Execution output
error?: {
message: string
code?: string
stack?: string
}
metadata?: Record<string, any>
}Zod Schemas
All verb schemas are available as Zod schemas for runtime validation:
import {
AgentPropsSchema,
AgentTeamPropsSchema,
WorkflowPropsSchema,
WorkflowStepSchema,
FunctionPropsSchema,
TriggerPropsSchema,
ToolPropsSchema,
TaskPropsSchema,
ExecutionContextSchema,
} from 'mdxui/zod'
const result = AgentPropsSchema.safeParse(data)
if (!result.success) {
console.error(result.error)
}See Zod Schemas for the complete list.