Skip to content

martian7777/crew_agents

Repository files navigation

Crew Agents - AI-Powered Multi-Agent System

A sophisticated multi-agent system built with CrewAI that demonstrates the power of collaborative AI agents for content creation and email optimization. This project showcases how multiple specialized AI agents can work together to accomplish complex tasks through research, writing, and communication enhancement.

πŸš€ Features

πŸ€– Multi-Agent Architecture

  • Research Specialist Agent: Web research and fact-finding capabilities
  • Creative Writer Agent: Blog post creation with engaging content
  • Email Agent: Email optimization and professional communication enhancement

πŸ“ Content Generation

  • Blog Creation: Automated research and writing of 250-word blog posts
  • Fact Research: Web-based research using SerperDev and website search tools
  • Structured Content: Hook, introduction, body, conclusion, and call-to-action format

πŸ“§ Email Enhancement

  • Professional Tone: Converts casual emails to professional communication
  • Jargon Expansion: Automatically expands abbreviations (AI, ML, NLP, etc.)
  • Gen-Z Term Expansion: Modernizes informal language for professional contexts

βš™οΈ Configuration Management

  • YAML-Based Configuration: Declarative agent and task definitions
  • Modular Design: Easy to modify agents and tasks without code changes
  • Environment Separation: Clean separation of configuration and implementation

πŸ› οΈ Technology Stack

  • Python 3.12+: Modern Python with advanced features
  • CrewAI: Multi-agent orchestration framework with YAML configuration support
  • Gemini 2.0 Flash: Google's latest AI model for natural language processing
  • SerperDev: Web search and research capabilities
  • Website Search Tool: RAG-enabled web content analysis
  • ChromaDB: Vector database for RAG functionality
  • Gradio: Web application framework for user interaction

πŸ“‹ Prerequisites

  • Python 3.12 or higher
  • Access to Google Gemini API
  • SerperDev API key for web search functionality
  • Internet connection for web research capabilities

πŸš€ Installation

  1. Clone the repository

    git clone <your-repo-url>
    cd crew_agents
  2. Install dependencies using uv (recommended)

    uv sync

    Alternative: Using pip

    pip install -r requirements.txt
  3. Set up environment variables Create a .env file in the root directory:

    GOOGLE_API_KEY=your_gemini_api_key_here
    SERPER_API_KEY=your_serperdev_api_key_here

πŸ”§ Configuration

YAML-Based Configuration System

The project also uses a declarative YAML configuration system that separates agent and task definitions from the implementation code.

Agents Configuration (config/agents.yaml)

research_agent:
  llm: gemini/gemini-2.0-flash
  role: >
      A Senior research specialist.
  goal: >
    Research interesting 4-5 facts about the topic: {topic}
  backstory: >
    You are a highly skilled research assistant that can research the web and provide the factual data

writer_agent:
  llm: gemini/gemini-2.0-flash
  role: >
    A creative writer.
  goal: >
    Write a 250 words blog using the research on {topic} and must be a casual tone
  backstory: >
    You are a highly skilled writer assistant that can write a blog post about the topic

Tasks Configuration (config/tasks.yaml)

research_task:
  description: >
    Research interesting 4-5 facts about the topic: {topic}
  expected_output: >
    A bullet point list of 4-5 facts about the topic

writer_task:
  description: >
    Write a 250 words blog using the research on {topic} and must be a casual tone
  expected_output: >
    Blog post

API Keys Setup

Model Configuration

The system uses Gemini 2.0 Flash with the following settings:

  • Temperature: 0.7 (balanced creativity and consistency)
  • Streaming: Enabled for real-time output
  • Context-aware processing

πŸ“– Usage Examples

1. Blog Generation

YAML-Based Configuration (Recommended)

Use the new declarative configuration system:

python agent_yaml.py

Features:

  • Clean separation of concerns
  • Easy to modify agents and tasks
  • No code changes needed for configuration updates
  • Uses @CrewBase, @agent, @task, and @crew decorators

Custom Topic: Modify the topic in the main section:

response = crew.blog_crew().kickoff(inputs={"topic": "Your custom topic here"})

Legacy Command Line Interface

Run the original blog generation system:

python BlogsAgent/blogs_agent.py

Default Topic: "How Agriculture can be changed by AGI"

Custom Topic: Modify line 64 in blogs_agent.py:

response = crew.kickoff(inputs={"topic": "Your custom topic here"})

Web Interface (Gradio App)

Launch the beautiful web interface:

python gradio_app/app.py

Features:

  • User-friendly web interface
  • Real-time progress tracking
  • Beautiful markdown output
  • Example topics for inspiration
  • Responsive design

Access: Open your browser and go to http://localhost:7860

Output: A well-researched, 250-word blog post with:

  • Engaging hook
  • Introduction paragraph
  • Body content with researched facts
  • Conclusion
  • Call-to-action

2. Email Enhancement

Run the email optimization system:

python emailAgent/email_agent.py

Features:

  • Professional tone conversion
  • Jargon expansion (AI β†’ Artificial Intelligence)
  • Gen-Z term modernization
  • Enhanced persuasiveness

3. Advanced Email Tools

For enhanced email processing with custom tools:

python emailAgent/agent_tool.py

Custom Tools:

  • Jargon replacement tool
  • Professional language enhancement
  • Context-aware improvements

πŸ—οΈ Project Structure

crew_agents/
β”œβ”€β”€ agent_yaml.py           # Main YAML-based configuration system (NEW)
β”œβ”€β”€ main.py                 # Entry point (placeholder)
β”œβ”€β”€ pyproject.toml         # Project configuration and dependencies
β”œβ”€β”€ requirements.txt        # Python dependencies
β”œβ”€β”€ uv.lock                # UV dependency lock file
β”œβ”€β”€ config/                # Configuration directory (NEW)
β”‚   β”œβ”€β”€ agents.yaml        # Agent definitions in YAML format
β”‚   └── tasks.yaml         # Task definitions in YAML format
β”œβ”€β”€ BlogsAgent/            # Blog-related components
β”‚   └── blogs_agent.py     # Legacy blog generation system
β”œβ”€β”€ gradio_app/            # Web interface module
β”‚   └── app.py             # Gradio web application
β”œβ”€β”€ emailAgent/            # Email enhancement module
β”‚   β”œβ”€β”€ email_agent.py     # Basic email optimization
β”‚   └── agent_tool.py      # Advanced email tools
β”œβ”€β”€ db/                    # Database storage (Chroma vector DB)
β”‚   └── chroma.sqlite3     # Vector database file
└── README.md              # This file

πŸ” How It Works

YAML-Based Configuration System

  1. Configuration Loading: CrewAI automatically loads agent and task configurations from YAML files
  2. Decorator Pattern: Uses @CrewBase, @agent, @task, and @crew decorators for clean code organization
  3. Dynamic Agent Creation: Agents are created based on YAML configurations at runtime
  4. Separation of Concerns: Configuration changes don't require code modifications

Blog Generation Process

  1. Research Phase: Research Specialist Agent searches the web for relevant facts
  2. Content Creation: Creative Writer Agent crafts engaging blog content
  3. Quality Assurance: Structured format with hook, body, and conclusion
  4. Output: Professional blog post ready for publication

Email Enhancement Process

  1. Input Analysis: Raw email content analysis
  2. Language Processing: Jargon expansion and tone adjustment
  3. Professional Refinement: Enhanced communication style
  4. Output: Polished, professional email

🎯 Use Cases

  • Content Marketing: Automated blog creation for websites
  • Research Papers: Fact-finding and content generation
  • Professional Communication: Email optimization for business
  • Educational Content: Research-based learning materials
  • SEO Content: Web-optimized articles with current information
  • RAG Applications: Vector database storage for web content retrieval

🚧 Future Enhancements

  • YAML-based configuration system βœ…
  • Gradio web interface for user interaction βœ…
  • ChromaDB integration for RAG functionality βœ…
  • Additional agent types (Editor, SEO Specialist, etc.)
  • Content scheduling and publishing automation
  • Multi-language support
  • Advanced content analytics
  • Integration with CMS platforms
  • Email agent web interface
  • Content export options (PDF, Word, etc.)
  • Configuration validation and error handling
  • Multiple configuration profiles (dev, staging, prod)

πŸ”§ Development

Adding New Agents

  1. Update config/agents.yaml with new agent definition
  2. Add agent method in your crew class with @agent decorator
  3. No code changes needed for configuration updates

Adding New Tasks

  1. Update config/tasks.yaml with new task definition
  2. Add task method in your crew class with @task decorator
  3. Link tasks in the @crew method

Configuration Best Practices

  • Use descriptive names for agents and tasks
  • Keep configurations focused and single-purpose
  • Use YAML multi-line syntax (>) for long text
  • Reference variables using {variable_name} syntax

🀝 Contributing

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

πŸ“ License

This project is licensed under the MIT License - see the LICENSE file for details.

πŸ™ Acknowledgments

πŸ“ž Support

For questions, issues, or contributions:

  • Open an issue on Gitlab
  • Check the CrewAI documentation
  • Review the project structure and examples

Built with ❀️ using CrewAI and modern AI technologies

About

A sophisticated multi-agent system built with CrewAI that demonstrates the power of collaborative AI agents for content creation and email optimization. This project showcases how multiple specialized AI agents can work together to accomplish complex tasks through research, writing,!

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages