{"_id":"@elizaos/sweagent","_rev":"4-39fa63ae3b086bbb42f5c00b736fb0c5","name":"@elizaos/sweagent","dist-tags":{"latest":"1.1.0"},"versions":{"1.1.0":{"name":"@elizaos/sweagent","version":"1.1.0","keywords":["software-engineering","agent","ai","automation","development-tools","swe-agent","elizaos"],"author":{"name":"ElizaOS"},"license":"MIT","_id":"@elizaos/sweagent@1.1.0","maintainers":[{"name":"shawticus","email":"shawmakesmagic@gmail.com"},{"name":"shakkernerd","email":"shakkerdroid@gmail.com"},{"name":"wtfsayo","email":"hi@sayo.wtf"},{"name":"odilitime","email":"janesmith@airmail.cc"},{"name":"cjft","email":"cjft@trimboli.io"}],"homepage":"https://github.com/elizaos/eliza/tree/main/packages/sweagent#readme","bugs":{"url":"https://github.com/elizaos/eliza/issues"},"bin":{"sweagent":"dist/run/cli.js"},"dist":{"shasum":"dcf0b32d966c0cc6a7e5332ced6d40c018576de2","tarball":"https://registry.npmjs.org/@elizaos/sweagent/-/sweagent-1.1.0.tgz","fileCount":244,"integrity":"sha512-7i3KosEfxgZ2xu3X8ig/SYu4WnSNfrmrgB1JEGyavQDDrMFO6x+K/GtUn5RvQpr7ipywvi1JudhQt3VDHI990A==","signatures":[{"sig":"MEUCIQDI5LYNGE4ez7uPsGaM0yg0MDhNYEePOEE6u4QuEqNTYQIgANQd91mVud7MkphRLgVAn+MyrYPMTUjaO1oucavmsb4=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":1825194},"main":"dist/index.js","type":"module","types":"dist/index.d.ts","engines":{"node":">=18.0.0"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","default":"./dist/index.js"},"./package.json":"./package.json"},"gitHead":"1042448ae18b8ace12fd3274caabfd6405bb695f","scripts":{"dev":"ts-node src/index.ts","lint":"bunx @biomejs/biome check --write .","test":"vitest run","build":"bun run build.ts && cd tools && bun run build","clean":"rm -rf dist coverage","rules":"ts-node src/rules/cli.ts","format":"bunx @biomejs/biome format --write .","typecheck":"tsc --noEmit","lint:check":"bunx @biomejs/biome check .","rules:info":"ts-node src/rules/cli.ts info","test:watch":"vitest","format:check":"bunx @biomejs/biome format .","rules:export":"ts-node src/rules/cli.ts export","test:coverage":"vitest run --coverage","rules:validate":"ts-node src/rules/cli.ts validate"},"_npmUser":{"name":"shawticus","email":"shawmakesmagic@gmail.com"},"repository":{"url":"git+https://github.com/elizaos/eliza.git","type":"git"},"_npmVersion":"11.7.0","description":"SWE-agent: Software Engineering Agent built in TypeScript","directories":{},"_nodeVersion":"22.20.0","dependencies":{"ws":"^8.18.3","ora":"^7.0.1","zod":"^4.3.6","diff":"^5.2.0","glob":"^10.4.5","pino":"^8.21.0","axios":"^1.11.0","chalk":"^5.6.0","jsonl":"^1.1.2","sharp":"^0.33.5","dotenv":"^16.6.1","express":"^4.21.2","js-yaml":"^4.1.0","inquirer":"^9.3.7","commander":"^11.1.0","dockerode":"^4.0.7","minimatch":"^9.0.5","wrap-ansi":"^8.1.0","playwright":"^1.55.0","simple-git":"^3.28.0","strip-ansi":"^7.1.0","tar-stream":"^3.1.7","pino-pretty":"^10.3.1","@octokit/rest":"^22.0.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"tsx":"^4.21.0","vitest":"^4.0.17","ts-node":"^10.9.2","@types/ws":"^8.18.1","typescript":"^5.9.2","@types/diff":"^5.2.3","@types/node":"^20.19.11","@biomejs/biome":"^2.3.11","@types/express":"^4.17.23","@types/js-yaml":"^4.0.9","@types/inquirer":"^9.0.9","@types/dockerode":"^3.3.43","@types/tar-stream":"^3.1.4"},"_npmOperationalInternal":{"tmp":"tmp/sweagent_1.1.0_1770615677969_0.6783819816098988","host":"s3://npm-registry-packages-npm-production"}}},"time":{"created":"2026-02-09T05:41:17.826Z","modified":"2026-06-16T05:15:37.911Z","1.1.0":"2026-02-09T05:41:18.175Z"},"bugs":{"url":"https://github.com/elizaos/eliza/issues"},"author":{"name":"ElizaOS"},"license":"MIT","homepage":"https://github.com/elizaos/eliza/tree/main/packages/sweagent#readme","keywords":["software-engineering","agent","ai","automation","development-tools","swe-agent","elizaos"],"repository":{"url":"git+https://github.com/elizaos/eliza.git","type":"git"},"description":"SWE-agent: Software Engineering Agent built in TypeScript","maintainers":[{"email":"shawmakesmagic@gmail.com","name":"shawticus"},{"email":"janesmith@airmail.cc","name":"odilitime"}],"readme":"# 🤖 swe-agent-ts\n\nA fully-featured autonomous software engineer, written in typescript.\n\n## ✨ Features\n\n- 🚀 **Autonomous problem solving** - Give it a GitHub issue, bug report, or feature request\n- 🔧 **Automatic code generation** - Writes, tests, and submits complete solutions\n- 📊 **Full SWE-bench support** - Benchmark on thousands of real GitHub issues\n- 🌐 **Multi-model support** - Works with OpenAI, Anthropic, and open-source models\n- ⚡ **Parallel execution** - Run multiple instances simultaneously\n- 🎯 **Interactive shell mode** - Step through solutions interactively\n- 📈 **Complete parity** with Python SWE-agent functionality\n\n## 📦 Installation\n\n### Prerequisites\n- Node.js 18+ and npm\n- Docker (for sandboxed execution)\n- Git\n\n### Quick Install\n\n```bash\n# Clone the repository\ngit clone https://github.com/elizaos/swe-agent-ts.git\ncd swe-agent-ts\n\n# Install dependencies\nnpm install\n\n# Build the project\nnpm run build\n\n# Set up API keys (choose one)\nexport OPENAI_API_KEY=your_key\n# OR\nexport ANTHROPIC_API_KEY=your_key\n```\n\n### Global Installation (Optional)\n\n```bash\n# Install globally for system-wide access\nnpm install -g .\n\n# Now you can use 'sweagent' command anywhere\nsweagent --help\n```\n\n## 🚀 Quick Start\n\n### 1. Solve a GitHub Issue Automatically\n\n```bash\n# Have SWE-agent automatically fix a GitHub issue\nnpx sweagent run \\\n  --agent.model.name gpt-5 \\\n  --env.repo.github_url https://github.com/user/repo \\\n  --problem_statement.github_url https://github.com/user/repo/issues/123\n```\n\nThe agent will:\n1. Clone the repository\n2. Understand the issue\n3. Write and test a solution\n4. Create a patch file with the fix\n\n### 2. Write Code from a Description\n\n```bash\n# Create a new feature from a text description\necho \"Create a REST API with CRUD operations for a todo list app\" > task.md\n\nnpx sweagent run \\\n  --agent.model.name gpt-5 \\\n  --env.repo.path ./my-project \\\n  --problem_statement.path task.md\n```\n\n### 3. Interactive Shell Mode\n\n```bash\n# Work interactively with the agent\nnpx sweagent shell \\\n  --repo ./my-project \\\n  --config config/default.yaml\n\n# In the shell, you can:\n# - Ask it to implement features\n# - Debug issues together\n# - Review its proposed changes\n```\n\n## 📊 Running Benchmarks\n\n### SWE-bench Benchmarking\n\nTest the agent on real-world GitHub issues:\n\n```bash\n# Quick test on 3 instances\nnpx sweagent run-batch \\\n  --instances.type swe_bench \\\n  --instances.subset lite \\\n  --instances.split dev \\\n  --instances.slice :3 \\\n  --agent.model.name gpt-5\n\n# Full benchmark with parallel execution\nnpx sweagent run-batch \\\n  --instances.type swe_bench \\\n  --instances.subset lite \\\n  --instances.slice :50 \\\n  --num_workers 5 \\\n  --agent.model.name gpt-5 \\\n  --instances.evaluate\n```\n\n### Custom Benchmarks\n\n```bash\n# Run on your own test cases\ncat > my_tests.json << EOF\n[\n  {\n    \"imageName\": \"python:3.11\",\n    \"problemStatement\": \"Fix the authentication bug in login.py\",\n    \"instanceId\": \"auth-001\",\n    \"repoName\": \"my-app\",\n    \"baseCommit\": \"main\"\n  }\n]\nEOF\n\nnpx sweagent run-batch \\\n  --instances.type file \\\n  --instances.path my_tests.json \\\n  --agent.model.name gpt-5\n```\n\n## 🧪 Running Tests\n\n```bash\n# Run all tests\nnpm test\n\n# Run specific test suites\nnpm test -- test-agent\nnpm test -- test-swe-bench\nnpm test -- test-environment\n\n# Run with coverage\nnpm test -- --coverage\n\n# Run linting\nnpm run lint\n\n# Format code\nnpm run format\n```\n\n## 💡 Examples and Demos\n\n### Run Example Scripts\n\n```bash\n# Demo SWE-bench capabilities\nnode examples/demo_swe_bench.js\n\n# Run comprehensive benchmark examples\n./examples/run_swe_bench.sh\n\n# Test basic functionality\nnode examples/test_swe_bench_simple.js\n```\n\n### Common Use Cases\n\n#### Fix a Bug\n```bash\nnpx sweagent run \\\n  --agent.model.name gpt-5 \\\n  --env.repo.path ./my-app \\\n  --problem_statement.text \"The login form throws an error when email contains special characters\"\n```\n\n#### Add a Feature\n```bash\nnpx sweagent run \\\n  --agent.model.name claude-3-sonnet-20241022 \\\n  --env.repo.github_url https://github.com/user/repo \\\n  --problem_statement.text \"Add dark mode support to the settings page\"\n```\n\n#### Refactor Code\n```bash\nnpx sweagent run \\\n  --agent.model.name gpt-5 \\\n  --env.repo.path ./legacy-app \\\n  --problem_statement.text \"Refactor the user service to use async/await instead of callbacks\"\n```\n\n## 🏗️ Project Structure\n\n```\nswe-agent-ts/\n├── src/\n│   ├── agent/          # Core agent logic\n│   ├── environment/    # Execution environment\n│   ├── run/           # CLI and batch execution\n│   ├── tools/         # Agent tools and commands\n│   └── utils/         # Utilities\n├── config/            # Configuration files\n├── examples/          # Example scripts and demos\n├── tests/            # Test suite\n└── docs/             # Documentation\n```\n\n## ⚙️ Configuration\n\n### Model Configuration\n\n```yaml\n# config/my_config.yaml\nagent:\n  model:\n    name: gpt-5\n    per_instance_cost_limit: 2.00\n    temperature: 0.7\n    \ntools:\n  execution_timeout: 30\n  max_consecutive_execution_timeouts: 3\n```\n\n### Using Different Models\n\n```bash\n# OpenAI GPT-4\nexport OPENAI_API_KEY=your_key\nnpx sweagent run --agent.model.name gpt-5 ...\n\n# Anthropic Claude\nexport ANTHROPIC_API_KEY=your_key\nnpx sweagent run --agent.model.name claude-4-sonnet ...\n\n# Local/Open-source models via LiteLLM\nnpx sweagent run --agent.model.name ollama/codellama ...\n```\n\n## 🔧 Advanced Usage\n\n### Custom Tools and Commands\n\n```typescript\n// Create custom tools for the agent\nimport { Bundle } from 'swe-agent-ts';\n\nconst customBundle = new Bundle({\n  name: 'my-tools',\n  commands: [\n    {\n      name: 'analyze',\n      description: 'Analyze code quality',\n      script: 'npm run analyze'\n    }\n  ]\n});\n```\n\n### Hooks and Extensions\n\n```typescript\n// Add custom hooks to monitor agent behavior\nimport { AbstractAgentHook } from 'swe-agent-ts';\n\nclass MyHook extends AbstractAgentHook {\n  onStepStart() {\n    console.log('Agent is thinking...');\n  }\n  \n  onActionExecuted(step) {\n    console.log(`Executed: ${step.action}`);\n  }\n}\n```\n\n## 🐛 Troubleshooting\n\n### Common Issues\n\n1. **Node Version**: Ensure Node.js 18+\n   ```bash\n   node --version  # Should be v18.0.0 or higher\n   ```\n\n2. **Build Errors**: Clean and rebuild\n   ```bash\n   npm run clean\n   npm install\n   npm run build\n   ```\n\n3. **Docker Issues**: Ensure Docker is running\n   ```bash\n   docker ps  # Should show running containers\n   ```\n\n4. **API Keys**: Verify environment variables\n   ```bash\n   echo $OPENAI_API_KEY\n   echo $ANTHROPIC_API_KEY\n   ```\n\n```bash\n# Fork and clone the repository\ngit clone https://github.com/elizaos/swe-agent-ts.git\n\n# Create a feature branch\ngit checkout -b feature/amazing-feature\n\n# Make changes and test\nnpm test\n\n# Submit a pull request\n```\n\n## 📄 License\n\nMIT License - see [LICENSE](LICENSE) file for details.\n\n## 🙏 Acknowledgments\n\nThis TypeScript port is based on the original [SWE-agent](https://github.com/princeton-nlp/SWE-agent) by Princeton University and Stanford University researchers.","readmeFilename":"README.md"}