|
| 1 | +# JIRA Integration Architecture |
| 2 | + |
| 3 | +## Overview |
| 4 | + |
| 5 | +The AI Agent module can discover and use JIRA capabilities from the dataplane module without having a direct dependency on it. This maintains a clean separation of concerns where the ai-agent focuses on AI functionality while the dataplane handles data access and integrations. |
| 6 | + |
| 7 | +## Architecture |
| 8 | + |
| 9 | +``` |
| 10 | +ai-agent module (no direct dependency on dataplane) |
| 11 | +├── VerbRegistry - discovers verbs from both modules |
| 12 | +│ ├── Scans: "io.sentrius.agent.analysis.agents.verbs" |
| 13 | +│ └── Scans: "io.sentrius.sso.core.integrations.ticketing" |
| 14 | +└── Gets JIRA verbs from Spring ApplicationContext |
| 15 | +
|
| 16 | +dataplane module (contains JIRA implementation) |
| 17 | +├── JiraVerbService - provides JIRA operations as @Verb methods |
| 18 | +│ ├── searchForTickets(@Verb) |
| 19 | +│ ├── assignTicket(@Verb) |
| 20 | +│ ├── updateTicket(@Verb) |
| 21 | +│ └── isJiraAvailable(@Verb) |
| 22 | +└── JiraService - actual JIRA integration logic |
| 23 | +``` |
| 24 | + |
| 25 | +## How It Works |
| 26 | + |
| 27 | +1. **Discovery**: The VerbRegistry in ai-agent scans both the ai-agent verbs package and the dataplane ticketing package using ClassGraph. |
| 28 | + |
| 29 | +2. **Loose Coupling**: The ai-agent doesn't import or depend on dataplane classes directly. Instead, it discovers them at runtime through the Spring ApplicationContext. |
| 30 | + |
| 31 | +3. **Runtime Integration**: When both modules are loaded in the same Spring application, the VerbRegistry can find and use the JIRA verbs from the dataplane module. |
| 32 | + |
| 33 | +4. **Graceful Degradation**: If the dataplane module is not available, the JIRA verbs simply won't be discovered, and the system continues to work without JIRA capabilities. |
| 34 | + |
| 35 | +## JIRA Capabilities Available to AI Agents |
| 36 | + |
| 37 | +When the dataplane module is loaded, AI agents can discover and use these JIRA capabilities: |
| 38 | + |
| 39 | +### Search for Tickets |
| 40 | +- **Verb**: `searchForTickets` |
| 41 | +- **Description**: Search for JIRA tickets using JQL or simple text |
| 42 | +- **Parameters**: `query` (String) |
| 43 | +- **Returns**: List of TicketDTO objects |
| 44 | + |
| 45 | +### Assign Ticket |
| 46 | +- **Verb**: `assignTicket` |
| 47 | +- **Description**: Assign a JIRA ticket to a user |
| 48 | +- **Parameters**: `ticketKey` (String), `user` (User) |
| 49 | +- **Returns**: Boolean (success/failure) |
| 50 | + |
| 51 | +### Update Ticket |
| 52 | +- **Verb**: `updateTicket` |
| 53 | +- **Description**: Add a comment to a JIRA ticket |
| 54 | +- **Parameters**: `ticketKey` (String), `user` (User), `message` (String) |
| 55 | +- **Returns**: Boolean (success/failure) |
| 56 | + |
| 57 | +### Check JIRA Availability |
| 58 | +- **Verb**: `isJiraAvailable` |
| 59 | +- **Description**: Check if JIRA integration is configured |
| 60 | +- **Parameters**: None |
| 61 | +- **Returns**: Boolean (available/unavailable) |
| 62 | + |
| 63 | +## Benefits of This Architecture |
| 64 | + |
| 65 | +1. **Separation of Concerns**: AI Agent focuses on AI functionality, dataplane handles data access |
| 66 | +2. **No Direct Dependencies**: Clean module boundaries without circular dependencies |
| 67 | +3. **Flexible Deployment**: Modules can be deployed independently |
| 68 | +4. **Discoverable Capabilities**: AI agents can dynamically discover available capabilities |
| 69 | +5. **Graceful Degradation**: System works even if JIRA integration is not available |
| 70 | + |
| 71 | +## Example Usage |
| 72 | + |
| 73 | +```java |
| 74 | +// AI Agent discovers JIRA capabilities |
| 75 | +VerbRegistry verbRegistry = applicationContext.getBean(VerbRegistry.class); |
| 76 | +verbRegistry.scanClasspath(); |
| 77 | + |
| 78 | +// Check if JIRA is available |
| 79 | +boolean jiraAvailable = verbRegistry.execute(execution, null, "isJiraAvailable", Map.of()); |
| 80 | + |
| 81 | +if (jiraAvailable) { |
| 82 | + // Search for tickets |
| 83 | + List<TicketDTO> tickets = verbRegistry.execute(execution, null, "searchForTickets", |
| 84 | + Map.of("query", "project = SUPPORT AND status = Open")); |
| 85 | + |
| 86 | + // Assign a ticket |
| 87 | + boolean assigned = verbRegistry.execute(execution, null, "assignTicket", |
| 88 | + Map.of("ticketKey", "SUPPORT-123", "user", currentUser)); |
| 89 | +} |
| 90 | +``` |
| 91 | + |
| 92 | +This architecture enables flexible JIRA integration while maintaining clean module boundaries and avoiding circular dependencies. |
0 commit comments