Some checks failed
Build and Push Image / Build and push image (push) Failing after 1m58s
51 lines
1.6 KiB
Python
51 lines
1.6 KiB
Python
from crewai import Agent, Task, Crew
|
|
from crewai.project import CrewBase, agent, task, crew
|
|
from crewai_tools import MCPServerAdapter
|
|
from mcp import StdioServerParameters
|
|
import os
|
|
from typing import Dict, Any
|
|
from pr_reviewer.llm import get_llm
|
|
|
|
|
|
@CrewBase
|
|
class SecurityReviewCrew:
|
|
"""Security Review Crew for conducting security reviews."""
|
|
|
|
agents_config = "config/agents.yaml"
|
|
tasks_config = "config/tasks.yaml"
|
|
|
|
def __init__(self):
|
|
self.llm = get_llm()
|
|
self.trivy_server_params = None
|
|
|
|
@agent
|
|
def security_reviewer(self) -> Agent:
|
|
"""Application Security Engineer agent for security review."""
|
|
return Agent(
|
|
config=self.agents_config["security_reviewer"],
|
|
llm=self.llm,
|
|
tools=[],
|
|
verbose=True
|
|
)
|
|
|
|
@task
|
|
def security_review_task(self) -> Task:
|
|
"""Task for conducting security review."""
|
|
return Task(
|
|
config=self.tasks_config["security_review_task"],
|
|
)
|
|
|
|
@crew
|
|
def crew(self) -> Crew:
|
|
"""Create the Security Review crew."""
|
|
# If we had an MCP server to wrap, we would create an adapter here.
|
|
# Since Trivy is native, we don't add any tools via MCPServerAdapter.
|
|
# However, the native server should be available in the MCP ecosystem.
|
|
# We'll assume the tools are automatically available or will be handled differently.
|
|
return Crew(
|
|
agents=[self.security_reviewer()],
|
|
tasks=[self.security_review_task()],
|
|
process="sequential",
|
|
verbose=True,
|
|
# No additional tools from MCP wrapper for Trivy (native)
|
|
) |