Reactive Agents

xAI Provider

Complete guide to using xAI Grok with Reactive Agents, including configuration, authentication, and advanced features

Reactive Agents provides seamless integration with xAI's API, supporting Grok models for chat completions, reasoning, and advanced AI tasks.

Authentication & Configuration

Setup

  1. Get your xAI API key from xAI Console
  2. Add your API key in the Reactive Agents dashboard under AI Providers
  3. Configure your preferred Grok models in the Models section

Basic Usage

const response = await fetch('http://localhost:3000/v1/chat/completions', {
  method: 'POST',
  headers: {
    'Authorization': `Bearer ${process.env.BEARER_TOKEN ?? 'reactive-agents'}`,
    'Content-Type': 'application/json',
    'ra-config': JSON.stringify({
      agent_name: 'grok-agent',
      skill_name: 'reasoning',
      strategy: { mode: 'single' },
      targets: [{ optimization: 'auto' }]
    })
  },
  body: JSON.stringify({
    model: 'grok-4',
    messages: [
      { role: 'user', content: 'Explain the latest developments in AI' }
    ]
  })
});

Troubleshooting

Authentication Errors (401): Verify your API key is correct and has sufficient credits Rate Limit Errors (429): Reactive Agents automatically handles retries; consider upgrading your xAI plan Model Not Found (404): Verify the model name is correct and your account has access