Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions crews/agentbay_sdk/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
.env
.cursorrules
agentbay-sdk-api.md

# Python
__pycache__/
*.py[cod]
*$py.class
*.so
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
*.egg-info/
.installed.cfg
*.egg
pipeline_outputs/
81 changes: 81 additions & 0 deletions crews/agentbay_sdk/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
# AI Crew for AgentBay SDK Integration

## Introduction

This project demonstrates the use of the CrewAI framework integrated with `wuying-agentbay-sdk` to automate cloud code execution and full development workflows. CrewAI orchestrates autonomous AI agents, enabling them to collaborate and execute complex tasks efficiently in secure cloud environments.

- [CrewAI Framework](#crewai-framework)
- [Running the Script](#running-the-script)
- [Details & Explanation](#details--explanation)
- [Configuration](#configuration)
- [Contributing](#contributing)
- [Support and Contact](#support-and-contact)
- [License](#license)

## CrewAI Framework

CrewAI is designed to facilitate the collaboration of role-playing AI agents. In this example, these agents work together to:
- Execute code in secure cloud environments
- Design and implement complete projects
- Deploy and run services in the cloud
- Analyze execution results

## Running the Script

It uses GPT-4o by default so you should have access to that to run it.

***Disclaimer:** This will use gpt-4o unless you change it to use a different model, and by doing so it may incur in different costs.*

- **Configure Environment**: Copy `.env.example` to `.env` and set up the environment variables:
- `AGENTBAY_API_KEY`: Your AgentBay cloud execution API key
- `OPENAI_API_KEY`: Your LLM API key
- `OPENAI_API_BASE`: (Optional) LLM API endpoint for custom providers
- `OPENAI_MODEL_NAME`: (Optional) LLM model name, default is `gpt-4o-mini`
- **Install Dependencies**: Run `poetry lock && poetry install` (or use `uv`/`pip`).
- **Customize**: Modify `main.py` to add custom inputs for your agents and tasks.
- **Customize Further**: Check `config/agents.yaml` to update your agents and `config/tasks.yaml` to update your tasks.
- **Execute the Script**: Run `python main.py` and follow the prompts.

## Details & Explanation

- **Running the Script**: Execute `python main.py`. The script provides two modes:
1. Simple code execution task - Execute a single code snippet in the cloud
2. Full development pipeline - Complete workflow from design to deployment and analysis
- **Key Components**:
- `crew.py`: Main crew file where agents and tasks come together, and the main logic is executed.
- `main.py`: Main script file with example usage.
- `pipeline.py`: Pipeline orchestation utilities.
- `config/agents.yaml`: Configuration file for defining agents.
- `config/tasks.yaml`: Configuration file for defining tasks.
- `tools/`: Contains tool classes used by the agents:
- `agentbay_tools.py`: AgentBay SDK integration tools
- `local_tools.py`: Local file system and HTTP verification tools
- `api/agentbay_temporary_session.py`: Temporary session operations (each call creates/deletes session automatically)
- `api/agentbay_persistent_session.py`: Persistent session operations (reusable sessions with manual lifecycle management)
- `tests/`: Test cases for the integration

## Configuration

### Required Environment Variables

- `AGENTBAY_API_KEY`: Your AgentBay cloud execution API key
- `OPENAI_API_KEY`: Your LLM API key

### Optional Environment Variables

- `OPENAI_API_BASE`: Custom LLM API endpoint (e.g., for Alibaba Cloud Bailian: `https://dashscope.aliyuncs.com/compatible-mode/v1`)
- `OPENAI_MODEL_NAME`: LLM model name (default: `gpt-4o-mini`)
- For Bailian: Use `openai/qwen-plus` (with `openai/` prefix for LiteLLM compatibility)

### Example Configuration

See `.env.example` for detailed configuration examples for different LLM providers:
- OpenAI (default)
- Alibaba Cloud Bailian
- Azure OpenAI
- Custom endpoints

## License

This project is released under the MIT License.

Empty file added crews/agentbay_sdk/__init__.py
Empty file.
38 changes: 38 additions & 0 deletions crews/agentbay_sdk/env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# AgentBay SDK Integration - Environment Variables Configuration
# Copy this file to .env and fill in your actual API keys

# =============================================================================
# Required: AgentBay API Key
# =============================================================================
# Get your API key from: https://agentbay.ai (or your AgentBay provider)
AGENTBAY_API_KEY=your_agentbay_api_key_here

# =============================================================================
# Required: LLM API Key
# =============================================================================
# Choose one of the following options based on your LLM provider

# Option A: Using OpenAI (Default)
OPENAI_API_KEY=your_openai_api_key_here
# OPENAI_MODEL_NAME=gpt-4o-mini # Optional, default is gpt-4o-mini

# Option B: Using Alibaba Cloud Bailian
# OPENAI_API_KEY=your_dashscope_api_key_here
# OPENAI_API_BASE=https://dashscope.aliyuncs.com/compatible-mode/v1
# OPENAI_MODEL_NAME=openai/qwen-plus # Note: openai/ prefix is required for LiteLLM

# Option C: Using Azure OpenAI
# AZURE_OPENAI_ENDPOINT=https://your-resource.openai.azure.com/
# AZURE_OPENAI_API_KEY=your_azure_key_here
# AZURE_OPENAI_DEPLOYMENT=your_deployment_name

# Option D: Using Custom Endpoint
# OPENAI_API_KEY=your_api_key_here
# OPENAI_API_BASE=https://your-custom-endpoint.com/v1
# OPENAI_MODEL_NAME=your-model-name

# =============================================================================
# Optional: Advanced Configuration
# =============================================================================
# OPENAI_MODEL_NAME=gpt-4o-mini # Override default model
# OPENAI_API_BASE= # Override default API base URL
Loading