Files
ajarbot/.env.example

56 lines
1.8 KiB
Plaintext
Raw Normal View History

Migrate to Claude Agent SDK framework (v0.2.0) BREAKING CHANGE: Replaced FastAPI server wrapper with direct Claude Agent SDK integration ## Major Changes ### Architecture - **OLD:** Bot → FastAPI Server → claude-code-sdk → Claude - **NEW:** Bot → Claude Agent SDK → Claude (Pro subscription OR API) - Eliminated HTTP server overhead - Single-process architecture ### LLM Backend (llm_interface.py) - Implemented Claude Agent SDK as DEFAULT mode - Added three-mode architecture: - agent-sdk (default) - Uses Pro subscription - direct-api - Pay-per-token Anthropic API - legacy-server - Backward compat with old setup - Created async/sync bridge using anyio - Preserved all existing functionality (17 tools, memory, scheduling) ### Dependencies (requirements.txt) - Replaced: claude-code-sdk → claude-agent-sdk>=0.1.0 - Added: anyio>=4.0.0 for async bridging - Removed: fastapi, uvicorn (no longer needed for default mode) ### New Files - ajarbot.py - Unified launcher with pre-flight checks - run.bat - Windows one-command launcher (auto-setup) - pyproject.toml - Python package metadata - MIGRATION.md - Upgrade guide from old setup - AGENT_SDK_IMPLEMENTATION.md - Technical documentation - QUICK_REFERENCE_AGENT_SDK.md - Quick reference card - test_agent_sdk.py - Comprehensive test suite ### Updated Documentation - CLAUDE_CODE_SETUP.md - Rewritten for Agent SDK - README.md - Updated quick start for new default - .env.example - Added AJARBOT_LLM_MODE configuration ### Deleted Files - claude_code_server.py - Replaced by agent-sdk integration - heartbeat.py - Superseded by scheduled_tasks.py - pulse_brain.py - Unused in production ## Migration Path Old setup: 1. Start FastAPI server: python claude_code_server.py 2. Start bot: python bot_runner.py 3. Set USE_CLAUDE_CODE_SERVER=true New setup: 1. Run: run.bat (or python ajarbot.py) - That's it! Single command. ## Benefits ✅ Zero API costs (uses Claude Pro subscription) ✅ Simplified deployment (no separate server) ✅ Single-command launch (run.bat) ✅ Faster response times (no HTTP overhead) ✅ All functionality preserved (17 tools, memory, adapters) ✅ Backward compatible (old env vars still work) ## Compatibility - Python 3.10+ required - Node.js required (for Claude Code CLI bundled with SDK) - Windows 11 tested and optimized - All existing tools, memory system, and adapters unchanged Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-02-15 10:03:11 -07:00
# ========================================
# Ajarbot Environment Configuration
# ========================================
# Copy this file to .env and configure for your setup
Migrate to Claude Agent SDK framework (v0.2.0) BREAKING CHANGE: Replaced FastAPI server wrapper with direct Claude Agent SDK integration ## Major Changes ### Architecture - **OLD:** Bot → FastAPI Server → claude-code-sdk → Claude - **NEW:** Bot → Claude Agent SDK → Claude (Pro subscription OR API) - Eliminated HTTP server overhead - Single-process architecture ### LLM Backend (llm_interface.py) - Implemented Claude Agent SDK as DEFAULT mode - Added three-mode architecture: - agent-sdk (default) - Uses Pro subscription - direct-api - Pay-per-token Anthropic API - legacy-server - Backward compat with old setup - Created async/sync bridge using anyio - Preserved all existing functionality (17 tools, memory, scheduling) ### Dependencies (requirements.txt) - Replaced: claude-code-sdk → claude-agent-sdk>=0.1.0 - Added: anyio>=4.0.0 for async bridging - Removed: fastapi, uvicorn (no longer needed for default mode) ### New Files - ajarbot.py - Unified launcher with pre-flight checks - run.bat - Windows one-command launcher (auto-setup) - pyproject.toml - Python package metadata - MIGRATION.md - Upgrade guide from old setup - AGENT_SDK_IMPLEMENTATION.md - Technical documentation - QUICK_REFERENCE_AGENT_SDK.md - Quick reference card - test_agent_sdk.py - Comprehensive test suite ### Updated Documentation - CLAUDE_CODE_SETUP.md - Rewritten for Agent SDK - README.md - Updated quick start for new default - .env.example - Added AJARBOT_LLM_MODE configuration ### Deleted Files - claude_code_server.py - Replaced by agent-sdk integration - heartbeat.py - Superseded by scheduled_tasks.py - pulse_brain.py - Unused in production ## Migration Path Old setup: 1. Start FastAPI server: python claude_code_server.py 2. Start bot: python bot_runner.py 3. Set USE_CLAUDE_CODE_SERVER=true New setup: 1. Run: run.bat (or python ajarbot.py) - That's it! Single command. ## Benefits ✅ Zero API costs (uses Claude Pro subscription) ✅ Simplified deployment (no separate server) ✅ Single-command launch (run.bat) ✅ Faster response times (no HTTP overhead) ✅ All functionality preserved (17 tools, memory, adapters) ✅ Backward compatible (old env vars still work) ## Compatibility - Python 3.10+ required - Node.js required (for Claude Code CLI bundled with SDK) - Windows 11 tested and optimized - All existing tools, memory system, and adapters unchanged Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-02-15 10:03:11 -07:00
# ========================================
# LLM Configuration
# ========================================
# LLM Mode - Choose how to access Claude
# Options:
# - "agent-sdk" (default) - Use Claude Pro subscription via Agent SDK
# - "api" - Use pay-per-token API (requires ANTHROPIC_API_KEY)
#
# Agent SDK mode pros: Unlimited usage within Pro limits, no API key needed
# API mode pros: Works in any environment, predictable costs, better for production
AJARBOT_LLM_MODE=agent-sdk
# Anthropic API Key - ONLY required for "api" mode
# Get your key from: https://console.anthropic.com/settings/keys
# For agent-sdk mode, authenticate with: claude auth login
ANTHROPIC_API_KEY=your-api-key-here
Migrate to Claude Agent SDK framework (v0.2.0) BREAKING CHANGE: Replaced FastAPI server wrapper with direct Claude Agent SDK integration ## Major Changes ### Architecture - **OLD:** Bot → FastAPI Server → claude-code-sdk → Claude - **NEW:** Bot → Claude Agent SDK → Claude (Pro subscription OR API) - Eliminated HTTP server overhead - Single-process architecture ### LLM Backend (llm_interface.py) - Implemented Claude Agent SDK as DEFAULT mode - Added three-mode architecture: - agent-sdk (default) - Uses Pro subscription - direct-api - Pay-per-token Anthropic API - legacy-server - Backward compat with old setup - Created async/sync bridge using anyio - Preserved all existing functionality (17 tools, memory, scheduling) ### Dependencies (requirements.txt) - Replaced: claude-code-sdk → claude-agent-sdk>=0.1.0 - Added: anyio>=4.0.0 for async bridging - Removed: fastapi, uvicorn (no longer needed for default mode) ### New Files - ajarbot.py - Unified launcher with pre-flight checks - run.bat - Windows one-command launcher (auto-setup) - pyproject.toml - Python package metadata - MIGRATION.md - Upgrade guide from old setup - AGENT_SDK_IMPLEMENTATION.md - Technical documentation - QUICK_REFERENCE_AGENT_SDK.md - Quick reference card - test_agent_sdk.py - Comprehensive test suite ### Updated Documentation - CLAUDE_CODE_SETUP.md - Rewritten for Agent SDK - README.md - Updated quick start for new default - .env.example - Added AJARBOT_LLM_MODE configuration ### Deleted Files - claude_code_server.py - Replaced by agent-sdk integration - heartbeat.py - Superseded by scheduled_tasks.py - pulse_brain.py - Unused in production ## Migration Path Old setup: 1. Start FastAPI server: python claude_code_server.py 2. Start bot: python bot_runner.py 3. Set USE_CLAUDE_CODE_SERVER=true New setup: 1. Run: run.bat (or python ajarbot.py) - That's it! Single command. ## Benefits ✅ Zero API costs (uses Claude Pro subscription) ✅ Simplified deployment (no separate server) ✅ Single-command launch (run.bat) ✅ Faster response times (no HTTP overhead) ✅ All functionality preserved (17 tools, memory, adapters) ✅ Backward compatible (old env vars still work) ## Compatibility - Python 3.10+ required - Node.js required (for Claude Code CLI bundled with SDK) - Windows 11 tested and optimized - All existing tools, memory system, and adapters unchanged Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-02-15 10:03:11 -07:00
# ========================================
# Messaging Platform Adapters
# ========================================
# Adapter credentials can also be stored in config/adapters.local.yaml
# Slack
# Get tokens from: https://api.slack.com/apps
AJARBOT_SLACK_BOT_TOKEN=xoxb-your-bot-token
AJARBOT_SLACK_APP_TOKEN=xapp-your-app-token
# Telegram
# Get token from: https://t.me/BotFather
AJARBOT_TELEGRAM_BOT_TOKEN=123456:ABC-your-bot-token
# ========================================
# Alternative LLM Providers (Optional)
# ========================================
# GLM (z.ai) - Optional alternative to Claude
# GLM_API_KEY=your-glm-key-here
Migrate to Claude Agent SDK framework (v0.2.0) BREAKING CHANGE: Replaced FastAPI server wrapper with direct Claude Agent SDK integration ## Major Changes ### Architecture - **OLD:** Bot → FastAPI Server → claude-code-sdk → Claude - **NEW:** Bot → Claude Agent SDK → Claude (Pro subscription OR API) - Eliminated HTTP server overhead - Single-process architecture ### LLM Backend (llm_interface.py) - Implemented Claude Agent SDK as DEFAULT mode - Added three-mode architecture: - agent-sdk (default) - Uses Pro subscription - direct-api - Pay-per-token Anthropic API - legacy-server - Backward compat with old setup - Created async/sync bridge using anyio - Preserved all existing functionality (17 tools, memory, scheduling) ### Dependencies (requirements.txt) - Replaced: claude-code-sdk → claude-agent-sdk>=0.1.0 - Added: anyio>=4.0.0 for async bridging - Removed: fastapi, uvicorn (no longer needed for default mode) ### New Files - ajarbot.py - Unified launcher with pre-flight checks - run.bat - Windows one-command launcher (auto-setup) - pyproject.toml - Python package metadata - MIGRATION.md - Upgrade guide from old setup - AGENT_SDK_IMPLEMENTATION.md - Technical documentation - QUICK_REFERENCE_AGENT_SDK.md - Quick reference card - test_agent_sdk.py - Comprehensive test suite ### Updated Documentation - CLAUDE_CODE_SETUP.md - Rewritten for Agent SDK - README.md - Updated quick start for new default - .env.example - Added AJARBOT_LLM_MODE configuration ### Deleted Files - claude_code_server.py - Replaced by agent-sdk integration - heartbeat.py - Superseded by scheduled_tasks.py - pulse_brain.py - Unused in production ## Migration Path Old setup: 1. Start FastAPI server: python claude_code_server.py 2. Start bot: python bot_runner.py 3. Set USE_CLAUDE_CODE_SERVER=true New setup: 1. Run: run.bat (or python ajarbot.py) - That's it! Single command. ## Benefits ✅ Zero API costs (uses Claude Pro subscription) ✅ Simplified deployment (no separate server) ✅ Single-command launch (run.bat) ✅ Faster response times (no HTTP overhead) ✅ All functionality preserved (17 tools, memory, adapters) ✅ Backward compatible (old env vars still work) ## Compatibility - Python 3.10+ required - Node.js required (for Claude Code CLI bundled with SDK) - Windows 11 tested and optimized - All existing tools, memory system, and adapters unchanged Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-02-15 10:03:11 -07:00
# ========================================
# Legacy/Deprecated Settings
# ========================================
# The following settings are deprecated and no longer needed:
#
# USE_CLAUDE_CODE_SERVER=true
# CLAUDE_CODE_SERVER_URL=http://localhost:8000
# USE_AGENT_SDK=true
# USE_DIRECT_API=true
#
# Use AJARBOT_LLM_MODE instead (see above)