claude-agent-server  by dzhng

Control Claude Agent via WebSocket server

Created 1 week ago

New!

436 stars

Top 68.2% on SourcePulse

GitHubView on GitHub
Project Summary

Summary

This project provides a WebSocket server designed to sandbox and control the Claude Agent SDK, enabling real-time, bidirectional communication. It targets developers seeking to integrate Claude's advanced AI capabilities into their applications, particularly within isolated E2B environments. The primary benefit is offering a controlled, interactive, and sandboxed AI agent experience that can be programmatically managed.

How It Works

The core architecture utilizes a Bun-based WebSocket server that acts as a direct relay between a single client connection and the Claude Agent SDK. This server can be deployed as an E2B sandbox template, spinning up an isolated execution environment. The server manages message queuing, SDK processing, and relays responses back to the connected client. Configuration for system prompts, allowed tools, and models can be dynamically pushed via a /config HTTP endpoint or specified through client options, with the SDK stream initializing lazily upon the first client connection.

Quick Start & Requirements

Setup begins with creating a .env file, populating it with ANTHROPIC_API_KEY and E2B_API_KEY, followed by bun install. Deploying the server as an E2B sandbox template is accomplished using bun run build:e2b, a process that may take several minutes. Integration into user projects requires installing the client library (npm install @dzhng/claude-agent or bun add @dzhng/claude-agent) and connecting via TypeScript. Essential prerequisites include the Bun runtime, Node.js/npm, and the aforementioned API keys.

Highlighted Details

  • Seamless integration with E2B sandboxes for isolated Claude Agent execution.
  • Enables real-time, bidirectional communication via WebSockets.
  • Provides a dedicated TypeScript client library (@dzhng/claude-agent) for simplified interaction.
  • Supports dynamic configuration of agent behavior, including system prompts, allowed tools, and models.
  • Organized in a monorepo structure with distinct packages for server, client, and E2B build scripts.

Maintenance & Community

The provided README does not detail specific contributors, community channels (like Discord or Slack), or a public roadmap.

Licensing & Compatibility

The project is released under the permissive MIT license. This license generally allows for commercial use and integration into closed-source projects without significant restrictions.

Limitations & Caveats

The server architecture enforces a single active WebSocket connection at any given time; subsequent connection attempts will be rejected. Successful deployment and operation necessitate valid Anthropic and E2B API keys. The project relies on the Bun runtime for its server and build processes.

Health Check
Last Commit

1 week ago

Responsiveness

Inactive

Pull Requests (30d)
0
Issues (30d)
0
Star History
436 stars in the last 12 days

Explore Similar Projects

Starred by Eric Zhu Eric Zhu(Coauthor of AutoGen; Research Scientist at Microsoft Research), Malte Pietsch Malte Pietsch(Cofounder of deepset), and
5 more.

ag-ui by ag-ui-protocol

1.6%
10k
Protocol for agent-user interaction in frontends
Created 6 months ago
Updated 2 days ago
Feedback? Help us improve.