sweihub

AI Agent — AI skill for Claude Code

AI community

Idiomatic agent sdk inspired by the claude code source leak.

How to install AI Agent

This entry records only its repository, not the path inside it, so there is no exact command to give. Open sweihub/ai-agent and copy the folder into ~/.claude/skills/, or the file into ~/.claude/agents/.

What AI Agent does

Idiomatic agent sdk inspired by the claude code source leak.

Alternatives in AI

  • Opencodex — Universal provider proxy for OpenAI Codex & Claude Code — use any LLM (Claude, Gemini, Grok, DeepSeek, Ollama… 12.3k ★
  • Axonhub — ⚡️ Open-source AI Gateway — Use any SDK to call 100+ LLMs 3.2k ★
  • Agent Rules Books — AGENTS.md rules / skills for AI coding agents: Codex, Cursor & Claude Code 2.6k ★

README

AI Agent SDK (Claude Code SDK in Rust)

[![Crates.io](https://img.shields.io/crates/v/ai-agent)](https://crates.io/crates/ai-agent) [![Rust](https://img.shields.io/badge/rust-%3E%3D1.70-blue)](https://www.rust-lang.org) [![License: MIT](https://img.shields.io/badge/license-MIT-blue)](./LICENSE)

[English](README.md) | [中文](READCN.md)

Idiomatic Rust SDK — 1:1 translation of Claude Code. Runs the full agent loop **in-process** with 50 built-in tools. Deploy anywhere: cloud, serverless, Docker, CI/CD.

AI Coding CLI: [ai-code](https://github.com/sweihub/ai-code)

Quick Start

cargo add ai-agent
export AI_AUTH_TOKEN=your-api-key
export AI_MODEL=MiniMaxAI/MiniMax-M2.5
use ai_agent::Agent;

// Simple one-shot query
let answer = Agent::prompt("claude-sonnet-4-6", "List 10 files").await?;

// Full agent with builder pattern
let agent = Agent::new("claude-sonnet-4-6")
    .max_turns(10);
let result = agent.query("List 10 files").await?;

See [Usage Examples](#usage-examples) for more.

Core Features

Feature Description
Agent Create agents with custom models, tools, and prompts
Subagent Spawn subagents for parallel or specialized tasks
Session Persist, resume, fork conversations on disk
Context Compact Automatic conversation summarization when approaching context limits
Skills Load external skills or use 15+ bundled skills
Hooks 29 lifecycle events with 4 hook types (shell, HTTP, prompt, agent), parallel execution, if conditions
Tools 50 built-in tools across 15 categories (File Ops, Discovery, Shell, Web, LSP, Multi-agent, Tasks, Planning, User Interaction, Scheduling, Git, Skills, MCP, Remote, Communication)
Memory File-based persistent context via MEMORY.md
Permissions Tool access control with allow/deny rules
Plugins Load plugins with commands, skills, MCP servers
MCP Connect to Model Context Proto