AgentSkillsCN

Public

公开

SKILL.md

tinycrab

Spawn AI agents fast. For testing, prototyping, or when you just need an agent running now.

Install

bash
npm install -g tinycrab

Or as a dependency:

bash
npm install tinycrab

Usage

CLI

bash
# 1. Set API key
export OPENAI_API_KEY=sk-xxx

# 2. Spawn an agent (this starts an HTTP server for this agent)
tinycrab spawn worker

# 3. Chat with it
tinycrab chat worker "Create a Python script that reads CSV files"

# 4. Continue the conversation (use session ID from previous response)
tinycrab chat worker "Now add error handling" -s <session-id>

# 5. Clean up when done
tinycrab cleanup worker

SDK

typescript
import { Tinycrab } from 'tinycrab';

const tc = new Tinycrab({
  apiKey: process.env.OPENAI_API_KEY,
});

// Spawn agent
const agent = await tc.agent('worker');

// Chat
const result = await agent.chat('Create a Python script');
console.log(result.response);
console.log(result.sessionId); // save this for follow-up

// Continue conversation
await agent.chat('Add error handling', { sessionId: result.sessionId });

// Clean up
await agent.destroy({ cleanup: true });

HTTP API

First, spawn an agent (via CLI or SDK). Then call its HTTP endpoint:

bash
# Spawn first (this starts HTTP server on a port, e.g., 9000)
tinycrab spawn worker
# Output: Server running on port 9000

# Then call HTTP
curl -X POST http://localhost:9000/chat \
  -H "Content-Type: application/json" \
  -d '{"message": "Hello"}'

# Response: {"response": "...", "session_id": "abc123"}

Or run standalone with Docker:

bash
docker run -p 8080:8080 -e OPENAI_API_KEY=sk-xxx ghcr.io/jt-wang/tinycrab

What Agents Can Do

Each agent has these tools (from pi-mono):

ToolDescription
bashRun shell commands
readRead files
writeCreate/overwrite files
editEdit existing files
grepSearch file contents
findFind files
lsList directories

Plus tinycrab-specific:

  • remember / recall - Persistent memory across sessions

CLI Commands

CommandDescription
tinycrab spawn <name>Create agent, start its HTTP server
tinycrab chat <name> "msg"Send message
tinycrab chat <name> "msg" -s <id>Continue session
tinycrab chat <name> -iInteractive mode
tinycrab listList agents
tinycrab stop <name>Stop (keep files)
tinycrab cleanup <name>Delete agent and files

API Reference

POST /chat

json
// Request
{"message": "your message", "session_id": "optional"}

// Response
{"response": "agent response", "session_id": "abc123"}

GET /health

Returns {"status": "ok"}

LLM Providers

Set via environment variable:

ProviderEnv Var
OpenAI (default)OPENAI_API_KEY
AnthropicANTHROPIC_API_KEY
GoogleGEMINI_API_KEY
GroqGROQ_API_KEY
MistralMISTRAL_API_KEY
XAIXAI_API_KEY
OpenRouterOPENROUTER_API_KEY
CerebrasCEREBRAS_API_KEY

Links