Skip to content

Conversation

@bigph00t
Copy link

@bigph00t bigph00t commented Jan 8, 2026

Summary

  • Adds support for running Ralph Loop Agent without an API key by using the official @anthropic-ai/claude-agent-sdk
  • The SDK spawns Claude Code as a subprocess, authenticating with the user's Claude Max subscription
  • Implements a new provider at ralph-loop-agent/providers/claude-code

Benefits

  • No API key required - Uses Claude Max subscription directly
  • Full Claude Code tools - Access to Bash, Read, Edit, Grep, Glob, etc.
  • Permission control - Auto-accept edits or prompt for approval
  • Cost tracking - See usage (covered by subscription, not billed separately)

Usage

import { runWithClaudeCode } from 'ralph-loop-agent/providers/claude-code';

const result = await runWithClaudeCode({
  prompt: 'Fix all TypeScript errors',
  maxTurns: 10,
  permissionMode: 'acceptEdits',
  
  verifyCompletion: ({ text }) => ({
    complete: text.includes('All errors fixed'),
  }),
  
  onTurnStart: ({ turn }) => console.log(`Turn ${turn}`),
});

console.log(`Completed: ${result.completionReason}`);
console.log(`Cost: $${result.cost} (covered by subscription)`);

Installation

npm install ralph-loop-agent @anthropic-ai/claude-agent-sdk
claude auth login  # Authenticate with Claude

Test plan

  • Install optional dependency @anthropic-ai/claude-agent-sdk
  • Run runWithClaudeCode() with a simple task
  • Verify turns, completion, and cost tracking work
  • Test permission modes (default, acceptEdits, bypassPermissions)

🤖 Generated with Claude Code

This adds support for running Ralph Loop Agent without an API key by using
the official @anthropic-ai/claude-agent-sdk package. The SDK spawns Claude
Code as a subprocess, authenticating with the user's Claude account.

Benefits:
- No API key required - uses Claude Max subscription
- Full access to Claude Code's built-in tools (Bash, Read, Edit, etc.)
- Permission control (auto-accept edits or prompt for approval)
- Cost tracking (covered by subscription, not billed separately)

Usage:
```typescript
import { runWithClaudeCode } from 'ralph-loop-agent/providers/claude-code';

const result = await runWithClaudeCode({
  prompt: 'Fix all TypeScript errors',
  maxTurns: 10,
  verifyCompletion: ({ text }) => ({
    complete: text.includes('All errors fixed'),
  }),
});
```

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant