Appearance
Transform and translation
A transform agent maps text or JSON to text or JSON in one call: translation, rewriting, summarizing, tone changes, CV improvement, question generation. It works like an extraction agent (same settings, same endpoint); the difference is intent, and an output schema is optional.
Text in, text out
Without an outputSchema the result is { "text": "..." }.
Instructions:
text
Translate the user's text into {{targetLanguage}}. Keep the formatting (Markdown, line breaks).
Do not add explanations.Input schema (optional, rejects malformed requests with 400 INPUT_INVALID):
json
{
"type": "object",
"properties": {
"text": { "type": "string" },
"targetLanguage": { "type": "string" }
},
"required": ["text", "targetLanguage"]
}bash
curl "$HEVKAR_BASE_URL/v1/agents/translator/runs" \
-H "Authorization: Bearer $HEVKAR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"input": {"text": "Ihr Paket wurde versandt.", "targetLanguage": "English"}}'ts
const r = await hevkar.agents.run('translator', {
input: { text: 'Ihr Paket wurde versandt.', targetLanguage: 'English' },
});
console.log((r.output as { text: string }).text); // "Your parcel has been shipped."ts
const r = await fetch(`${baseUrl}/v1/agents/translator/runs`, {
method: 'POST',
headers: { Authorization: `Bearer ${apiKey}`, 'Content-Type': 'application/json' },
body: JSON.stringify({
input: { text: 'Ihr Paket wurde versandt.', targetLanguage: 'English' },
}),
}).then((res) => res.json());
console.log(r.output.text);When the input has more than one field (as here), the model receives the whole input as JSON and the instructions tell it which field to use. With a single string field the model receives just that string.
JSON in, JSON out
To translate JSON while keeping its structure (for example UI strings), send the object in the input and give the agent an outputSchema with the same shape, or a generic one:
json
{
"type": "object",
"properties": {
"strings": { "type": "object", "additionalProperties": { "type": "string" } }
},
"required": ["strings"]
}ts
const r = await hevkar.agents.run('json-translator', {
input: {
targetLanguage: 'Arabic',
strings: { 'cart.empty': 'Your cart is empty', 'cart.checkout': 'Check out' },
},
});
// r.output: { strings: { 'cart.empty': '...', 'cart.checkout': '...' } }Streaming
Transform output can be long. With stream: true (or hevkar.agents.stream) you receive the text as it is generated; see Streaming.
ts
const stream = hevkar.agents.stream('rewriter', { input: { text: draft } });
for await (const e of stream) if (e.event === 'text.delta') process.stdout.write(e.data.text);Model settings
model.temperature (0 to 2) controls variation: keep it low for translation, higher for creative rewriting. model.maxOutputTokens caps the length; model.reasoningEffort (low, medium, high) applies to models that support it. See Agent configuration.