Skip to main content

Jira automation agent with Streamlit dashboard and API

Project description

Jira Automation Agent

A comprehensive AI-powered agent for automating Jira project management tasks including ticket creation, assignment, status management, epic organization, and more.

Features

🎯 Core Capabilities

  • Ticket Management: Create, edit, assign, and change status of tickets
  • Project Management: List projects and users
  • Epic Management: Create and organize epics
  • Search & Discovery: Advanced ticket searching with JQL
  • URL Generation: Direct links to tickets and epics
  • Status Management: Workflow transitions and status updates
  • Assignment: Assign tickets to team members
  • Priority Management: Set and update ticket priorities

🚀 Supported Operations

Ticket Operations

  • Create tickets (Task, Bug, Story, etc.)
  • Edit ticket details (summary, description, priority)
  • Assign tickets to users
  • Change ticket status through workflow
  • Search tickets using JQL
  • Get ticket details and URLs

Project Operations

  • List all projects
  • List users (system-wide or project-specific)
  • Get project information

Epic Operations

  • Create epics
  • List epics (system-wide or project-specific)
  • Link tickets to epics
  • Get epic URLs

Installation

  1. Install dependencies:
pip install -r requirements.txt
  1. Set up environment variables: Copy .env.example to .env and fill in values:
JIRA_URL=
JIRA_EMAIL=
JIRA_API_TOKEN=
JIRA_DEFAULT_EMAIL_DOMAIN=

azure_openai_api_version=2024-02-15-preview
azure_openai_model_name_4o_mini=
azure_openai_4o_mini_key=
azure_openai_4o_mini_url=
azure_embedding_key_3=
azure_embedding_version=2023-05-15
azure_embedding_model_3=text-embedding-3-large
  1. Get Jira API Token:

Usage

Basic Usage

from phi_jira_agent_final import get_phi_jira_agent

# Create the agent
agent = get_phi_jira_agent()

# Use the agent
response = agent.run("List all projects",stream=False)
print(response)

Interactive Mode

python example_usage.py interactive

Streamlit Dashboard

streamlit run dashboard_app.py

After packaging, you can run:

jir-agent-dashboard

API Server

uvicorn main:app --reload

After packaging, you can run:

jir-agent-api

Microsoft Teams Bot via API

  1. Configure environment variables

Set these in your shell or .env:

MICROSOFT_APP_ID=<bot app id>
MICROSOFT_APP_PASSWORD=<bot client secret>
MICROSOFT_APP_TENANT_ID=<tenant id or 'common'>
  1. Run the API locally
uvicorn main:app --host 0.0.0.0 --port 8000 --reload
  1. Expose a public URL (for local testing)
  • Use a tunneling tool (e.g., ngrok): ngrok http http://localhost:8000
  • Note the public HTTPS URL.
  1. Configure the Bot in Azure
  • In Azure Bot registration, set the Messaging endpoint to: https://<your-public-host>/api/messages
  • Ensure Microsoft App ID/Password match your environment variables.
  1. Test from Teams
  • Add your bot to a Team or personal scope.
  • Send a message (e.g., "List projects"). The bot relays to main.py → agent and replies via Bot Framework.

Health check:

curl http://localhost:8000/health
# {"status":"ok","agent":"Phi Jira Agent ready"}

Notes:

  • The agent uses the same tools as the dashboard (ticket creation, status changes, search, epics, analytics queries).
  • Make sure Jira/Azure env vars are set in .env before starting.

### Example Commands

#### Project Management
```python
# List all projects
agent.run("List all projects",stream=False)

# List users
agent.run("List all users",stream=False)
agent.run("List users in project PROJ",stream=False)

Ticket Management

# Create a ticket
agent.run("Create a new task in project PROJ titled 'Implement login' with description 'Add user authentication' and priority High",stream=False)

# Assign a ticket
agent.run("Assign ticket PROJ-123 to user with account ID 5d8b8c8e-1234-5678-9abc-123456789abc",stream=False)

# Change ticket status
agent.run("Change ticket PROJ-123 status to 'In Progress'",stream=False)

# Edit ticket
agent.run("Edit ticket PROJ-123 to update summary to 'Updated: Implement login' and priority to Critical",stream=False)

# Get ticket details
agent.run("Get details for ticket PROJ-123",stream=False)

# Get ticket URL
agent.run("Get the URL for ticket PROJ-123",stream=False)

Epic Management

# Create an epic
agent.run("Create a new epic in project PROJ titled 'User Management System' with description 'Complete user management functionality'",stream=False)

# List epics
agent.run("List all epics",stream=False)
agent.run("List epics in project PROJ",stream=False)

Workflow Integration

The agent can handle Jira workflow transitions:

# Change ticket status (follows Jira workflow)
agent.run("Change ticket PROJ-123 status to 'In Progress'",stream=False)
agent.run("Change ticket PROJ-123 status to 'Done'",stream=False)
agent.run("Change ticket PROJ-123 status to 'To Do'",stream=False)

File Structure

jir_agent/
├── config.py              # Configuration settings
├── jira_client.py         # Jira API client
├── llm_client.py          # LLM client for Azure OpenAI
├── jira_tools.py          # Tool definitions for the agent
├── jira_agent.py          # Main agent implementation
├── example_usage.py       # Usage examples
├── requirements.txt       # Python dependencies
└── README.md             # This file

Configuration

Jira Setup

  1. Ensure you have access to a Jira instance
  2. Create an API token in your Atlassian account
  3. Update the configuration in config.py or .env file

Azure OpenAI Setup

  1. Create an Azure OpenAI resource
  2. Deploy a GPT-4o-mini model
  3. Get your API key and endpoint
  4. Update the configuration

Error Handling

The agent includes comprehensive error handling:

  • Connection validation
  • Input validation
  • Graceful error messages
  • Retry mechanisms for API calls

Security

  • API tokens are stored securely in environment variables
  • No hardcoded credentials in the code
  • Proper authentication for all Jira operations

Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Add tests if applicable
  5. Submit a pull request

License

This project is licensed under the MIT License.

Support

For issues and questions:

  1. Check the error messages for specific guidance
  2. Verify your Jira and Azure OpenAI configuration
  3. Ensure you have proper permissions in Jira
  4. Check the Jira API documentation for advanced features

Examples

See example_usage.py for comprehensive usage examples including:

  • Basic operations
  • Interactive mode
  • Error handling
  • Advanced JQL queries

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

jira_agent-0.1.3.tar.gz (29.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

jira_agent-0.1.3-py3-none-any.whl (30.2 kB view details)

Uploaded Python 3

File details

Details for the file jira_agent-0.1.3.tar.gz.

File metadata

  • Download URL: jira_agent-0.1.3.tar.gz
  • Upload date:
  • Size: 29.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.4

File hashes

Hashes for jira_agent-0.1.3.tar.gz
Algorithm Hash digest
SHA256 76c2c4991ffa5b63fe88255300e20467e59d808cf9059022fcabadaf4fad1fdd
MD5 00dbe6b6f11372a2d68878afd18e99e0
BLAKE2b-256 5a0f0a4c7c3ae7d7fdf39297f3f995dbc144032f59cbc2dfd8801822371e6ea1

See more details on using hashes here.

File details

Details for the file jira_agent-0.1.3-py3-none-any.whl.

File metadata

  • Download URL: jira_agent-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 30.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.4

File hashes

Hashes for jira_agent-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 d9045f42d7f394ad24f8fab3cd64867ec06448ffa01089a4c09a5c04d013955c
MD5 e30acd1fc30b30b143e7716ca44b6694
BLAKE2b-256 abc561e78499845a11bb2ec7afa00960fc2ce033fe5473b1710f42ff0aae6b9b

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page