| Crates.io | kodegen_claude_agent |
| lib.rs | kodegen_claude_agent |
| version | 0.10.9 |
| created_at | 2025-11-03 16:24:15.904617+00 |
| updated_at | 2026-01-02 15:17:17.027604+00 |
| description | KODEGEN.ᴀɪ: Memory-efficient, Blazing-Fast, MCP tools for code generation agents. |
| homepage | https://kodegen.ai |
| repository | https://github.com/cyrup-ai/kodegen-claude-agent |
| max_upload_size | |
| id | 1914943 |
| size | 4,303,686 |
Memory-efficient, blazing-fast MCP tools for Claude Code agent delegation.
Build powerful multi-agent systems by spawning and orchestrating Claude agent sub-sessions. This Rust SDK and MCP server enables sophisticated delegation patterns where Claude instances can spawn, manage, and communicate with other Claude agents.
This project provides both:
| Tool | Description |
|---|---|
claude_spawn_agent |
Create a new Claude agent sub-session with configurable options |
claude_send_agent_prompt |
Send a prompt to an existing agent session |
claude_read_agent_output |
Read messages and responses from an agent session |
claude_list_agents |
List all active and completed agent sessions |
claude_terminate_agent_session |
Gracefully terminate an agent session |
rust-toolchain.toml)npm install -g @anthropic-ai/claude-code# Clone the repository
git clone https://github.com/cyrup-ai/kodegen-claude-agent.git
cd kodegen-claude-agent
# Build the project
cargo build --release
# Run tests
cargo test
# Build the HTTP server
cargo build --release --bin kodegen-claude-agent
The HTTP server is typically managed by the kodegend daemon and runs on port 30460:
# Start the server
cargo run --bin kodegen-claude-agent
Add to your Cargo.toml:
[dependencies]
kodegen_claude_agent = "0.1"
use kodegen_claude_agent::query;
use futures::StreamExt;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let stream = query("What is 2 + 2?", None).await?;
let mut stream = Box::pin(stream);
while let Some(message) = stream.next().await {
match message? {
kodegen_claude_agent::Message::Assistant { message, .. } => {
println!("Claude: {:?}", message);
}
_ => {}
}
}
Ok(())
}
use kodegen_claude_agent::{ClaudeSDKClient, ClaudeAgentOptions};
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let options = ClaudeAgentOptions::builder()
.max_turns(10)
.build();
let mut client = ClaudeSDKClient::new(options, None).await?;
client.send_message("Hello, Claude!").await?;
while let Some(message) = client.next_message().await {
// Process messages...
}
client.close().await?;
Ok(())
}
use kodegen_claude_agent::{AgentManager, PromptInput};
use std::sync::Arc;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let manager = Arc::new(AgentManager::new());
// Spawn an agent
let request = SpawnSessionRequest {
prompt: PromptInput::String("What is the capital of France?".to_string()),
options: ClaudeAgentOptions::default(),
};
let response = manager.spawn_session(request).await?;
let session_id = &response.session_ids[0];
// Read output
let output = manager.get_session_output(session_id, 0, 100).await?;
println!("Messages: {:?}", output.output);
// Send follow-up
manager.send_prompt(
session_id,
PromptInput::String("What is its population?".to_string())
).await?;
// List all sessions
let sessions = manager.list_sessions().await?;
println!("Active: {}, Completed: {}",
sessions.total_active, sessions.total_completed);
// Cleanup
manager.terminate_session(session_id).await?;
Ok(())
}
Run the comprehensive demo:
cargo run --example claude_agent_demo
The demo showcases:
cargo doc --open for full API documentationexamples/ directory for working code samplestests/ directory for integration test patterns# All tests
cargo test
# Specific test suite
cargo test --test client_tests
# With debug output
RUST_LOG=debug cargo test -- --nocapture
# Lint with clippy
cargo clippy
# Format code
cargo fmt
# Check formatting
cargo fmt -- --check
kodegen-claude-agent/
├── src/
│ ├── client/ # Interactive bidirectional client
│ ├── manager/ # Agent session management
│ ├── tools/ # MCP tool implementations
│ ├── transport/ # Communication layer (subprocess)
│ ├── control/ # Control protocol handler
│ ├── types/ # Type-safe abstractions
│ ├── hooks/ # Hook system
│ ├── permissions/ # Permission control
│ ├── message/ # Message parsing
│ ├── query.rs # Simple query function
│ ├── error.rs # Error types
│ ├── lib.rs # SDK library
│ └── main.rs # HTTP server binary
├── tests/ # Integration tests
├── examples/ # Usage examples
└── Cargo.toml
This SDK includes multiple security layers:
LD_PRELOAD, PATH, NODE_OPTIONS)max_turns ≤ 1000)For complete security details, see SECURITY_FIXES_APPLIED.md in the repository.
rust-toolchain.toml)Contributions are welcome! Please ensure:
cargo clippycargo fmtcargo testDual-licensed under Apache 2.0 OR MIT.
See LICENSE.md for details.
Part of the KODEGEN.ᴀɪ ecosystem for AI-powered development tools.
Authors: David Maple / KODEGEN.ᴀɪ
Built with ❤️ using Rust 🦀