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:
- Design goals & why a subset
- Core restrictions
- Grounding extensions (
x-partite-grounding-config) - Resource references (
format: "x-partite-ref") - Runtime grounding and citation flow
- Authoring best practices & common pitfalls
- 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)
| Restriction | Rationale |
|---|---|
Root must be an object | Consistent structural framing for prompt assembly & grounding |
Every field MUST have a description | Boosts model accuracy; avoids ambiguous output intent |
No oneOf, anyOf, $ref, complex combinators | Keeps 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.
| Property | Type | Default | Purpose |
|---|---|---|---|
enabled | boolean | true (if object present) | Turns grounding on for the field |
minimumCitationCount | integer | 0 | Require multiple independent sources (e.g. cross‑checking) |
validateText | boolean | false | Enforce exact match of field value against source text/data |
preserveCitations | boolean | false | Keep 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:
- The agent wraps cited text in a
<citation>tag with one oftext_chunk,tool_call_idorresource(the handle, such asr1). If the source is JSON,json_pointerselects the exact field.json_pointeris required for tool results. - Mesh validates each citation: existence + property presence.
- Optional text validation (
validateText) checks verbatim match. For numeric values, the cited text may be formatted for display, for example$10,000.00for10000. - If any required field fails: the LLM is prompted to correct the output.
- 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
| Practice | Benefit |
|---|---|
| Keep schemas minimal initially | Focus model; add fields only after observing repeated implicit data |
| Provide concrete, outcome‑oriented descriptions | Improves fill accuracy & reduces rambling |
| Split large optional areas with minimal overlap into separate Output Message Types | Cleaner evolution & versioning |
| Use multiple Agents instead of polymorphic schemas | Enhances parallelization & model right‑sizing |
Common Pitfalls
| Pitfall | Mitigation |
|---|---|
Attempting oneOf style variability | Create distinct message types or separate agents |
| Missing descriptions | Add concise, specific intent for every field |
| Grounding everything | Limit to critical facts to avoid noise |
| Inlining large blobs | Return 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.