Documentation Index
Fetch the complete documentation index at: https://docs.secapi.ai/llms.txt
Use this file to discover all available pages before exploring further.
Build a Compliance Screening Agent
Compliance teams need to stay on top of regulatory actions and corporate governance events across their client universe. This tutorial builds an agent that monitors enforcement actions, financial restatements, auditor changes, and officer changes using the OMNI Datastream REST API and webhooks, then delivers structured alerts.What you will build
- A webhook-based compliance monitoring system
- Screening for enforcement actions, restatements, auditor changes, and officer changes
- Structured alert payloads with severity classification
- A webhook handler that routes alerts by type and severity
- A polling fallback for environments where webhooks are not available
Prerequisites
- An Omni Datastream API key (set as
OMNI_DATASTREAM_API_KEY) - Python 3.9+ (for the webhook handler)
- A publicly accessible HTTPS endpoint (use ngrok for local development)
- (Optional) Node.js 18+ for the JavaScript handler variant
Step 1 — Define your client universe
Create a configuration file that defines the companies you are monitoring and the alert routing rules.config.json:
Step 2 — Register webhook endpoints
Set up webhook endpoints with the OMNI Datastream API to receive push notifications for compliance events.id and signing_secret for use in your handler.
Step 3 — Build the webhook handler
Createhandler.py with a Flask server that receives and processes compliance events.
Step 4 — Build the polling fallback
For environments where webhooks are not feasible, createpoller.py that checks for new events on a schedule.
Step 5 — Deploy the webhook handler
Run the handler locally for testing with ngrok, then deploy to your server.Local testing with ngrok
Production deployment (Docker)
Create aDockerfile:
requirements.txt:
Step 6 — Test with sample events
Verify the handler processes events correctly by sending a test payload.Expected output
The handler will return:Step 7 — Set up the polling schedule
For the polling fallback, schedule it to run every 4 hours during business days.Next steps
- Add email alerts: Extend the handler to send email notifications using the
alert_emailfrom the config for critical severity events. - Build a compliance dashboard: Store events in a database and build a web UI that shows the compliance status for each portfolio.
- Regulatory filing analysis: Use the
/v1/intelligence/queryendpoint to analyze filing content and surface potential compliance issues. - Integration with GRC platforms: Forward alerts to ServiceNow, Archer, or other governance, risk, and compliance platforms via their APIs.