G8KEPR Python SDK
Official Python SDK for the G8KEPR API Security Platform.
Installation
pip install g8kepr
Quick Start
from g8kepr import G8KEPRClient
# Initialize client
client = G8KEPRClient(
base_url="https://api.g8kepr.com",
api_key="your-api-key"
)
# Or authenticate with email/password
client.auth.login(email="user@example.com", password="...")
# List AI agents
agents = client.agents.list()
for agent in agents:
print(f"Agent: {agent['name']} - Status: {agent['status']}")
# Get recent threats
threats = client.threats.get_recent(limit=10)
for threat in threats:
print(f"Threat: {threat['type']} - Severity: {threat['severity']}")
# MCP server management
servers = client.mcp.list_servers()
Features
Authentication
# Login
result = client.auth.login("user@example.com", "password")
# Get current user
user = client.auth.me()
# Refresh token
client.auth.refresh_token()
AI Agents
# List agents
agents = client.agents.list(status="active")
# Create agent
agent = client.agents.create(
name="MyAgent",
description="Production agent",
capabilities=["tool_use", "memory"],
tools=["read_file", "write_file"]
)
# Update agent
client.agents.update(agent["id"], status="inactive")
# Get interactions
interactions = client.agents.get_interactions(agent["id"])
MCP Security
# List MCP servers
servers = client.mcp.list_servers()
# Register server
server = client.mcp.register_server(
name="filesystem-server",
server_type="stdio",
connection_string="npx @modelcontextprotocol/server-filesystem"
)
# Check permissions
result = client.mcp.check_permission(
server_id="...",
tool_name="read_file",
arguments={"path": "/etc/passwd"}
)
print(f"Allowed: {result['allowed']}, Reason: {result['reason']}")
# Create permission rule
client.mcp.create_permission(
permission_type="user",
action="deny",
tool_name="delete_*",
priority=100
)
Threat Detection
# Get recent threats
threats = client.threats.get_recent(
limit=100,
threat_type="sql_injection",
blocked_only=True
)
# Get statistics
stats = client.threats.get_stats(period_hours=24)
print(f"Total threats: {stats['total']}")
print(f"Blocked: {stats['blocked']}")
# Block IP
client.threats.block_ip(
ip_address="192.168.1.100",
reason="Repeated SQL injection attempts",
duration_hours=24
)
Dashboard
# Get overview
overview = client.dashboard.get_overview()
# Get metrics
metrics = client.dashboard.get_metrics(period="7d", granularity="day")
# Get security score
score = client.dashboard.get_security_score()
print(f"Security Score: {score['overall']}/100")
Error Handling
from g8kepr import G8KEPRClient
from g8kepr.exceptions import (
AuthenticationError,
RateLimitError,
NotFoundError,
ValidationError,
)
client = G8KEPRClient(base_url="https://api.g8kepr.com")
try:
client.auth.login("user@example.com", "wrong_password")
except AuthenticationError as e:
print(f"Login failed: {e.message}")
try:
client.agents.get("nonexistent-id")
except NotFoundError as e:
print(f"Agent not found: {e.message}")
try:
# Rapid requests
for i in range(1000):
client.threats.get_recent()
except RateLimitError as e:
print(f"Rate limited. Retry after {e.retry_after} seconds")
Context Manager
# Automatic cleanup
with G8KEPRClient(base_url="...", api_key="...") as client:
agents = client.agents.list()
Requirements
- Python 3.8+
- httpx >= 0.24.0
License
Copyright (c) 2024-2025 Wesley Ellis. All Rights Reserved.
Metadata
Release files for g8kepr 1.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| g8kepr-1.0.0.tar.gz | 10.7 kB | Without provenance | Details for g8kepr-1.0.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| g8kepr-1.0.0-py3-none-any.whl | Python 3 | none | any | Details for g8kepr-1.0.0-py3-none-any.whl |
Total release size: 22.8 kB
Release files / g8kepr-1.0.0.tar.gz
| Download URL | g8kepr-1.0.0.tar.gz |
|---|---|
| Size | 10.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
77c2907c376e498f65f6769213240f8cd7bb57fa739cafcdd95e704d65b46ba3
|
|
BLAKE2b-256 checksum How to use checksums |
527f4b2a6580fd9442cf905147cdbed4cc2f8e9230ce888e027fcc5fc0da4447
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.3
|
Release files / g8kepr-1.0.0-py3-none-any.whl
| Download URL | g8kepr-1.0.0-py3-none-any.whl |
|---|---|
| Size | 12.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
36c339a79ab894dd6b66cf64f7cf01d275eb209968b50bfcd122c7985c0d4a7d
|
|
BLAKE2b-256 checksum How to use checksums |
68b545650ec2f115b9de1725e935ff3864941fde69b19f7fe6bf1233057671a9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.3
|
Security for g8kepr 1.0.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.