Skip to content

For the complete documentation index, see llms.txt. Markdown versions of all docs pages are available by appending .md to any docs URL.

Build a CVE agent

Page as Markdown

Build an agent in the kagent UI that reads the CISA Known Exploited Vulnerabilities catalog and reports the newest entries.

Build a CVE agent

Build an agent in the kagent UI that reads the CISA Known Exploited Vulnerabilities catalog and reports the newest entries.

Build an agent that keeps watch on the CISA Known Exploited Vulnerabilities (KEV) catalog, the list of vulnerabilities that are being exploited in the wild. Ask it what is new, and it fetches the catalog and reports the latest entries.

The agent needs no extra tool server. Every agent on the kagent harness has a built-in bash tool, and the runtime image includes wget. What the agent does need is permission to leave its sandbox, so you start with an egress policy for www.cisa.gov.

Before you begin

  1. Install kagent.
  2. Open the kagent UI with kagent dashboard.

Allow the agent to reach CISA

The kagent UI creating an egress policy for www.cisa.gov, then an agent named cve-watch that uses it
Figure: Creating the egress policy and the cve-watch agent, sped up
  1. In the sidebar, click Policies, and then click Create egress policy.

  2. In the Name field, enter cisa-kev. Leave the Namespace as kagent.

  3. Under Destination 1, in the Origin field, enter https://www.cisa.gov. Leave Authentication set to None, because the catalog is public.

  4. Click Create policy.

Create the agent

  1. In the sidebar, click Agents, and then click New Agent.

  2. In the Name field, enter cve-watch. Leave the Namespace as kagent, and leave Shared harness set to kagent-default.

  3. In the Template section, select Inline, and fill in the template.

    FieldValue
    Model configurationkagent/default-model-config
    DescriptionReports the newest known exploited vulnerabilities from CISA
  4. In the System prompt field, enter the following prompt.

    You track the CISA Known Exploited Vulnerabilities (KEV) catalog.
    To read the newest entries, run this command with the bash tool:
    wget -qO- https://www.cisa.gov/sites/default/files/feeds/known_exploited_vulnerabilities.json | head -n 400
    The catalog lists the newest entries first. Never answer from memory. Always fetch the catalog first.
    For each vulnerability, report the CVE ID, the vendor and product, the date added, the due date, and whether it is used in ransomware campaigns.
    If the command fails, say so and show the error.

    The prompt gives the agent the exact command, for two reasons. The catalog is a large JSON file with the newest entries at the top, so head keeps the answer within what the bash tool returns. And a model that is told to always fetch does not answer from what it remembers, which is out of date for this kind of question.

  5. From the Egress policies list at the end of the form, choose cisa-kev. Without the policy, the agent cannot reach the catalog.

  6. Click Create agent, and then click Refresh until the agent is Ready.

Ask what is new

  1. Click the agent name, cve-watch, to open its chat page.

  2. Ask a question, such as What did CISA add to the catalog this week?

The conversation shows the bash tool call that fetches the catalog, and then the agent’s summary of the newest entries.

Get a daily report

To have the agent report without being asked, put it on a schedule.

  1. In the sidebar, click Schedules, and then click New Schedule.
  2. From the Agent list, choose kagent/cve-watch, and name the schedule kev-daily.
  3. Leave Repeat set to Daily, and in the Prompt field, enter List the vulnerabilities that CISA added in the last seven days.
  4. Click Create schedule.

Each run leaves its report in a conversation that you open from the schedule’s Execution history.

YAML version

Everything that you did in the UI is stored as Kubernetes resources. To create the same resources from the command line, or to keep them in a Git repository, apply this YAML.

The cisa-kev egress policy
kubectl apply -f - <<EOF
apiVersion: api.kagent.dev/v1alpha3
kind: EgressPolicy
metadata:
  name: cisa-kev
  namespace: kagent
spec:
  destinations:
    - origin: https://www.cisa.gov
EOF
The cve-watch agent, with the policy attached
kubectl apply -f - <<EOF
apiVersion: api.kagent.dev/v1alpha3
kind: Agent
metadata:
  name: cve-watch
  namespace: kagent
spec:
  harnessRef:
    name: kagent-default
  egressPolicyRefs:
    - name: cisa-kev
  template:
    inline:
      description: Reports the newest known exploited vulnerabilities from CISA
      modelConfig:
        name: default-model-config
      systemPrompt: |-
        You track the CISA Known Exploited Vulnerabilities (KEV) catalog.
        To read the newest entries, run this command with the bash tool:
        wget -qO- https://www.cisa.gov/sites/default/files/feeds/known_exploited_vulnerabilities.json | head -n 400
        The catalog lists the newest entries first. Never answer from memory. Always fetch the catalog first.
        For each vulnerability, report the CVE ID, the vendor and product, the date added, the due date, and whether it is used in ransomware campaigns.
        If the command fails, say so and show the error.
EOF

A schedule is not a Kubernetes resource, so it has no YAML. To create one without the UI, use the API, as described in Scheduled runs.

Next steps