$npx -y skills add spencermarx/open-code-review --skill agentdb-learningCreate and train AI learning plugins with AgentDB's 9 reinforcement learning algorithms. Includes Decision Transformer, Q-Learning, SARSA, Actor-Critic, and more. Use when building self-learning agents, implementing RL, or optimizing agent behavior through experience.
| 1 | # AgentDB Learning Plugins |
| 2 | |
| 3 | ## What This Skill Does |
| 4 | |
| 5 | Provides access to 9 reinforcement learning algorithms via AgentDB's plugin system. Create, train, and deploy learning plugins for autonomous agents that improve through experience. Includes offline RL (Decision Transformer), value-based learning (Q-Learning), policy gradients (Actor-Critic), and advanced techniques. |
| 6 | |
| 7 | **Performance**: Train models 10-100x faster with WASM-accelerated neural inference. |
| 8 | |
| 9 | ## Prerequisites |
| 10 | |
| 11 | - Node.js 18+ |
| 12 | - AgentDB v1.0.7+ (via agentic-flow) |
| 13 | - Basic understanding of reinforcement learning (recommended) |
| 14 | |
| 15 | --- |
| 16 | |
| 17 | ## Quick Start with CLI |
| 18 | |
| 19 | ### Create Learning Plugin |
| 20 | |
| 21 | ```bash |
| 22 | # Interactive wizard |
| 23 | npx agentdb@latest create-plugin |
| 24 | |
| 25 | # Use specific template |
| 26 | npx agentdb@latest create-plugin -t decision-transformer -n my-agent |
| 27 | |
| 28 | # Preview without creating |
| 29 | npx agentdb@latest create-plugin -t q-learning --dry-run |
| 30 | |
| 31 | # Custom output directory |
| 32 | npx agentdb@latest create-plugin -t actor-critic -o ./plugins |
| 33 | ``` |
| 34 | |
| 35 | ### List Available Templates |
| 36 | |
| 37 | ```bash |
| 38 | # Show all plugin templates |
| 39 | npx agentdb@latest list-templates |
| 40 | |
| 41 | # Available templates: |
| 42 | # - decision-transformer (sequence modeling RL - recommended) |
| 43 | # - q-learning (value-based learning) |
| 44 | # - sarsa (on-policy TD learning) |
| 45 | # - actor-critic (policy gradient with baseline) |
| 46 | # - curiosity-driven (exploration-based) |
| 47 | ``` |
| 48 | |
| 49 | ### Manage Plugins |
| 50 | |
| 51 | ```bash |
| 52 | # List installed plugins |
| 53 | npx agentdb@latest list-plugins |
| 54 | |
| 55 | # Get plugin information |
| 56 | npx agentdb@latest plugin-info my-agent |
| 57 | |
| 58 | # Shows: algorithm, configuration, training status |
| 59 | ``` |
| 60 | |
| 61 | --- |
| 62 | |
| 63 | ## Quick Start with API |
| 64 | |
| 65 | ```typescript |
| 66 | import { createAgentDBAdapter } from 'agentic-flow/reasoningbank'; |
| 67 | |
| 68 | // Initialize with learning enabled |
| 69 | const adapter = await createAgentDBAdapter({ |
| 70 | dbPath: '.agentdb/learning.db', |
| 71 | enableLearning: true, // Enable learning plugins |
| 72 | enableReasoning: true, |
| 73 | cacheSize: 1000, |
| 74 | }); |
| 75 | |
| 76 | // Store training experience |
| 77 | await adapter.insertPattern({ |
| 78 | id: '', |
| 79 | type: 'experience', |
| 80 | domain: 'game-playing', |
| 81 | pattern_data: JSON.stringify({ |
| 82 | embedding: await computeEmbedding('state-action-reward'), |
| 83 | pattern: { |
| 84 | state: [0.1, 0.2, 0.3], |
| 85 | action: 2, |
| 86 | reward: 1.0, |
| 87 | next_state: [0.15, 0.25, 0.35], |
| 88 | done: false |
| 89 | } |
| 90 | }), |
| 91 | confidence: 0.9, |
| 92 | usage_count: 1, |
| 93 | success_count: 1, |
| 94 | created_at: Date.now(), |
| 95 | last_used: Date.now(), |
| 96 | }); |
| 97 | |
| 98 | // Train learning model |
| 99 | const metrics = await adapter.train({ |
| 100 | epochs: 50, |
| 101 | batchSize: 32, |
| 102 | }); |
| 103 | |
| 104 | console.log('Training Loss:', metrics.loss); |
| 105 | console.log('Duration:', metrics.duration, 'ms'); |
| 106 | ``` |
| 107 | |
| 108 | --- |
| 109 | |
| 110 | ## Available Learning Algorithms (9 Total) |
| 111 | |
| 112 | ### 1. Decision Transformer (Recommended) |
| 113 | |
| 114 | **Type**: Offline Reinforcement Learning |
| 115 | **Best For**: Learning from logged experiences, imitation learning |
| 116 | **Strengths**: No online interaction needed, stable training |
| 117 | |
| 118 | ```bash |
| 119 | npx agentdb@latest create-plugin -t decision-transformer -n dt-agent |
| 120 | ``` |
| 121 | |
| 122 | **Use Cases**: |
| 123 | - Learn from historical data |
| 124 | - Imitation learning from expert demonstrations |
| 125 | - Safe learning without environment interaction |
| 126 | - Sequence modeling tasks |
| 127 | |
| 128 | **Configuration**: |
| 129 | ```json |
| 130 | { |
| 131 | "algorithm": "decision-transformer", |
| 132 | "model_size": "base", |
| 133 | "context_length": 20, |
| 134 | "embed_dim": 128, |
| 135 | "n_heads": 8, |
| 136 | "n_layers": 6 |
| 137 | } |
| 138 | ``` |
| 139 | |
| 140 | ### 2. Q-Learning |
| 141 | |
| 142 | **Type**: Value-Based RL (Off-Policy) |
| 143 | **Best For**: Discrete action spaces, sample efficiency |
| 144 | **Strengths**: Proven, simple, works well for small/medium problems |
| 145 | |
| 146 | ```bash |
| 147 | npx agentdb@latest create-plugin -t q-learning -n q-agent |
| 148 | ``` |
| 149 | |
| 150 | **Use Cases**: |
| 151 | - Grid worlds, board games |
| 152 | - Navigation tasks |
| 153 | - Resource allocation |
| 154 | - Discrete decision-making |
| 155 | |
| 156 | **Configuration**: |
| 157 | ```json |
| 158 | { |
| 159 | "algorithm": "q-learning", |
| 160 | "learning_rate": 0.001, |
| 161 | "gamma": 0.99, |
| 162 | "epsilon": 0.1, |
| 163 | "epsilon_decay": 0.995 |
| 164 | } |
| 165 | ``` |
| 166 | |
| 167 | ### 3. SARSA |
| 168 | |
| 169 | **Type**: Value-Based RL (On-Policy) |
| 170 | **Best For**: Safe exploration, risk-sensitive tasks |
| 171 | **Strengths**: More conservative than Q-Learning, better for safety |
| 172 | |
| 173 | ```bash |
| 174 | npx agentdb@latest create-plugin -t sarsa -n sarsa-agent |
| 175 | ``` |
| 176 | |
| 177 | **Use Cases**: |
| 178 | - Safety-critical applications |
| 179 | - Risk-sensitive decision-making |
| 180 | - Online learning with exploration |
| 181 | |
| 182 | **Configuration**: |
| 183 | ```json |
| 184 | { |
| 185 | "algorithm": "sarsa", |
| 186 | "learning_rate": 0.001, |
| 187 | "gamma": 0.99, |
| 188 | "epsilon": 0.1 |
| 189 | } |
| 190 | ``` |
| 191 | |
| 192 | ### 4. Actor-Critic |
| 193 | |
| 194 | **Type**: Policy Gradient with Value Baseline |
| 195 | **Best For**: Continuous actions, variance reduction |
| 196 | **Strengths**: Stable, works for continuous/discrete actions |
| 197 | |
| 198 | ```bash |
| 199 | npx agentdb@latest create-plugin -t actor-critic -n ac-agent |
| 200 | ``` |
| 201 | |
| 202 | **Use Cases**: |
| 203 | - Continuous control (robotics, simulations) |
| 204 | - Complex action spaces |
| 205 | - Multi-agent coordination |
| 206 | |
| 207 | **Configuration**: |
| 208 | ```json |
| 209 | { |
| 210 | "algorithm": "actor-critic", |
| 211 | "actor_lr": 0.0 |