Skip to main content
The 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.
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:
The Risk Hints input is marked as advanced=True, meaning it is hidden by default in the Langflow UI. Click “Show Advanced” on the component to reveal it. For most use cases, the automatic risk scorer combined with the Function Name provides sufficient accuracy.

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 Langflow Data object with the following fields:
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

  1. Open a pipeline in Langflow.
  2. Drag the Attesta Approval component onto the canvas.
  3. Configure:
    • Function Name: deploy_service
    • Risk Level: high
    • Action Arguments: {"service": "api-gateway", "version": "2.1.0"}
    • Risk Hints: {"production": true}
  4. 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:
The parsed LLM output (e.g., {"to": "ceo@company.com", "body": "..."}) is passed as the action arguments for risk evaluation.

Pipeline Patterns

Pattern: Conditional Execution

Use the output Data 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:
  1. Set Function Name to drop_database_table.
  2. Set Risk Level to critical.
  3. Set Risk Hints to:
  4. 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:
Invalid JSON does not stop the pipeline. The component logs a warning ("Warning: invalid JSON in {field_name}, using empty dict") but does not fail. This means risk scoring may be less accurate if arguments are malformed. Check Langflow’s logs if you suspect a parsing issue.

Source Code Reference

The component extends Langflow’s Component base class:
The evaluate_gate method is async and handles the full Attesta pipeline. The _parse_json private method provides safe JSON parsing with logging.

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