Example: GitHub Agent
An AI agent that reads repositories, creates issues, and reviews pull requests — with credentials injected automatically so the agent code never holds a token.
Setup
1. Add your GitHub credential
In the dashboard → Credentials → Add Credential:
- Name:
github-prod - Hostname:
api.github.com - Type: Bearer
- Value:
ghp_xxxxxxxxxxxxxxxx
2. Create an agent and get the proxy URL
Go to Agents → New Agent → github-bot.
Copy the proxy URL: https://api.agentic-guard.com/proxy/ag_xxx/
3. Set a policy
version: "1"
rules:
- tool: github
action: DELETE
decision: deny
message: "Repository deletion is not permitted"
- tool: github
action: POST
require_reasoning: true
message: "Creating resources requires reasoning"
Agent code (proxy URL style)
import httpx
PROXY = "https://api.agentic-guard.com/proxy/ag_xxx/"
def get_repo(owner: str, repo: str) -> dict:
resp = httpx.get(f"{PROXY}api.github.com/repos/{owner}/{repo}")
resp.raise_for_status()
return resp.json()
def create_issue(owner: str, repo: str, title: str, body: str, reasoning: str) -> dict:
resp = httpx.post(
f"{PROXY}api.github.com/repos/{owner}/{repo}/issues",
json={"title": title, "body": body},
headers={"X-Agent-Reasoning": reasoning},
)
resp.raise_for_status()
return resp.json()
def list_pull_requests(owner: str, repo: str) -> list:
resp = httpx.get(f"{PROXY}api.github.com/repos/{owner}/{repo}/pulls")
resp.raise_for_status()
return resp.json()
Agent code (SDK style)
from agentic_guard import AgenticGuard
from agentic_guard.wrappers import GitHubWrapper
gate = AgenticGuard(api_key="ag_xxx", mode="enforce")
github = GitHubWrapper(gate, task_id="pr_review_task")
repo = github.get_repo("openai/openai-python")
issues = github.list_issues("openai/openai-python", state="open")
What gets injected
Your GitHub PAT is never in your agent code. When the proxy receives:
GET api.github.com/repos/openai/openai-python
It becomes:
GET https://api.github.com/repos/openai/openai-python
Authorization: Bearer ghp_xxxxxxxxxxxxxxxx