AI Features Overview
What "AI-Native" Means in UDIOT
UDIOT describes itself as AI-native because AI capabilities are built into the framework's architecture rather than added as an afterthought. The AI features operate on framework primitives — stores, actions, middleware pipelines — without requiring you to change how you write application code. You add @AIPowered to a store and the framework automatically intercepts dispatches to feed data to the analyzer, optimizer, and predictor.
This is different from frameworks that offer an "AI plugin" that you wire in manually. In UDIOT, the AI layer observes the application through the same hooks (dispatch interception, action history, state diffs) that DevTools and telemetry use.
Key AI Features
| Feature | Class | Purpose |
|---|---|---|
| Agent runtime | LLMClient, AgentRunner, AgentLoop |
Observable LLM calls, typed agent steps, and bounded multi-step workflows |
| Tool registry | ToolBox |
Registers typed tools that models can invoke during an agent run |
| State analysis | StateAnalyzer |
Scores state structure quality; identifies issues and suggestions |
| Performance optimization | AIOptimizer / AutoOptimizer |
Analyzes action latencies and recommends batching, memoization, debouncing |
| Prediction & anomaly detection | AIPredictor |
Predicts next actions and state changes; flags statistical anomalies |
| Code generation | udiot create (CLI) |
Generates components, services, controllers, events and handlers from a description with a configured model |
| Type-aware generation (internal) | TypeAwareGenerator |
Not a public npm export; internal CRUD templates require implementation |
| AI decorator layer | @AIPowered |
Wires all AI features into a store with a single decorator |
How AI Features Work
The rule-based analysis features (StateAnalyzer, AIOptimizer, AIPredictor) run entirely locally. They use heuristics and statistical methods on in-process data — no network calls, no API key required.
Model-backed code generation is the CLI's udiot create. New provider-backed integrations should use the @tagna/udiot/agents entry point. It provides OpenAI and Anthropic providers, retry/backoff, token accounting (and cost with your own price table), streaming, structured output, tool-use loops, and run-event telemetry. Anthropic support is optional; install @anthropic-ai/sdk in the consuming app before using provider: 'anthropic'.
import { AgentRunner, createLLMClient } from '@tagna/udiot/agents';
import { z } from 'zod';
const llm = createLLMClient({ provider: 'anthropic' });
const reviewer = new AgentRunner({
name: 'reviewer',
systemPrompt: 'Return JSON with one risk and one recommendation.',
outputSchema: z.object({
risk: z.string(),
recommendation: z.string(),
}),
model: 'claude-haiku-4-5',
llm,
});
const result = await reviewer.run('Evaluate this middleware pipeline...');
AIClient remains available at the package root for compatibility:
import { AIClient, createAIClient } from '@tagna/udiot';
It now delegates to the v0.16 LLMClient and is deprecated for new code. Configure generative clients with provider API keys via environment variables:
UDIOT_AI_KEY— UDIOT-specific key (checked first)OPENAI_API_KEY— falls back to this if the former is absentANTHROPIC_API_KEY— used by the Anthropic provider
Graceful Degradation
AI features are optional at every level:
- No API key configured —
StateAnalyzer,AIOptimizer, andAIPredictorstill function fully (they do not require network access). Only generative features that require an external model will degrade. @AIPowerednot applied — stores work exactly as without the decorator; callinggetAnalyzer(store)returnsundefined.- AI feature disabled in config — pass
enableStatePrediction: false,enableAnomalyDetection: false, etc. to their respective config objects to turn individual capabilities off.
Quick Architecture Diagram
Your Store (@AIPowered)
│
├─── dispatch() ──── @AIPowered interceptor
│ │
│ ┌────────────────┼────────────────┐
│ │ │ │
│ StateAnalyzer AIOptimizer AIPredictor
│ (structure & (latency & (patterns &
│ issues) suggestions) anomalies)
│
└─── @EnableDevTools ─── Redux DevTools / Inspector
Next Steps
- Agent Runtime — LLM clients, agent runners, loops, tools, and migration from
AIClient - StateAnalyzer — state structure analysis and scoring
- AIOptimizer — performance profiling and optimization suggestions
- AIPredictor — state prediction and anomaly detection
- Component Generation — generating components from descriptions
- AI Decorators —
@AIPoweredand helper functions