Documentation Index
Fetch the complete documentation index at: https://docs.agentium.in/llms.txt
Use this file to discover all available pages before exploring further.
Tool Polish
defineTool() exposes three additional fields in v2.0 that materially improve reliability and cost.
1. strict: true — guaranteed valid arguments
strict: true:
additionalProperties: falseis appended to the generated JSON Schema, so the LLM cannot send junk extra keys.- For OpenAI-family models,
strict: trueflows through to the API’s structured-output mode, which guarantees the model’s tool call is valid JSON matching your schema (no retries, no parse errors).
- OpenAI strict mode disables certain features (anyOf, default values on optional fields). If your schema fails to compile in strict mode, drop the flag.
- Anthropic / Google providers ignore the strict flag at the API level but the JSON Schema is still tightened, which the model usually respects.
2. inputExamples — N-shot demonstrations
- Tools with enums or specific value formats (timezones, country codes, ISO dates)
- Tools where the LLM tends to over- or under-specify (e.g. always omits an optional field that improves results)
- New tools you don’t have months of usage data on yet
- 3–5 examples is the sweet spot. More doesn’t help and increases prompt cost.
- Show variety, not similarity. The model already understands that strings can vary; show it the kinds of variation that matter.
- Don’t include obvious “bad” examples — the model can latch onto them.
3. toModelOutput — async result transformer
toModelOutput runs BEFORE the artifact auto-converter, so if your transform shrinks the output below the threshold, no pointer is created.
Signature:
ctx gives you access to userId, tenantId, sessionState, eventBus — useful for tenant-aware transforms (redact PII per tenant policy, etc.).
When to use:
- Compress / summarize / redact tool output without modifying the underlying tool
- Convert verbose API responses to LLM-friendly shapes
- Strip secrets that shouldn’t reach the model (API keys, internal IDs)
- A/B test response formats without touching
execute
toModelOutput vs Memory Pointers:
| Scenario | Use |
|---|---|
| You know exactly what fields the LLM needs | toModelOutput |
| You want the LLM to opt-in to expanding the data later | Memory Pointers |
| Both | Stack them: toModelOutput summarizes, then art: wraps if still too big |
Putting it together
toModelOutput keeps the response footprint small.
See also
- Memory Pointer Pattern for outputs that genuinely need to be retrievable in full
- Tool Loop Detection for catching agents stuck in retry loops