Skip to content
Message Schemas

Message Schemas

Structured Message Schemas in Partite Mesh

Partite Mesh uses a disciplined, trimmed subset of JSON Schema to describe every typed message exchanged between Agents, Intents, Call Links, Transfer Links and external callers. Clear structure + rich field descriptions dramatically improve instruction following, constrain token usage, and enable advanced features like grounding & resource referencing without brittle text scraping.

This page explains:

  1. Design goals & why a subset
  2. Core restrictions
  3. Grounding extensions (x-partite-grounding-config)
  4. Resource references (format: "x-partite-ref")
  5. Runtime grounding and citation flow
  6. Authoring best practices & common pitfalls
  7. End‑to‑end examples

1. Design Goals

Message schemas serve as precise contracts between cooperating agents. Each schema:

  • Narrows scope → smaller prompts, better focus, less hallucination.
  • Provides explicit field semantics via required descriptions → models fill fields more accurately.
  • Forms the backbone for grounding (fact verification) and resource exposure.

Rather than chase full JSON Schema expressiveness (which often confuses LLMs), Partite.ai Mesh intentionally limits complexity for higher reliability.


2. Core Restrictions (Subset of JSON Schema)

RestrictionRationale
Root must be an objectConsistent structural framing for prompt assembly & grounding
Every field MUST have a descriptionBoosts model accuracy; avoids ambiguous output intent
No oneOf, anyOf, $ref, complex combinatorsKeeps schema cognitively simple for the model; maximum compatibility across model providers

If you feel tempted to add conditional polymorphism, prefer splitting responsibilities into multiple Agents / Output Message Types or adding a discriminant string field.


3. Grounding Extension: x-partite-grounding-config

Add this object to any field to require citations and optional value verification. All properties optional unless noted.

PropertyTypeDefaultPurpose
enabledbooleantrue (if object present)Turns grounding on for the field
minimumCitationCountinteger0Require multiple independent sources (e.g. cross‑checking)
validateTextbooleanfalseEnforce exact match of field value against source text/data
preserveCitationsbooleanfalseKeep inline citation tags in final returned message

When grounding is enabled, the runtime injects citation instructions so the model knows to cite sources for the field. Sources can be tool results or resources.

Grounding in the schema editor

In the schema editor, you can set grounding in Designer mode. Choose a field, select Add a feature, then select grounded. These options are available:

  • “validates cited text” (validateText)
  • “keeps citation tags” (preserveCitations)
  • “at least N citations” (minimumCitationCount)

The editor offers grounding only on response schemas.

Grounding Example

{
  "type": "object",
  "properties": {
    "summary": {
      "type": "string",
      "description": "Concise explanation of the incident"
    },
    "incidentId": {
      "type": "string",
      "description": "Identifier of the incident (must match cited source exactly)",
      "x-partite-grounding-config": {
        "enabled": true,
        "validateText": true
      }
    },
    "rootCause": {
      "type": "string",
      "description": "Likely root cause supported by at least two evidence sources",
      "x-partite-grounding-config": {
        "minimumCitationCount": 2
      }
    }
  },
  "required": ["summary", "incidentId"]
}

Choosing Fields to Ground

Any field that must be constructed from factual information provided by tools or resources should have grounding applied. This will prevent hallucinations by ensuring that all output is rooted in verifiable facts.


4. Resource References (format: "x-partite-ref")

A resource is a reference that a tool returns instead of a result. The agent can then work on the thing itself and does not receive all of it. Files attached to a conversation are resources too.

To accept a resource in a schema, define a property of type: object with format: "x-partite-ref".

At runtime, the agent sees the handle of the resource (r1, r2), its name, its description and its media type. The agent reads the resource with the built-in read_resource tool. Images and documents are shown to the model directly.

Resource Reference Example

{
  "type": "object",
  "properties": {
    "logBundle": {
      "type": "object",
      "format": "x-partite-ref",
      "description": "Reference to the collected application log resource"
    },
    "metricsSnapshot": {
      "type": "object",
      "format": "x-partite-ref",
      "description": "Reference to performance metrics resource"
    },
    "analysis": {
      "type": "string",
      "description": "Interpretation of logs and metrics (include grounded numeric values)"
    }
  },
  "required": ["analysis"]
}

Why Use Resource References?

  • Preserve token budget
  • Enable tool‑mediated inspection (e.g., query subset of dataset)
  • Provide multi‑modal context (e.g., images) cleanly

5. Runtime Grounding & Citation Flow

When a grounded field is returned:

  1. The agent wraps cited text in a <citation> tag with one of text_chunk, tool_call_id or resource (the handle, such as r1). If the source is JSON, json_pointer selects the exact field. json_pointer is required for tool results.
  2. Mesh validates each citation: existence + property presence.
  3. Optional text validation (validateText) checks verbatim match. For numeric values, the cited text may be formatted for display, for example $10,000.00 for 10000.
  4. If any required field fails: the LLM is prompted to correct the output.
  5. Citations stripped or preserved according to preserveCitations.

This enforces factual linkage without forcing raw source content into the prompt, reducing hallucination risk.


6. Authoring Best Practices

PracticeBenefit
Keep schemas minimal initiallyFocus model; add fields only after observing repeated implicit data
Provide concrete, outcome‑oriented descriptionsImproves fill accuracy & reduces rambling
Split large optional areas with minimal overlap into separate Output Message TypesCleaner evolution & versioning
Use multiple Agents instead of polymorphic schemasEnhances parallelization & model right‑sizing

Common Pitfalls

PitfallMitigation
Attempting oneOf style variabilityCreate distinct message types or separate agents
Missing descriptionsAdd concise, specific intent for every field
Grounding everythingLimit to critical facts to avoid noise
Inlining large blobsReturn them from tools as resources and reference them

7. End-to-End Examples

A. Simple Input Schema (Intent Invocation)

{
  "type": "object",
  "properties": {
    "issueText": { "type": "string", "description": "Raw end user problem report" },
    "environment": { "type": "string", "description": "Runtime environment or OS if known" }
  },
  "required": ["issueText"]
}

B. Output Message with Mixed Grounding

{
  "type": "object",
  "properties": {
    "summary": { "type": "string", "description": "Short narrative summary of the issue" },
    "probableCause": { "type": "string", "description": "Likely single root cause with supporting facts", "x-partite-grounding-config": { "minimumCitationCount": 2 } },
    "nextStep": { "type": "string", "description": "Recommended immediate remediation action" },
    "incidentId": { "type": "string", "description": "Incident identifier (must match source)", "x-partite-grounding-config": { "validateText": true } }
  },
  "required": ["summary", "incidentId"]
}

C. Resource-Aware Output

{
  "type": "object",
  "properties": {
    "logRef": { "type": "object", "format": "x-partite-ref", "description": "Reference to aggregated log resource" },
    "screenshot": { "type": "object", "format": "x-partite-ref", "description": "User-provided screenshot resource" },
    "finding": { "type": "string", "description": "Key finding derived from resources" },
    "confidence": { "type": "string", "description": "Qualitative confidence rating (high/medium/low)" }
  },
  "required": ["finding"]
}

8. Summary

Partite Mesh message schemas are lean contracts that keep prompts precise, enable modular agent orchestration, and power grounding + resource integration. Embrace simplicity early, evolve deliberately, and use grounding selectively to enforce trust in critical outputs.