Current collected state Current
Observed since 21 Oct, 11:19 UTC
No superseded metadata states collected. Unchanged observations do not create new revisions.
Aim Security Guardrails for OpenAI Agents
This package provides guardrails for OpenAI agents that integrate with the Aim Security API to detect and prevent harmful content, sensitive data leakage, prompt injections, and other security threats.
# install with pip
pip install aim-guardrails
# or install with poetry
poetry add aim-guardrails
Set your Aim Security API key as an environment variable:
export AIM_API_KEY=<your-api-key>
You can use the helper functions to create guardrails with specific configurations:
from pydantic import BaseModel
from agents import Agent, Runner
from aim_guardrails import get_aim_input_guardrail, get_aim_output_guardrail
class MessageOutput(BaseModel):
response: str
# Create guardrails with custom configuration
input_guardrail = get_aim_input_guardrail(
api_key="your-custom-api-key", # Optional: defaults to AIM_API_KEY env var
api_base="https://your-custom-api-base.example.com", # Optional
user_email="user@example.com" # Optional: for tracking
)
output_guardrail = get_aim_output_guardrail(
api_key="your-custom-api-key", # Optional: defaults to AIM_API_KEY env var
api_base="https://your-custom-api-base.example.com", # Optional
user_email="user@example.com" # Optional: for tracking
)
# Create an agent with the configured guardrails
agent = Agent(
name="Customer support agent",
instructions="You are a customer support agent. You help customers with their questions.",
input_guardrails=[input_guardrail],
output_guardrails=[output_guardrail],
output_type=MessageOutput,
)
async def main():
try:
# This will be checked by the input guardrail
result = await Runner.run(agent, "Hello, can you help me with my question?")
print(f"Response: {result.final_output.response}")
except InputGuardrailTripwireTriggered as e:
print(f"Input guardrail triggered: {e}")
except OutputGuardrailTripwireTriggered as e:
print(f"Output guardrail triggered: {e}")
if __name__ == "__main__":
import asyncio
asyncio.run(main())
Download counts and popularity will appear here as the collector receives them.
| Version | Published | Direct dependencies | Open version |
|---|---|---|---|
| 0.1.2 | 13 Mar 2025 | 4 |
This describes our collected data; it is not a security assessment.
Shared repository data · GitHub
Observed since 21 Oct, 11:19 UTC
No superseded metadata states collected. Unchanged observations do not create new revisions.
package:7c2915db710839a21bd30d751ab7275c2d82019881411515bc01b35e62bd6ea6