langflow-attesta package provides the Attesta Approval component for Langflow. It is a Python component that evaluates AI agent actions for risk and returns a structured Data object with the verdict, risk score, and audit information.
Package:
langflow-attesta | Language: Python | Dependencies: attesta >=0.1.0 | Runtime: Langflow component system (lfx.custom.custom_component.component.Component)Installation
The Attesta Approval component can be installed in two ways: as a contribution to the Langflow source tree, or as a custom component loaded at runtime.- Langflow Source Contribution
- Custom Component (LANGFLOW_COMPONENTS_PATH)
Follow the Langflow contributing components guide:
1
Copy the component file
2
Register in __init__.py
Add the import to the Tools category init file:
3
Add the dependency
Add
attesta to the Langflow pyproject.toml:4
Restart Langflow
Restart Langflow. The Attesta Approval component appears in the Tools category on the canvas.
Component Configuration
The component exposes four inputs in the Langflow canvas:
The component has one output:
How It Works
1
Parse Inputs
The component parses Action Arguments and Risk Hints from JSON strings into Python dictionaries using the
_parse_json() helper. Invalid JSON is silently replaced with an empty dict, and a warning is logged via self.log().2
Configure Risk Override
If Risk Level is set to anything other than
auto, the component creates a RiskLevel enum value (e.g., RiskLevel.HIGH) and passes it as risk_override to the Attesta instance. When set to auto, risk_override is None and the built-in scorer determines the level.3
Build ActionContext
The component creates an
ActionContext:4
Evaluate
The
ActionContext is passed to attesta.evaluate() (async). The Attesta pipeline runs risk scoring, challenge selection, and verification.5
Return Data
The component returns a Langflow
Data object containing the full evaluation result, including review_time_seconds and the echoed function_name.Output Format
The Approval Result output is a LangflowData object with the following fields:
- Approved
- Denied
The
denied field is a convenience boolean that is True when the verdict is denied, timed_out, or escalated. Use this for simple conditional routing in your pipeline.Pipeline Examples
Example: Gate a Deployment Action
- Open a pipeline in Langflow.
- Drag the Attesta Approval component onto the canvas.
- Configure:
- Function Name:
deploy_service - Risk Level:
high - Action Arguments:
{"service": "api-gateway", "version": "2.1.0"} - Risk Hints:
{"production": true}
- Function Name:
- Connect the Approval Result output to a conditional component or downstream tool.
Example: Dynamic Arguments from Upstream
Connect the output of an upstream component (e.g., a Text Input or LLM) to the Action Arguments field:{"to": "ceo@company.com", "body": "..."}) is passed as the action arguments for risk evaluation.
Pipeline Patterns
Pattern: Conditional Execution
Use the outputData object’s denied field in a conditional component:
Pattern: Chained Evaluation
Evaluate multiple actions in sequence, each with appropriate risk levels:Pattern: High-Risk Action with Hints
For actions that are inherently dangerous, set explicit risk hints:- Set Function Name to
drop_database_table. - Set Risk Level to
critical. - Set Risk Hints to:
- The risk scorer will combine the destructive verb, the critical override, and the hints to produce a very high risk score, triggering multi-party approval.
JSON Parsing Behavior
Both Action Arguments and Risk Hints accept JSON strings. The_parse_json() helper handles edge cases gracefully:
Source Code Reference
The component extends Langflow’sComponent base class:
evaluate_gate method is async and handles the full Attesta pipeline. The _parse_json private method provides safe JSON parsing with logging.
Related Pages
n8n Integration
Workflow node for n8n data pipelines
Flowise Integration
Tool component for Flowise chatflows
Dify Integration
Plugin tool for the Dify platform
No-Code Overview
Compare all no-code platforms