GLiNER2 gives Agent Zero a purpose-built structured inference path for:
- entity extraction
- text classification
- typed JSON extraction
- relation extraction
- memory keywords, relevance filtering, and conservative consolidation triage
- knowledge-import metadata enrichment
It runs either with a local checkpoint or through the GLiNER2 hosted API. The plugin does not modify Agent Zero core.
Install from Agent Zero's Plugin Hub. The Plugin Hub invokes hooks.py
automatically, and the hook installs the supported runtime into Agent Zero's
framework Python environment:
- local:
gliner2[local]>=1.3.2,<2 - API:
gliner2>=1.3.2,<2
The default route is local, so a normal Plugin Hub install prepares the local runtime in one flow. The settings panel also provides an Install / repair action for a changed mode or interrupted dependency install.
The hook deliberately uses sys.executable -m pip. In the official Docker
image that targets /opt/venv-a0, where plugin hooks and the Agent Zero backend
run. It does not install into the separate /opt/venv agent execution
environment.
- Open Settings → Plugins → GLiNER2.
- Choose Local runtime or Hosted API.
- Confirm that the readiness console shows no blockers.
- Select Load model or Connect API. Local model startup runs in the
background; the console reports
Startinguntil it is ready. - Run the built-in test bench before enabling memory replacements broadly.
Saved global, project, and agent-scoped settings are honored. Version 2.0 removes the old config-read hook that accidentally replaced loaded settings with defaults.
The default model is fastino/gliner2-base-v1.
Device options:
- Auto uses CUDA when PyTorch can see a CUDA device, otherwise CPU.
- CPU explicitly keeps inference on CPU.
- CUDA fails closed with a clear blocker when CUDA is unavailable.
Quantization and torch.compile are applied only on CUDA. When either option is
enabled on CPU, the runtime skips it and reports a warning instead of attempting
an invalid model load.
The plugin can detect GPU visibility but cannot grant a running container new
host-device permissions. Recreate Agent Zero with GPU passthrough—commonly
--gpus all—then confirm the GLiNER2 console reports CUDA. CPU mode remains a
fully supported setup and requires no Docker socket.
No Docker socket is required by this plugin.
API mode installs the lightweight base package and reads the credential from an
environment variable. PIONEER_API_KEY is the default.
The plugin passes the credential directly to the public GLiNER2API client. It never
copies a custom credential into PIONEER_API_KEY, persists the secret in
config.json, or displays the secret in diagnostics.
You can optionally configure:
- a custom API base URL
- request timeout
- retry count
API mode sends extraction text and schemas to the configured endpoint. Local mode keeps extraction in the Agent Zero runtime.
The discoverable tool is gliner2_extract.
Arguments:
task:entities,classify,json, orrelationstext: source textschema: task-specific JSON array or objectinclude_confidence: include model confidence where supportedinclude_spans: include source spans where supported
Examples:
{
"task": "entities",
"text": "Ada Lovelace worked with Charles Babbage in London.",
"schema": ["person", "location"],
"include_confidence": true
}{
"task": "classify",
"text": "The release is stable and dramatically faster.",
"schema": {
"sentiment": ["positive", "negative", "neutral"]
}
}All four task wrappers forward the configured extraction threshold. Local methods also receive the optional model maximum length; API methods safely ignore unsupported keyword arguments.
The framework extension intercepts only utility-model calls whose current Agent Zero prompt shape is compatible with extraction or classification:
- memory keyword extraction
- recall-query enrichment
- recalled-memory relevance filtering
- conservative consolidation triage
Generative merge, replace, and update decisions still fall through to the configured Utility model. Missing confidence also falls through; it is never treated as certainty.
When Safe Utility fallback is disabled, the extension returns conservative empty/skip results for eligible calls it cannot answer. This is useful for fully non-generative paths, but the default is to keep fallback enabled.
When Usage observability is enabled, successful replacements appear as
util log entries with the feature, mode, counts, thresholds, and timing-safe
metadata. Source text and API credentials are not added to those entries.
Version 2.0 adds:
- bounded input text, schema size, and optional model length
- serialized model load and inference access
- non-blocking background model startup with visible loading state
- background execution for async tools, diagnostics, and utility extensions
- a bounded operation wait before explicit extraction or Utility replacement falls back
- a bounded in-process client cache
- explicit CUDA readiness checks
- package compatibility reporting
- sanitized dependency-install output
- case-insensitive entity deduplication across current GLiNER2 result shapes
The default limits are 50,000 text characters and 100 nested schema items per call. The settings UI can tune these within hard ceilings.
Core runtime:
gliner2_enabledgliner2_modegliner2_modelgliner2_devicegliner2_api_key_envgliner2_api_base_urlgliner2_api_timeout_secondsgliner2_api_max_retriesgliner2_quantizegliner2_compilegliner2_entity_thresholdgliner2_max_lengliner2_max_text_charsgliner2_max_schema_itemsgliner2_operation_timeout_seconds
Agent Zero integrations:
gliner2_tool_enabledgliner2_utility_replacement_enabledgliner2_fallback_to_utility_modelgliner2_usage_logginggliner2_memory_keyword_extractiongliner2_recall_query_enrichmentgliner2_memory_post_filtergliner2_post_filter_thresholdgliner2_consolidation_triagegliner2_consolidation_triage_thresholdgliner2_knowledge_import_enrichmentgliner2_memory_entity_typesgliner2_import_entity_types
Run the focused suite from an Agent Zero checkout or from this standalone repository:
pytest -qThe tests use fake GLiNER2 runtimes; they do not download a model, install dependencies, or call the hosted API. GitHub Actions runs the suite on Python 3.11, 3.12, and 3.13.
For a delivery check, open the live settings panel, verify the readiness cards at narrow and wide widths, and run the test bench against the route you intend to use.
This integration tracks the public fastino-ai/GLiNER2 API and currently supports the stable 1.x line from 1.3.2 onward. The upper bound prevents a future major API change from silently breaking an installed plugin.
Licensed under Apache License 2.0.