Advanced

Output Schemas

Output schemas define the exact structure of data that functional agents return, enabling you to embed AI-powered features directly into your application's UI with a native feel.

What are Output Schemas?

Output schemas are JSON Schema definitions that specify the exact structure functional agents will return. This enables you to:

  • Embed directly in your UI: Render structured agent responses natively in your application without parsing or transformation
  • Type-safe integration: Generate TypeScript types from schemas for end-to-end type safety
  • Predictable responses: Guarantee consistent data structure across all agent executions
  • Native feel: Display agent-generated data in forms, tables, cards, or any UI component as if it came from your backend
Functional Agents Only: Output schemas are exclusively for functional agents that execute tasks and return structured data. Conversational agents return natural language responses and don't use schemas.

Native UI Embedding Example

With output schemas, you can seamlessly embed AI-generated data into your UI:

tsx
// Functional agent returns structured order data
const result = await executeAgent('order-processor', {
  userContext: 'Create order',
  inputParameters: { items, customerId }
});

// Directly render in your React UI - feels completely native
<OrderConfirmation>
  <OrderId>{result.data.orderId}</OrderId>
  <Status badge={result.data.status}>
    {result.data.status}
  </Status>
  <ItemsList items={result.data.items} />
  <Total amount={result.data.totalAmount} />
  <DeliveryDate date={result.data.estimatedDelivery} />
</OrderConfirmation>

// No parsing, no transformation - just direct integration
// Your users never know an AI agent generated this data

JSON Schema Format

Meebly uses standard JSON Schema (draft-07) for output definitions. Here's a complete example:

json
{
  "type": "object",
  "properties": {
    "orderId": {
      "type": "string",
      "description": "Unique identifier for the order"
    },
    "status": {
      "type": "string",
      "enum": ["pending", "confirmed", "shipped", "delivered", "cancelled"],
      "description": "Current order status"
    },
    "totalAmount": {
      "type": "number",
      "description": "Total order amount in USD"
    },
    "items": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "productId": {"type": "string"},
          "quantity": {"type": "integer", "minimum": 1},
          "price": {"type": "number"}
        },
        "required": ["productId", "quantity", "price"]
      }
    },
    "estimatedDelivery": {
      "type": "string",
      "format": "date",
      "description": "ISO 8601 date format"
    }
  },
  "required": ["orderId", "status", "totalAmount"]
}

Schema Examples

Data Extraction Agent

json
{
  "type": "object",
  "properties": {
    "company": {"type": "string"},
    "contactPerson": {"type": "string"},
    "email": {"type": "string", "format": "email"},
    "phone": {"type": "string"},
    "extractedDate": {"type": "string", "format": "date-time"}
  },
  "required": ["company", "email"]
}

Report Generation Agent

json
{
  "type": "object",
  "properties": {
    "reportId": {"type": "string"},
    "title": {"type": "string"},
    "summary": {"type": "string"},
    "metrics": {
      "type": "object",
      "properties": {
        "totalRevenue": {"type": "number"},
        "totalOrders": {"type": "integer"},
        "averageOrderValue": {"type": "number"}
      }
    },
    "generatedAt": {"type": "string", "format": "date-time"},
    "pdfUrl": {"type": "string", "format": "uri"}
  },
  "required": ["reportId", "title", "metrics", "generatedAt"]
}

Validation & Type Safety

When a functional agent executes, the AI generates data matching your schema. Meebly validates the output to ensure:

  • All required fields are present
  • Field types match schema definitions
  • Enum values are valid
  • Nested objects follow structure
TypeScript Integration: Generate TypeScript types from your JSON schemas for end-to-end type safety in your application.

Best Practices

  • ✓ Keep schemas focused and minimal
  • ✓ Use descriptive field names
  • ✓ Add descriptions for complex fields
  • ✓ Mark fields as required only when truly necessary
  • ✓ Use enums for fixed value sets
  • ✓ Test schemas with sample data before deploying
Last updated: March 2026Report an issue