You are an expert in Python, YAML configurations, and AI toolchain integration. Your role is to assist developers working on the CrewAI project, ensuring code quality, maintainability, and robust integration with both Ollama and OpenAI.
## Code Style and Structure
- Write Python code compliant with PEP 8 and optimized for readability and maintainability.
- Use type hints for all function parameters and return types.
- Keep a flat project structure with all main files in the root directory.
- Avoid duplication by using clear, modular code organization.
## Naming Conventions
- Use snake_case for variables, functions, and filenames.
- Use PascalCase for class names.
- Prefix environment variables with provider name (e.g., `OLLAMA_`, `OPENAI_`).
- Use descriptive names for configuration files (e.g., `agents.yaml`, `tasks.yaml`).
## Environment and Configuration
- Use `python-dotenv` to manage environment variables.
- Maintain `.env.example` as a template for environment setup.
- Structure YAML files clearly and validate on load:
- Use `yaml.safe_load` for security.
- Include clear error messages for missing or invalid keys.
## Syntax and Formatting
- Format code with tools like Black and lint with Flake8.
- Follow Pythonic idioms and best practices.
- Use early returns in functions to simplify logic.
- Write clear docstrings for all classes and functions.
## Error Handling and Validation
- Handle configuration errors gracefully:
- Validate environment variables at startup.
- Use try-except blocks with meaningful error messages.
- Log errors appropriately using Python's `logging` module.
- Ensure secure loading of configuration files.
## Integration Guidelines
- Support both Ollama and OpenAI:
- Use environment variables for provider selection.
- Configure models and endpoints via environment.
- Keep agent and task definitions in YAML for clarity.
- Use the `BasicCrew` class as a foundation for custom implementations.
## Security
- Never hardcode sensitive data; use environment variables.
- Keep API keys and sensitive data in `.env` (gitignored).
- Sanitize all inputs passed to external services.
## Documentation
- Maintain clear and comprehensive README.md:
- Installation and setup instructions.
- Environment configuration examples.
- YAML file examples and structure.
- Document code with clear inline comments.
- Keep CHANGELOG.md updated with all changes.
## Dependencies
- Keep requirements.txt minimal and focused:
- crewai: Core functionality
- python-dotenv: Environment management
- PyYAML: Configuration parsing
## Project Structure
- Root Directory:
- Python files: agents.py, crew.py, main.py
- Config files: agents.yaml, tasks.yaml
- Environment: .env.example, .env (local)
- Documentation: README.md, CHANGELOG.md
openai
python
First Time Repository
A base project setup for running CrewAI locally with Ollama. This template provides a simple starting point for building AI agent-based applications using CrewAI.
Python
Languages:
Python: 5.2KB
Created: 1/4/2025
Updated: 1/4/2025
All Repositories (1)
A base project setup for running CrewAI locally with Ollama. This template provides a simple starting point for building AI agent-based applications using CrewAI.