Creating Custom Links
How to create custom processing links
Links are the modular processing units of the Conserver. This guide explains how to create your own custom links to extend the system's functionality.
Link Interface
Every link must implement a run function with this signature:
def run(
vcon_uuid: str,
link_name: str,
opts: dict = default_options
) -> str | None:
"""
Process a vCon through this link.
Args:
vcon_uuid: UUID of the vCon to process
link_name: Name of this link instance in config
opts: Configuration options merged with defaults
Returns:
str: vCon UUID to continue chain (usually same as input)
None: Stop chain processing for this vCon
"""Basic Link Template
Working with vCon Objects
Reading vCon Data
Processing Dialogs
Checking Existing Analysis
Adding Results
Filtering and Routing
Stopping Chain Processing
Return None to stop processing for this vCon:
Routing to Different Queues
External API Integration
With Retry Logic
Metrics and Monitoring
Project Structure
Organize your link as a Python package:
__init__.py
__init__.pyConfiguration
Configure your link in config.yml:
Distribution
As a PyPI Package
As a GitHub Repository
Reference directly in config:
Testing
Best Practices
Always merge options with defaults - Ensures your link works even with partial configuration
Check if processing already done - Avoid reprocessing if analysis already exists
Use structured logging - Include vCon UUID and link name in all log messages
Handle errors appropriately - Raise exceptions to send vCons to DLQ, or return UUID to continue
Add metrics - Track processing time, success/failure rates
Document your options - Make it clear what configuration your link accepts
Test thoroughly - Unit test your processing logic
Be idempotent - Running twice should produce the same result
Last updated
Was this helpful?