Giving AI Agents On-Call Memory: Building a PagerDuty Connector for Cognee
The Problem: The Disconnected Incident Room When production breaks at 3 AM, PagerDuty pages the on-call engineer. Responders assemble, diagnose the issue, mitigate the failure, and acknowledge or resolve the incident. Thousands of critical context bits are generated in that frantic window: Which se
When production breaks at 3 AM, PagerDuty pages the on-call engineer. Responders assemble, diagnose the issue, mitigate the failure, and acknowledge or resolve the incident.
Thousands of critical context bits are generated in that frantic window:
Yet once resolved, this rich operational history disappears into closed ticket archives. When your team asks an AI agent "What triggered our last payment gateway degradation?" or "Who usually leads recovery on our Kafka clusters?", the agent is clueless because that operational context was never connected to its memory graph.
In this post, we explain how we built a production-grade PagerDuty data-source connector for Cognee to bridge this gap.
Cognee transforms raw unstructured text into structured, searchable Knowledge Graphs and vector embeddings for AI agents. Rather than running blind RAG over uncurated chunks, Cognee builds an explicit entity-relationship memory graph so agents can query complex operational dependencies.
Connecting PagerDuty to Cognee required solving several real-world requirements:
Cognee extracts entities from natural prose. Instead of dumping arbitrary JSON schemas, our connector synthesizes PagerDuty incident payloads into structured Markdown:
PagerDuty v2 REST API exposes /incidents paginated with limit (max 100) and offset. The connector iterates until more=false or no records remain, ensuring complete historical coverage without skipping records.
PagerDuty APIs enforce rate limits. Our HTTP client automatically catches HTTP 429 and 5xx errors, extracts the Retry-After header when available, and falls back to an exponential backoff strategy (2^attempt seconds) up to 5 retries.
Using write_disposition="replace", Cognee maintains a fresh snapshot of all active and resolved incidents. If false-alarm incidents are deleted or retracted upstream, Cognee's orphan_cleanup purges their entities automatically.
`python import asyncio import os import cognee from cognee_community_connector_pagerduty import pagerduty_source
async def main(): # Configure connector with high-urgency filter source = pagerduty_source( api_token=os.environ["PAGERDUTY_API_TOKEN"], urgencies=["high"] )
# Ingest and construct Knowledge Graph await cognee.add(source) await cognee.cognify() # Query operational memory answer = await cognee.search("Who resolved the last payment outage and what service was affected?") print(answer) Enter fullscreen mode Exit fullscreen mode if name == " main ": asyncio.run(main()) `
We wrote a suite of 27 offline unit tests using standard library mocks covering:
If your team uses PagerDuty, try ingesting your operational history into Cognee and let us know what you think!