How to Use AWS as Your AWS Complete Server Solution
3 min read
Dec 13, 2024
Published on
Jan 21, 2025
Shreyas
10 min
Jira is a powerful tool for project management, especially when it comes to tracking issues, bugs, and tasks. One of the challenges teams face is manually creating tickets for recurring issues, bug reports, or tasks. Automating this process can save valuable time and reduce human error.
In this blog, we will walk through how to create Jira tickets automatically in a column called "Auto-Generated Tickets" using an AI Retrieval-Augmented Generation (RAG) model with Crew AI and Python.
The Retrieval-Augmented Generation (RAG) model combines the capabilities of information retrieval with natural language generation. RAG models are excellent for tasks that require contextual information retrieval from large datasets or knowledge bases to generate coherent and relevant text.
In this case, we can use Crew AI's RAG model to understand and generate Jira tickets based on various inputs, like system logs or user feedback. Python will serve as the bridge to interact with Crew AI's API and the Jira API to create the tickets.
To follow along with this tutorial, you need the following:
To interact with Jira programmatically, you'll need to set up API access. Jira Cloud provides a REST API that we can use to create tickets.
pip install crewai crewai-tools requests pydantic
Next, we need to use Crew AI’s RAG model to generate context-based suggestions for the Jira ticket. You’ll need an API key for Crew AI.
main.py
import sys
from crew import JiraTicketCreationCrew
def run():
meeting_transcribe = """
Alice: "We've noticed users experiencing issues when uploading large files to the platform. The process times out without a clear error message."
Bob: "The backend should handle larger file sizes with proper timeouts and provide feedback to users."
Alice: "Let's create a ticket to address this. We need to update the backend logic and add a user-friendly error message if uploads fail due to size limits.
"""
myinput = {
'meeting_transcribe' : meeting_transcribe
}
result = JiraTicketCreationCrew().crew().kickoff(inputs=myinput)
print("result" , result)
run()
crew.py
from crewai import Agent, Crew, Process, Task
from crewai.project import CrewBase, agent, crew, task
from crewai_tools import SerperDevTool, ScrapeWebsiteTool
from pydantic import BaseModel, Field
class TicketDetails(BaseModel):
title: str = Field(..., description="Title of the ticket")
description: str = Field(..., description="Description of the ticket")
@CrewBase
class JiraTicketCreationCrew():
"""Crew for generating and creating Jira tickets"""
agents_config = 'config/agents.yaml'
tasks_config = 'config/tasks.yaml'
@agent
def ticket_generator(self) -> Agent:
return Agent(
config=self.agents_config['ticket_title_generator'],
tools=[SerperDevTool(), ScrapeWebsiteTool()],
verbose=True,
allow_delegation=False,
)
@task
def ticket_generation_task(self) -> Task:
return Task(
config=self.tasks_config['ticket_generation_task'],
agent=self.ticket_title_generator(),
output_json=TicketDetails
)
@crew
def crew(self) -> Crew:
"""Creates the crew for generating and creating Jira tickets"""
return Crew(
agents=self.agents,
tasks=self.tasks,
process=Process.sequential
)
Now, Create a “config” folder and add agents.yaml and tasks.yaml , this files define some context for our agentic flow agents.yaml
ticket_generator:
role: >
Ticket Title Generator
goal: >
Generate descriptive and concise titles for Jira tickets based on the provided context.
backstory: >
You are skilled at summarizing information into effective ticket titles, ensuring that they are clear and concise for quick identification by the team.
tasks.yaml
ticket_generation_task:
description: >
Generate a Jira ticket for a bug or task based on the provided context.
- meeting_transcribe : {meeting_transcribe}
expected_output: >
- Ticket title: A concise, descriptive title for the issue or task.
- Ticket description: A detailed description, including steps to reproduce, expected outcome, and environment details.
Now, run the main.py
python3 run main.py
Output :
# Agent: Ticket Title Generator
## Final Answer:
{
"title": "Resolve File Upload Timeout and Implement User-Friendly Error Messaging for Large Files",
"description": "Users are experiencing timeouts when uploading large files to the platform without receiving clear error messages.
Steps to Reproduce: Navigate to the file upload section of the platform. Attempt to upload a file larger than [specific size, e.g., 100MB].Observe that the upload process times out without any error notification.
Expected Outcome: The backend should handle larger file uploads gracefully with appropriate timeout settings.If an upload fails due to size limits, the system should provide a user-friendly error message indicating the file size restriction.
Proposed Solution: Update the backend logic to accommodate larger file sizes with proper timeout configurations. Implement clear and informative error messages to notify users when their uploads fail due to exceeding size limits."
}
We can enhance Jira ticket creation automation by using additional tools, which will further streamline workflows and improve accuracy. By integrating different systems into the process, we can automatically generate tickets based on a variety of triggers, such as user feedback, system logs, or even other tools within the development ecosystem.
Automating Jira ticket creation with AI-powered solutions and Python opens up new possibilities for development teams, allowing them to focus on core tasks while ensuring that issues are consistently tracked and addressed. This approach can significantly improve the speed and accuracy of ticket creation, making it an essential tool for modern DevOps teams.
Insights