Tool Definitions
Minimal (No Schema)
Use when you trust the model and want minimal overhead:With Full Validation
Recommended for production systems:System Prompt Pattern
Clear, concise tool documentation for LLMs:Agent Patterns
ReAct Loop
Reason and Act pattern with GLYPH state:Multi-Agent Coordination
Using stream IDs for agent communication:Checkpoint / Resume Pattern
Safe state persistence:State Management
Simple: Full State Per Message
Best for short sessions:Advanced: Patches with Verification
Optimal for long-running agents:Progress Reporting
Non-intrusive status updates:Anti-Patterns
Don’t: Parse with Regex
Don’t: Validate After Full Generation
Don’t: Send Full State Every Turn
Don’t: Inline Large Data
Best Practices
Streaming Validation Decision Tree
| Condition | Action |
|---|---|
| Unknown tool name | Cancel at token ~3-5 |
| Wrong argument type | Cancel when type detected |
| Constraint violation | Cancel when value complete |
| Missing required arg | Wait until } then error |
Token Efficiency Guidelines
High-value scenarios for GLYPH:- System prompts with tool definitions (sent every request)
- Conversation history (grows over time)
- Batch operations (thousands of records)
- Multi-turn agents (state persisted across calls)
| Pattern | JSON | GLYPH | Savings |
|---|---|---|---|
| Tool call | 42 | 28 | 33% |
| Tool list (5 tools) | 180 | 95 | 47% |
| Agent state (small) | 120 | 75 | 38% |
| Agent state (large) | 500 | 290 | 42% |
| Tabular data (10 rows) | 320 | 145 | 55% |
State Management Guidelines
Use full state when:- Sessions are short (< 10 turns)
- State is small (< 1KB)
- Simplicity is more important than efficiency
- Long-running sessions (> 10 turns)
- State grows over time
- Multiple agents share state
- Network bandwidth is limited
Error Handling
Graceful degradation:Production Checklist
- Use streaming validation for all tool calls
- Implement checkpoint/resume for long tasks
- Add state hash verification for multi-agent systems
- Use tabular mode for homogeneous lists (>3 items)
- Monitor token savings with analytics
- Add fallback parsing for malformed outputs