Concepts
Execute & Retry
The execute endpoint is the core of Reliant. It validates the LLM output against your schema and automatically retries with the exact validation errors when the output is invalid.
How retry works
When the LLM returns an invalid output, Reliant does not simply retry the same prompt. It rewrites the system prompt including the exact validation errors — so the model knows exactly what to fix.
1
First attempt
Reliant calls the LLM with your prompt and the schema as context. Temperature: 0.2.
2
Validation
The output is validated against your JSON Schema. If valid, it is returned immediately.
3
Retry with context
If invalid, Reliant rewrites the prompt with the exact validation errors and retries. Temperature drops to 0.1 on attempt 2 and 0.0 on attempt 3.
4
Safe fallback
If all retries fail, the
safe_fallback defined in the schema is returned with success: false.Example
typescript
const result = await reliant.execute({
prompt: 'Extract data: John Smith, john@email.com, +1-555-0100',
schemaId: 'contact-extraction',
provider: 'anthropic',
model: 'claude-sonnet-4-20250514',
userId: 'your-user-id',
options: {
maxRetries: 3, // default: 3
}
})
if (result.success) {
console.log(result.output)
// { name: 'John Smith', email: 'john@email.com', phone: '+1-555-0100' }
} else {
// safe_fallback was returned
console.log(result.metadata.attempts) // how many attempts were made
}
Response fields
| Field | Type | Description |
|---|---|---|
| success | boolean | Whether the output passed schema validation |
| status | string | SUCCESS, FALLBACK or FAILED |
| output | object | The validated output or safe_fallback |
| metadata.execution_id | string | Unique ID for tracing and debugging |
| metadata.schema_version | number | Schema version used in this execution |
| metadata.attempts | number | Number of attempts made |
| metadata.latency_ms | number | Total latency including all retries |
| metadata.tokens_used | number | Total tokens across all attempts |
| metadata.provider | string | Provider actually used (may differ if fallback provider was triggered) |
Tip: When
metadata.attempts > 1, it means the first attempt failed validation. Check the Dashboard to see the exact validation errors from each attempt.