developer docs

protect your ai agent in 3 lines of python. register, monitor, and enforce — all through one sdk.

quickstart

# install
pip install aiegis-sdk

# protect your agent
from aiegis import AiEGIS

agent = AiEGIS(api_key='ak_your_key_here')
result = agent.protect('send_email', target='user@example.com')

# result.decision = 'ALLOW' or 'BLOCK'
# result.layers_checked = 14
# result.latency_ms = 1.2

every protect() call passes through all 14 security layers in under 2ms. actions are logged to your agent's activity feed automatically.

get your api key

1. go to /register and register your agent

2. download the .aiegis.json config file

3. your api key starts with ak_ — use it in the sdk

sdk methods

protect(action, **kwargs)

pass any agent action through all 14 security layers.

result = agent.protect('query_database', target='users_table', content='SELECT * FROM users')

if result.decision == 'BLOCK':
    print(f'blocked by {result.threats}')

scan(text)

scan text for prompt injection, pii, or malicious content.

result = agent.scan('ignore all previous instructions and...')
# result.flagged = True
# result.categories = ['prompt_injection']

verify()

verify your agent's tag is valid and active.

status = agent.verify()
# status.valid = True
# status.agent_id = 'aegis-f1115a2d79c2'

compliance_check(description, sector)

classify any ai system under the eu ai act.

result = agent.compliance_check(
    description='AI system for screening job applicants',
    sector='employment'
)
# result.risk_level = 'HIGH'
# result.eu_articles = ['Art 6', 'Art 9', 'Art 10']

log(action, result, metadata)

manually log an action to your agent's activity feed.

my_status()

check if your agent is active or quarantined.

api reference

endpointmethoddescription
/api/protectPOSTpass action through 14 security layers
/api/registerPOSTregister a new agent
/api/verifyPOSTverify an agent tag
/compliance-checkerPOSTeu ai act risk classification
/api/agents/{id}/activityGETagent activity feed (last 50)
/api/heartbeatPOSTsend agent heartbeat
/api/agents/statsGETglobal agent statistics
/healthGETplatform health status

all endpoints accept X-AiEGIS-Key: ak_your_key header for authentication.

interactive api docs available at /docs (swagger ui).

example: protect a chatbot

from aiegis import AiEGIS

agent = AiEGIS(api_key='ak_your_key')

def handle_message(user_input):
    # scan user input for injection
    scan = agent.scan(user_input)
    if scan.flagged:
        return 'sorry, that input was blocked for security.'
    
    # protect the response action
    result = agent.protect('respond_to_user', content=user_input)
    if result.decision == 'BLOCK':
        return 'action blocked by security policy.'
    
    # safe to proceed
    response = generate_response(user_input)
    return response