Security & Vuln Intel
Open a Pull Request with a patch or fix.
github_create_prLets the agent open a Pull Request on GitHub. This is how self-fixing agents (say, one that patches a vulnerability) put their proposed change in front of a human reviewer, rather than silently editing code.
Posts a 'Create pull request' request to the GitHub REST API. You supply owner, repo, title, body, head branch, and base branch; the tool returns the URL of the new PR. Requires a GitHub token with 'repo' write scope; flagged DANGEROUS in the framework's permission system because it modifies an external system.
When a user asks:
Open a PR with the Log4j fix we just wrote.
the agent calls the tool:
github_create_pr(owner="acme", repo="webapp", title="Bump log4j to 2.17", head="fix/log4j", base="main")and gets back: the URL of the newly created Pull Request.
Set these before calling the tool. Values marked required must be present or the tool call will fail.
GITHUB_TOKEN required GitHub personal access token with 'repo' scope. Used as Bearer auth to POST pull requests.
Wire this tool into a SwarmAI crew. Use the YAML DSL for declarative workflows, or the Java builder API when you want full programmatic control.
YAML DSL
# remediation.yaml
name: remediation-crew
process: SEQUENTIAL
agents:
- id: engineer
role: Remediation Engineer
goal: Land security patches as reviewable pull requests
tools:
- github_create_pr
tasks:
- id: remediation-task
agent: engineer
description: Open a PR in acme/webapp titled 'Bump log4j to 2.17' from fix/log4j into main.Java
import ai.intelliswarm.swarmai.agent.Agent;
import ai.intelliswarm.swarmai.task.Task;
import ai.intelliswarm.swarmai.swarm.Swarm;
import ai.intelliswarm.swarmai.swarm.SwarmOutput;
import ai.intelliswarm.swarmai.process.ProcessType;
import ai.intelliswarm.swarmai.tool.security.GitHubPRTool;
import org.springframework.ai.chat.client.ChatClient;
import org.springframework.beans.factory.annotation.Autowired;
@Autowired ChatClient chatClient;
@Autowired GitHubPRTool gitHubPRTool;
Agent engineer = Agent.builder()
.role("Remediation Engineer")
.goal("Land security patches as reviewable pull requests")
.chatClient(chatClient)
.tool(gitHubPRTool)
.build();
Task engineerTask = Task.builder()
.description("Open a PR in acme/webapp titled 'Bump log4j to 2.17' from fix/log4j into main.")
.agent(engineer)
.build();
SwarmOutput result = Swarm.builder()
.agent(engineer)
.task(engineerTask)
.process(ProcessType.SEQUENTIAL)
.build()
.kickoff();Real scenarios where agents put this tool to work.
Implementation lives at swarmai-tools/src/main/java/ai/intelliswarm/swarmai/tool/security/GitHubPRTool.java in the swarm-ai repository.