ai_claude_agent_sdk
Features
This module integrates Drupal with the Claude Agent SDK (PHP), letting your site interact with Claude Code as an agent runtime. It provides:
NOTE: THIS IS VERY EXPERIMENTAL! IT GIVES ACCESS TO ALL FILES ON YOUR SITE!
We will be making this more locked down but for a long time this is going to be HIGHLY experimental and insecure!
Make use of our (also vibe coded) claude agent sdk php implementation: https://github.com/jamieaa64/claude-agent-sdk-php
- An API bridge for Claude Code’s agent capabilities (chat, tool use, file operations).
- Support for streaming responses (real‑time output).
- Control hooks like interrupt, permission mode changes, and MCP message handling.
- A developer‑friendly integration path for Drupal AI Agents and DeepChat UIs.
Use this module when you want Claude Code inside Drupal for conversational assistants, automated content work, or advanced agent workflows.
The goal is to eventually create an abstraction layer that allows us to connect to different CLIs.
———
Post-Installation
Commands to automate this:
mkdir -p modules
git clone [email protected]:project/ai_claude_agent_sdk.git modules/ai_claude_agent_sdk
bash modules/ai_claude_agent_sdk/scripts/setup-claudeagentsdk-dev.sh
If you want live mode instead of dev mode:
bash modules/ai_claude_agent_sdk/scripts/setup-claudeagentsdk-live.sh
ddev composer require drupal/ai_claude_agent_sdk
ddev setup-claudeagentsdk-dev
If doing this on a live site (Which you shouldn't!)
ddev setup-claudeagentsdk-live
After enabling the module:
1. Configure the Claude Agent SDK connection (CLI path, working directory, permission mode).
2. Ensure Claude Code CLI is available on the server and your API key is set (e.g. ANTHROPIC_API_KEY).
3. If using a UI (e.g. DeepChat), configure the endpoint provided by this module.
4. Clear caches after configuration changes.
The module can run in streaming mode and supports advanced control flows if you enable them.
———
Additional Requirements
- Claude Code CLI installed on the server.
- Claude Agent SDK (PHP) available via Composer or local path repository.
- Valid Anthropic API credentials (e.g. ANTHROPIC_API_KEY environment variable).
———
Recommended modules/libraries
- Drupal AI ecosystem modules (e.g. ai_agents, ai_agent_agent).
- DeepChat integration module if you want a ready‑made chat UI.
- Symfony Process (via Composer) for CLI execution in PHP.
———
Similar projects
Drupal AI provider modules integrate with hosted LLM APIs, but they do not expose Claude Code’s agent runtime, tool chain, or file operations. This module is specifically designed for Claude agents via Claude Code.
———
Supporting this Module
If you’d like to support development, contributions and sponsorship info will be posted here.
———
Community Documentation
Documentation, demos, and walkthroughs will be published here as the project stabilizes.