Flow
- User A sends a message in English.
- App calls
/v1/parseto get a GlyphIR block. - App stores a trail event for the conversation.
- App calls
/v1/realizeto produce a Chinese view for User B. - Reverse for Chinese → English replies.
Examples
These examples show how to use EarthCloud as a middle layer between your app and your models: for cross-language chat, support tooling, and trails.
Example 01
A chat app (like Buoychong) wants to let English and Chinese speakers talk naturally while keeping a shared sense of intent and tone.
/v1/parse to get a GlyphIR block./v1/realize to produce a Chinese view for User B./v1/parse// Pseudo-code (TypeScript) for sending a turn to EarthCloud
const request = {
request_id: "req_01HX...",
session_id: "chat_abc",
user_id: "user_en",
turn: {
role: "user",
text: "Let's meet tomorrow at 3pm Beijing time.",
lang: "en",
tone_hint: "casual",
target_langs: ["zh-CN"]
}
};
const response = await fetch("https://earthcloud.example.com/v1/parse", {
method: "POST",
headers: {
"Content-Type": "application/json",
"Authorization": "Bearer <token>"
},
body: JSON.stringify({ request })
});
const { glyphir_block, trail_event } = await response.json();
// Store trail_event and pass glyphir_block downstream for realization.// Using the glyphir_block from /parse
const realizeRes = await fetch("https://earthcloud.example.com/v1/realize", {
method: "POST",
headers: {
"Content-Type": "application/json"
},
body: JSON.stringify({
glyphir_block,
target_langs: ["zh-CN"],
tone_overrides: {
"zh-CN": { politeness: "polite" }
}
})
});
const { realization_result } = await realizeRes.json();
const messageForChineseUser = realization_result.realizations[0].text;Example 02
A support inbox tool wants to summarize incoming tickets and propose responses in the agent's language, while keeping a trail of what the model saw and proposed.
/v1/parse with ticket text + metadata./v1/route (e.g. use support-model, call specific tools)./v1/realize to produce a response in the agent's language.const request = {
request_id: "req_ticket_123",
session_id: "ticket_123",
user_id: "end_user_987",
turn: {
role: "user",
text: "The app keeps crashing when I upload a file over 10MB.",
lang: "en",
tone_hint: "neutral",
safety_context: ["support"]
},
context: {
page_title: "Support ticket #123",
tags: ["plan:pro", "platform:web"]
}
};Example 03
A more advanced integration uses ChatCard for "who" (persona, preferences, permissions) and EarthCloud for "what" and "how" (intent, realizations, trails).
On the RP side, the app verifies the ChatCard token, then forwards both the persona and the text to EarthCloud:
// Pseudo-code: using ChatCard + EarthCloud together
const chatcardProfile = verifyChatCardToken(chatcardToken);
const ecRequest = {
request_id: "req_01HX...",
session_id: "chat_earthcloud",
user_id: chatcardProfile.sub,
turn: {
role: "user",
text: userMessage,
lang: chatcardProfile.persona.primary_language,
tone_hint: chatcardProfile.persona.tone,
target_langs: decideTargetLangs(chatcardProfile)
},
context: { ... }
};
const { glyphir_block } = await callEarthCloudParse(ecRequest);
// Downstream, you can also tag trail events with chatcardProfile.card_id.Example 04
If you use Tongbuku as your storage engine, EarthCloud's trail events can map directly onto Tongbuku's trails abstraction.
trail_id → Tongbuku trail/document ID.event_id → Tongbuku event ID.payload → Tongbuku event payload.// Pseudo-code: append trail event to Tongbuku
const trailEvent = {
event_id: "evt_01JK...",
trail_id: "conversation_abc",
kind: "turn",
timestamp: new Date().toISOString(),
request_id: ecRequest.request_id,
glyphir_id: glyphir_block.glyphir_id,
actors: {
user_id: ecRequest.user_id,
app_id: ecRequest.app_id
},
summary: { ... },
payload: { ... }
};
await tongbuku.append(trailEvent);Patterns
Some patterns that work well with EarthCloud:
Reach out to us at info@earthcloud.co