-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
feat: add JIRA Agent watch tools for monitoring issues and projects #1875
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
praisonai-triage-agent
wants to merge
2
commits into
main
Choose a base branch
from
claude/issue-1873-20260609-2014
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+801
β1
Open
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,115 @@ | ||
| #!/usr/bin/env python3 | ||
| """ | ||
| JIRA Agent Watch Example | ||
|
|
||
| This example demonstrates how to use the JIRA watch tools with PraisonAI agents. | ||
| The agent can monitor JIRA issues and projects for changes, search for issues, | ||
| and get detailed issue information. | ||
|
|
||
| Setup: | ||
| 1. Install JIRA library: pip install jira | ||
| 2. Set environment variables: | ||
| - JIRA_EMAIL=your_email@example.com (for cloud JIRA) | ||
| - JIRA_API_TOKEN=your_api_token | ||
| - Or use JIRA_USERNAME + JIRA_API_TOKEN for server JIRA | ||
|
|
||
| Usage: | ||
| python jira_agent_example.py | ||
| """ | ||
|
|
||
| import os | ||
| from praisonaiagents import Agent | ||
| from praisonaiagents.tools import jira_tools | ||
|
|
||
|
|
||
| def main(): | ||
| """Demonstrate JIRA agent watch capabilities.""" | ||
|
|
||
| # Check if JIRA credentials are available | ||
| jira_email = os.getenv('JIRA_EMAIL') | ||
| jira_token = os.getenv('JIRA_API_TOKEN') | ||
| jira_username = os.getenv('JIRA_USERNAME') | ||
|
|
||
| if not jira_token: | ||
| print("β JIRA_API_TOKEN environment variable not set") | ||
| print("Please set your JIRA API token:") | ||
| print("export JIRA_API_TOKEN='your_token_here'") | ||
| return | ||
|
|
||
| if not (jira_email or jira_username): | ||
| print("β JIRA credentials incomplete") | ||
| print("Please set either:") | ||
| print("- JIRA_EMAIL (for cloud JIRA)") | ||
| print("- JIRA_USERNAME (for server JIRA)") | ||
| return | ||
|
|
||
| # Create agent with JIRA tools | ||
| agent = Agent( | ||
| name="JIRA Monitor Agent", | ||
| instructions=""" | ||
| You are a JIRA monitoring agent. You can: | ||
|
|
||
| 1. Watch specific JIRA issues for changes | ||
| 2. Monitor JIRA projects for new issues and updates | ||
| 3. Search for issues using JQL queries | ||
| 4. Get detailed information about specific issues | ||
|
|
||
| When using JIRA tools, always provide the full JIRA URL | ||
| (e.g., https://yourcompany.atlassian.net). | ||
|
|
||
| Be helpful and provide clear summaries of JIRA activity. | ||
| """, | ||
| tools=jira_tools(), # Add all JIRA tools | ||
| llm="gpt-4o-mini" | ||
| ) | ||
|
|
||
| print("π― JIRA Agent Watch Example") | ||
| print("=" * 50) | ||
| print() | ||
| print("Available JIRA tools:") | ||
| print("- jira_watch_issue: Monitor a specific issue for changes") | ||
| print("- jira_watch_project: Monitor a project for new/updated issues") | ||
| print("- jira_get_issue_info: Get detailed info about an issue") | ||
| print("- jira_search_issues: Search issues using JQL") | ||
| print() | ||
|
|
||
| # Example interactions | ||
| example_prompts = [ | ||
| "Get information about JIRA issue DEMO-1 from https://praisonai.atlassian.net", | ||
| "Search for open issues in project DEMO from https://praisonai.atlassian.net using JQL: 'project = DEMO AND status = Open'", | ||
| "Watch JIRA issue DEMO-1 from https://praisonai.atlassian.net for 2 minutes (check every 60 seconds, max 2 checks)", | ||
| ] | ||
|
|
||
| print("π Example prompts you can try:") | ||
| for i, prompt in enumerate(example_prompts, 1): | ||
| print(f"{i}. {prompt}") | ||
| print() | ||
|
|
||
| # Interactive mode | ||
| print("π¬ Interactive JIRA Agent (type 'quit' to exit)") | ||
| print("-" * 50) | ||
|
|
||
| while True: | ||
| try: | ||
| user_input = input("\nπ§ You: ").strip() | ||
|
|
||
| if user_input.lower() in ['quit', 'exit', 'q']: | ||
| print("π Goodbye!") | ||
| break | ||
|
|
||
| if not user_input: | ||
| continue | ||
|
|
||
| print("π€ Agent: ", end="", flush=True) | ||
| response = agent.start(user_input) | ||
| print(response) | ||
|
|
||
| except KeyboardInterrupt: | ||
| print("\nπ Goodbye!") | ||
| break | ||
| except Exception as e: | ||
| print(f"β Error: {e}") | ||
|
|
||
|
|
||
| if __name__ == "__main__": | ||
| main() | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Handle EOF explicitly and stop the REPL loop on failures.
input()raisesEOFErroron Ctrl-D; with onlyexcept Exceptionitβs treated as a generic error and the loop continues (poor UX). Add anexcept EOFErrorexit path and break after unexpected exceptions.Suggested patch
π Committable suggestion
π§° Tools
πͺ Ruff (0.15.15)
[warning] 110-110: Do not catch blind exception:
Exception(BLE001)
π€ Prompt for AI Agents