> ## Documentation Index
> Fetch the complete documentation index at: https://docs.anyshift.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Graph SDK Capabilities

> What developers can build with the Anyshift Graph SDK and Graph API.

The Graph SDK is a programmable interface to Anyshift's infrastructure graph. Use it when you need graph answers inside automation, dashboards, CI checks, incident workflows, deployment gates, or developer tools.

For the exhaustive source-of-truth matrix, see [`CAPABILITIES.md`](https://github.com/anyshift-io/anyshift-graph-sdk/blob/main/CAPABILITIES.md) in the SDK repository.

## Dependency and Impact Analysis

| Goal                          | SDK helper             | Use it for                                                                           |
| ----------------------------- | ---------------------- | ------------------------------------------------------------------------------------ |
| Find direct neighbors         | `graph.connections()`  | Show what is directly connected to a service, workload, node, config, or dependency. |
| Compute blast radius          | `graph.blast()`        | Estimate what is affected if a resource changes or fails.                            |
| Trace a path                  | `graph.path()`         | Explain how two resources are connected.                                             |
| Expand a service footprint    | `graph.serviceTree()`  | Build a downstream dependency tree for service reviews or incident prep.             |
| Explain shared failure causes | `graph.commonCause()`  | Find shared nodes or workloads behind recent failures.                               |
| Check deployment fallout      | `graph.deployImpact()` | Rank risky recent deploys or inspect one workload's rollout impact.                  |

## Timelines and Change Feeds

| Goal                     | SDK helper            | Use it for                                                                 |
| ------------------------ | --------------------- | -------------------------------------------------------------------------- |
| Read recent graph events | `graph.events()`      | Pull recent changes for a namespace, resource, event type, or time window. |
| Find noisy resources     | `graph.hotspots()`    | Rank noisy resources, namespaces, alert rules, or alerting workloads.      |
| Read failure events      | `graph.failures()`    | Feed failure timelines into automation or reports.                         |
| Read deployment events   | `graph.deployments()` | Track rollouts and deployment activity.                                    |
| Read audit activity      | `graph.audit()`       | Inspect config, identity, or infrastructure changes.                       |
| Trace incident cascades  | `graph.cascade()`     | Follow a correlated incident from trigger to impacted resources.           |

## Topology and Diagrams

| Goal                   | SDK helper         | Use it for                                                                 |
| ---------------------- | ------------------ | -------------------------------------------------------------------------- |
| Build service topology | `graph.topology()` | Get typed graph nodes and edges for a service neighborhood.                |
| Render Mermaid         | `toMermaid()`      | Embed topology diagrams in PRs, incident reports, runbooks, or dashboards. |

Topology supports `context`, `container`, `component`, and `dynamic` levels. Dynamic topology renders as a sequence diagram; the other levels render as flowcharts.

## Kubernetes Safety and Hygiene

| Goal                          | SDK helper         | Use it for                                                                           |
| ----------------------------- | ------------------ | ------------------------------------------------------------------------------------ |
| Find single points of failure | `graph.spof()`     | Rank highly shared ConfigMaps, service accounts, or nodes.                           |
| Find orphaned resources       | `graph.orphans()`  | Detect unused ConfigMaps, service accounts, roles, or ReplicaSets.                   |
| Check PDB coverage            | `graph.pdb()`      | Find workloads that are unsafe during voluntary disruptions.                         |
| Check autoscaler coverage     | `graph.scaling()`  | Find workloads without HPAs or inspect what an HPA scales.                           |
| Check scheduling priority     | `graph.priority()` | Find workloads without priority classes or inspect the preemption ladder.            |
| Inspect persistent storage    | `graph.storage()`  | Trace PVC/PV/StorageClass usage and find orphaned or unclaimed storage.              |
| Inspect image usage           | `graph.image()`    | Find who runs an image, inspect a workload's images, or run container hygiene scans. |

## Security and Exposure

| Goal                            | SDK helper                             | Use it for                                                                    |
| ------------------------------- | -------------------------------------- | ----------------------------------------------------------------------------- |
| Inspect RBAC reach              | `graph.access()`                       | Understand what a subject can do or who can reach a role.                     |
| Find over-privileged identities | `graph.access({ mode: "privileged" })` | Rank service accounts with broad or risky grants.                             |
| Inspect NetworkPolicy coverage  | `graph.netpol()`                       | Detect default-allow namespaces, inspect policies, or model east-west reach.  |
| Inspect public exposure         | `graph.exposure()`                     | Map ingresses to services/workloads or find which ingress exposes a resource. |

## Observability and Alerting

| Goal                           | SDK helper            | Use it for                                                                     |
| ------------------------------ | --------------------- | ------------------------------------------------------------------------------ |
| Find monitoring gaps           | `graph.coverage()`    | Find workloads missing Datadog presence, monitors, or metrics shipping.        |
| Map alert impact               | `graph.alertImpact()` | Find which monitors and SLOs would fire if a resource is impacted.             |
| Map monitors to infrastructure | `graph.monitor()`     | Resolve a monitor to the service, workload, and node it watches.               |
| Read active alerts             | `graph.alerts()`      | Pull currently firing Datadog monitors, optionally scoped to a service.        |
| Find noisy alerts              | `graph.alertNoise()`  | Rank flapping or stuck monitors.                                               |
| Explain alert cause            | `graph.alertCause()`  | Link a firing service to recent Kubernetes changes.                            |
| Inspect SLO health             | `graph.slo()`         | Rank breaching or at-risk SLOs, or inspect one named SLO.                      |
| Inspect Grafana/Victoria rules | `graph.alertRules()`  | Find alert-rule coverage gaps, inventory rules, or inspect one target's rules. |

## Service Dependencies and Ownership

| Goal                           | SDK helper            | Use it for                                                                                |
| ------------------------------ | --------------------- | ----------------------------------------------------------------------------------------- |
| Inspect datastore dependencies | `graph.datastore()`   | Find services using a datastore, or rank heavily used datastores.                         |
| Inspect stream dependencies    | `graph.flow()`        | Find producers and consumers for topics or streams.                                       |
| Inspect external dependencies  | `graph.externalDep()` | Find services depending on an external host.                                              |
| Inspect service calls          | `graph.calls()`       | Find callers and callees for a service, or rank high-traffic services.                    |
| Inspect GitOps drift           | `graph.gitops()`      | Find drifted ArgoCD apps, unmanaged workloads, or a workload's owning app and repository. |

## Choosing the Right Entry Point

Use typed helpers when you need deterministic automation. Use `graph.query()` when you need a graph SQL escape hatch. Use `graph.ask()` when the caller has a natural-language question and can accept server-side routing.

<Tip>
  For full parameter details and the underlying query intent names, use the SDK repository's [`CAPABILITIES.md`](https://github.com/anyshift-io/anyshift-graph-sdk/blob/main/CAPABILITIES.md).
</Tip>
