AI agents can investigate incidents, analyze logs, summarize failures, and recommend remediation steps. However, an investigation is only useful to an engineering team if its results reach the systems where developers track and resolve work.
Jira is commonly used to manage incidents, bugs, and engineering tasks, while Amazon EventBridge provides an event-driven way to connect AWS services and applications. By combining EventBridge with AWS Lambda and Jira's REST API, you can route completed AI agent investigations into Jira issues without tightly coupling the agent to the ticketing system.
This architecture is useful when an AWS-based agent produces investigation results asynchronously, when multiple downstream systems need the same events, or when ticket creation should be handled independently from the investigation itself.
The key is to treat the agent's output as an event that requires validation, routing, and controlled delivery rather than sending arbitrary model-generated text directly into Jira.
Understand the Architecture
A basic implementation contains four components:
AI agent: Investigates a problem and produces a structured result.
Amazon EventBridge: Receives the investigation-completed event and routes matching events to a target.
AWS Lambda: Validates the event, transforms the result, and calls Jira's REST API.
Jira: Stores the investigation as an issue for engineering follow-up.
<CodeBlock language="mermaid" editable={false}>
flowchart TD
A["AI Agent"] --> B["Investigation Result"]
B --> C["Amazon EventBridge"]
C --> D["Event Rule"]
D --> E["AWS Lambda"]
E --> F["Validate and Transform"]
F --> G["Jira REST API"]
G --> H["Jira Issue"]
E --> I["Failure Handling and Logs"]
</CodeBlock>The agent publishes an event when an investigation is complete. EventBridge evaluates the event against configured rules and invokes the Lambda function when the event matches.
The Lambda function validates the payload, maps the findings into a Jira issue, authenticates to Jira, and submits the request.
This separation lets the agent focus on investigation while the integration layer handles delivery, authentication, and ticket formatting.
Define a Structured Investigation Event
Start by defining a stable event contract. Avoid passing an unstructured paragraph when the downstream integration needs to extract severity, service names, evidence, and recommended actions.
For example, an investigation-completed event might look like this:
{
"version": "0",
"id": "event-8f6d21",
"source": "com.example.ai-investigator",
"detail-type": "Agent Investigation Completed",
"time": "2026-10-09T08:30:00Z",
"detail": {
"investigationId": "inv-4821",
"service": "payments-api",
"severity": "high",
"summary": "Payment requests are failing intermittently",
"findings": [
"Database connection acquisition latency increased",
"Connection pool saturation coincides with request failures"
],
"recommendedActions": [
"Inspect connection pool utilization",
"Review slow database queries",
"Compare database latency before and after the incident"
]
}
}The example uses an illustrative event schema. The actual fields should reflect the information your agent can reliably provide.
The source identifies the producer, while detail-type identifies the event category. These fields make it easier to route investigation-completed events separately from other agent events.
The investigationId is especially important. It gives the integration a stable identifier for correlating retries and preventing duplicate Jira issues.
Create an EventBridge Rule
EventBridge rules can match events using fields such as the source, detail type, and values inside the detail object.
For example, a rule can select completed investigations with high severity:
{
"source": [
"com.example.ai-investigator"
],
"detail-type": [
"Agent Investigation Completed"
],
"detail": {
"severity": [
"high",
"critical"
]
}
}This pattern matches events from the specified producer whose investigation-completed event has a severity of high or critical.
Use this rule when only significant findings should create Jira issues. A separate rule can route lower-severity findings to a reporting system or a review queue.
Configure the Lambda function as the rule's target and grant EventBridge permission to invoke it. The function should receive the event and process the detail payload.
You can create the rule through the EventBridge console, AWS infrastructure-as-code tooling, or the AWS CLI. For production deployments, infrastructure as code makes it easier to review changes and reproduce the integration across environments.
Implement the Lambda Integration
The Lambda function should validate the incoming event before making any external request. It should also avoid assuming that every event contains valid strings, supported severity values, or a usable investigation identifier.
The following Python example demonstrates the core integration using Jira's issue-creation REST endpoint.
import json
import os
import urllib.error
import urllib.request
JIRA_BASE_URL = os.environ["JIRA_BASE_URL"].rstrip("/")
JIRA_EMAIL = os.environ["JIRA_EMAIL"]
JIRA_API_TOKEN = os.environ["JIRA_API_TOKEN"]
JIRA_PROJECT_KEY = os.environ["JIRA_PROJECT_KEY"]
def validate_investigation(detail):
required = [
"investigationId",
"service",
"severity",
"summary",
]
for field in required:
value = detail.get(field)
if not isinstance(value, str) or not value.strip():
raise ValueError(
f"Missing or invalid field: {field}"
)
allowed_severities = {
"low", "medium", "high", "critical"
}
severity = detail["severity"].lower()
if severity not in allowed_severities:
raise ValueError("Unsupported severity")
return detail
def create_jira_issue(detail):
detail = validate_investigation(detail)
findings = detail.get("findings", [])
actions = detail.get("recommendedActions", [])
description = (
f"Investigation ID: {detail['investigationId']}\n"
f"Service: {detail['service']}\n"
f"Severity: {detail['severity']}\n\n"
f"Summary:\n{detail['summary']}\n\n"
f"Findings:\n"
+ "\n".join(f"- {item}" for item in findings)
+ "\n\nRecommended actions:\n"
+ "\n".join(f"- {item}" for item in actions)
)
payload = {
"fields": {
"project": {
"key": JIRA_PROJECT_KEY
},
"summary": (
f"[AI Investigation] "
f"{detail['service']}: "
f"{detail['summary']}"
),
"description": description,
"issuetype": {
"name": "Task"
},
"labels": [
"ai-investigation",
"automated-triage"
]
}
}
body = json.dumps(payload).encode("utf-8")
request = urllib.request.Request(
f"{JIRA_BASE_URL}/rest/api/3/issue",
data=body,
headers={
"Authorization": (
"Basic "
+ __import__("base64").b64encode(
f"{JIRA_EMAIL}:{JIRA_API_TOKEN}".encode()
).decode()
),
"Accept": "application/json",
"Content-Type": "application/json"
},
method="POST"
)
try:
with urllib.request.urlopen(
request,
timeout=15
) as response:
return json.loads(
response.read().decode("utf-8")
)
except urllib.error.HTTPError as exc:
error_body = exc.read().decode(
"utf-8",
errors="replace"
)
raise RuntimeError(
f"Jira returned HTTP {exc.code}: {error_body}"
) from exc
def lambda_handler(event, context):
detail = event.get("detail")
if not isinstance(detail, dict):
raise ValueError("Event detail must be an object")
issue = create_jira_issue(detail)
return {
"statusCode": 201,
"issueKey": issue.get("key"),
"investigationId": detail["investigationId"]
}
Join the conversation! Your thoughts help the community grow.