Observed since 20 Oct, 22:07 UTC
No superseded metadata states collected. Unchanged observations do not create new revisions.
Python SDK for AgentGuard - AI Agent governance and monitoring platform
Python SDK for integrating with AgentGuard - AI Agent governance and monitoring platform.
pip install agentguard-zhx
from agentguard import AgentGuardOpenAI
# Initialize client
client = AgentGuardOpenAI(
agentguard_url="http://localhost:8080",
agent_api_key="ag_xxx"
)
# Use standard OpenAI API
response = client.chat.completions.create(
model="gpt-4",
messages=[{"role": "user", "content": "Hello"}]
)
print(response.choices[0].message.content)
Query approval status using integrated approval management:
from agentguard import AgentGuardOpenAI
# One client for everything
client = AgentGuardOpenAI(
agentguard_url="http://localhost:8080",
agent_api_key="ag_xxx"
)
# LLM calls
response = client.chat.completions.create(...)
# Approval management (integrated)
status = client.approvals.get_status("approval_id")
if status.is_approved:
print("Approved:", status.execution_result)
elif status.is_rejected:
print("Rejected:", status.remark)
# Submit approval reason
client.approvals.submit_reason("approval_id", "Need to delete test data")
# Set environment variables
export AGENTGUARD_URL="http://localhost:8080"
export AGENTGUARD_API_KEY="ag_xxx"
# Use without explicit configuration
from agentguard import AgentGuardOpenAI
client = AgentGuardOpenAI() # Loads from environment
from agentguard import enable_agentguard
import requests
# Enable global interception
enable_agentguard(
agentguard_url="http://localhost:8080",
agent_api_key="ag_xxx",
intercept_patterns=[r"https://api\.example\.com/.*"]
)
# All matching requests go through AgentGuard
response = requests.get("https://api.example.com/data")
from agentguard import AgentGuardConfig, AgentGuardOpenAI
config = AgentGuardConfig(
agentguard_url="http://localhost:8080",
agent_api_key="ag_xxx"
)
client = AgentGuardOpenAI(config=config)
See the examples/ directory for more examples:
basic_usage.py - Basic OpenAI integrationapproval_polling.py - Query approval statusbusiness_api.py - Business API interceptionDrop-in replacement for OpenAI client with integrated approval management.
Parameters:
agentguard_url (str): AgentGuard server URLagent_api_key (str): AgentGuard API keyconfig (AgentGuardConfig, optional): Configuration objectIntegrated Approval Management:
Access via client.approvals:
get_status(approval_id) - Query approval status by IDsubmit_reason(approval_id, reason) - Submit approval reason/justificationReturns: ApprovalStatusResponse with:
status - ApprovalStatus enum (PENDING/APPROVED/REJECTED/EXPIRED)execution_result - Result if approved and executedremark - Rejection reason if rejectedis_pending, is_approved, is_rejected, is_expired - Helper propertiesEnable global request interception for the requests library.
Parameters:
agentguard_url (str): AgentGuard server URLagent_api_key (str): AgentGuard API keyintercept_patterns (List[str], optional): URL patterns to intercept (regex)# Install development dependencies
pip install -e ".[dev]"
# Run tests
pytest
# Format code
black agentguard/
# Lint code
ruff check agentguard/
MIT License
Download counts and popularity will appear here as the collector receives them.
| Version | Published | Direct dependencies | Open version |
|---|---|---|---|
| 0.0.3 | 27 Feb 2026 | 8 |
This describes our collected data; it is not a security assessment.
Shared repository data · GitHub
Observed since 20 Oct, 22:07 UTC
No superseded metadata states collected. Unchanged observations do not create new revisions.
package:bec2536669436fe736861ba17a43096c454c89f7ebe7bc8835b4ce5c4aed45d1