EnvBert-Agent
EnvBert-Agent is an agentic AI pipeline for environmental due diligence text classification.
It combines:
- EnvBert (domain-specific transformer backbone)
- Optional LLM fallback
- Agentic routing & confidence arbitration
- Quality control & explainability
- Modular LangGraph orchestration
Features
- Environmental domain classification using EnvBert
- Confidence-based fallback to LLM
- Agentic workflow orchestration via LangGraph
- CLI interface for quick usage
- Python SDK interface for integration
- Designed for due diligence, remediation, and compliance workflows
Requirements
- Python 3.9+
- Transformers (version constrained for TensorFlow compatibility)
- TensorFlow (required by EnvBert backbone)
- Ollama
Ollama Setup
-
Download and install from: https://ollama.com/download
-
Pull a model
ollama pull llama3
- Common Error
ConnectionRefusedError: localhost:11434
It means Ollama is not running.
- Fix:
ollama serve
By default, it runs at:
http://localhost:11434
Keep this running in a separate terminal.
Using Azure OpenAI
Set environment variables:
Windows:
set AZURE_OPENAI_API_KEY=...
set AZURE_OPENAI_ENDPOINT=...
set AZURE_OPENAI_DEPLOYMENT_NAME=...
macOS/Linux:
export AZURE_OPENAI_API_KEY=...
export AZURE_OPENAI_ENDPOINT=...
export AZURE_OPENAI_DEPLOYMENT_NAME=...
Installation
Install from PyPI:
pip install envbert-agent
ollama serve
envbert-agent "BEHP was detected in groundwater.
Python Usage
from envbert_agent import run
text = "BEHP was detected in groundwater"
result = run(text)
print(result)
from envbert_agent.config import LLMConfig
config = LLMConfig(provider="azure")
result = run(
"BEHP was detected in groundwater",
llm_config=config
)
print(result)
CLI Usage
After installation:
envbert-agent "BEHP was detected in groundwater"
envbert-agent "BEHP was detected in groundwater" --provider azure
Example output:
[INPUT]
raw_text: BEHP was the only SVOC detected in groundwater at concentrations exceeding the MCL.
clean_text: BEHP was the only SVOC detected in groundwater at concentrations exceeding the MCL.
language: en
quality_score: 1.0
[CLASSIFICATION]
envbert_label: Remediation Standards
envbert_confidence: 0.437928160341927
route: llm
llm_label: Contaminants
llm_confidence: 0.9
final_label: Contaminants
final_confidence: 0.9
[META]
llm_reasoning: The text mentions a specific contaminant (BEHP) and its concentration exceeding the Maximum Contaminated Level (MCL), indicating the presence of contaminants in groundwater.
decision_trace: LLM fallback
key_phrases: ['behp', 'svoc', 'detected', 'groundwater', 'concentrations', 'exceeding']
[MONITORING]
drift_flag: False
[INPUT]
raw_text: soil and groundwater are both contaminated on the site
clean_text: soil and groundwater are both contaminated on the site
language: en
quality_score: 1.0
[CLASSIFICATION]
envbert_label: Contaminated media
envbert_confidence: 0.7678613004581079
route: accept
llm_label: N/A
llm_confidence: N/A
final_label: Contaminated media
final_confidence: 0.7678613004581079
[META]
llm_reasoning: N/A
decision_trace: EnvBert backbone
key_phrases: ['soil', 'groundwater', 'both', 'contaminated', 'site']
[MONITORING]
drift_flag: False
Direct CLI Invocation from Python
from envbert_agent.cli import main
main(["BEHP was detected in groundwater"])
Architecture: Graph Edges & Flow
START
↓
[preprocess] ────────────────┐
↓ │
[envbert] ────────────────────┤
↓ │
[arbitrate] │ Conditional Router:
├─ (quality < 0.4) │ route = "review"
├─ (confidence ≥ 0.75) ─────┼──────→ route = "accept"
└─ (confidence < 0.75) ─────┘ route = "llm"
↓
┌──────────┬──────────┬──────────┐
↓ ↓ ↓
(review) (accept) (llm)
↓ ↓ ↓
│ ─────────→[llm]←─────
↓
[evaluate]
↓
[explain]
↓
[monitor]
↓
END
License
MIT License
See the LICENSE file for details.
⚠️ Notes
-
This package depends on the EnvBert backbone.
-
Transformers version is constrained for TensorFlow compatibility.
-
Future versions may migrate to a PyTorch backend for improved compatibility and lighter installation footprint.
Metadata
Release files for envbert-agent 0.2.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| envbert_agent-0.2.1.tar.gz | 12.6 kB | Without provenance | Details for envbert_agent-0.2.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| envbert_agent-0.2.1-py3-none-any.whl | Python 3 | none | any | Details for envbert_agent-0.2.1-py3-none-any.whl |
Total release size: 30.7 kB
Release files / envbert_agent-0.2.1.tar.gz
| Download URL | envbert_agent-0.2.1.tar.gz |
|---|---|
| Size | 12.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a1e6148a1ba59a42641f83790f4e1975153c2b72e674d97d08ac0fd1a2b9703e
|
|
BLAKE2b-256 checksum How to use checksums |
f8e8e36a892c507121a42e0617ff7f328a39860e699e33e380f1502ecd738f72
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.7
|
Release files / envbert_agent-0.2.1-py3-none-any.whl
| Download URL | envbert_agent-0.2.1-py3-none-any.whl |
|---|---|
| Size | 18.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
a01a4582f628c3c4c7678a1526a52fe14f69b3cd58736ac84bfbf42f0b51149e
|
|
BLAKE2b-256 checksum How to use checksums |
4b13facdd75edf97700e0c6612f39dfa05f701b31dd507922bf513e10e64449f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.7
|
Security for envbert-agent 0.2.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.