Argorix Agent Guardrails SDK for Python
SDK oficial para instrumentar agentes, tools y pasos LLM con Argorix Agent Guardrails.
Package publicado:
pip install argorix-guardrails-agent
Import principal:
import argorix_agents
from argorix_agents import ControlViolationError, ControlSteerError, control
API cubierta
POST /v1/agent-guardrails/runtime/agents/initGET /v1/agent-guardrails/runtime/agents/{agent_name}/controlsPOST /v1/agent-guardrails/runtime/evaluatePOST /v1/agent-guardrails/runtime/evaluate/streamGET /v1/agent-guardrails/runtime/approvals/{approval_id}POST /v1/agent-guardrails/runtime/receipts/consumePOST /v1/agent-guardrails/runtime/events- Legacy aliases without
/v1remain available for compatibility
Flujo que resuelve
argorix_agents.init(...)registra el agente y su contexto base.- Los decoradores
@control(...)envuelven pasos sync/async. - El SDK evalúa antes y después del paso, enviando el punto de intervención
ACS (
pre_tool_call,post_model_call, …) junto alstagelegacy. - Si corresponde:
- bloquea (
ControlViolationError) - pide aprobación humana (
ControlEscalationError) - sugiere steering (
ControlSteerError) - aplica el payload transformado que devuelve el servidor
- registra eventos runtime
- bloquea (
- El backend deja trazabilidad por
agent_name,step,trace_idyspan_id.
Aprobaciones humanas
Un control escalate detiene el paso y abre una solicitud de aprobación:
from argorix_agents import ControlEscalationError
try:
issue_refund(request)
except ControlEscalationError as exc:
approval = argorix_agents.wait_for_approval(exc.approval_id, timeout_seconds=600)
if approval["status"] == "approved":
issue_refund(request)
wait_for_approval bloquea; si tu agente no puede esperar, guarda
exc.approval_id y consulta argorix_agents.get_approval(...) cuando quieras.
Transformaciones
Un control transform devuelve el paso ya redactado y el SDK lo aplica: al
input antes de ejecutar la función, y a la salida antes de devolverla. Cuando la
firma de la función no permite reconstruir los argumentos con seguridad
(*args, **kwargs o parámetros posicionales puros), el SDK no inventa nada:
ejecuta con el valor original y marca transform_skipped en el evento runtime.
Autenticacion
El SDK usa:
app_numberen requestsAuthorization: Bearer <APP_API_KEY>
Puedes configurar por argumentos o por variables:
AGENT_CONTROL_URLAGENT_CONTROL_APP_NUMBERAGENT_CONTROL_APP_API_KEYGOVERNANCE_AI_URL
No depende de 127.0.0.1 salvo que tú lo configures explícitamente para desarrollo.
Quick start
import asyncio
import argorix_agents
from argorix_agents import ControlViolationError, control
@control("query_db", step_type="tool")
async def query_db(query: str, context: dict | None = None) -> str:
return f"Executed: {query}"
async def main() -> None:
argorix_agents.init(
agent_name="support_bot",
agent_description="Customer support automation",
base_url="https://api.argorix.com",
app_number=123456,
app_api_key="ga_live_replace_me",
default_metadata={"environment": "production"},
)
try:
print(await query_db("SELECT * FROM tickets", context={"tenant": "acme"}))
except ControlViolationError as exc:
print(f"Blocked by {exc.control_name}: {exc.message}")
asyncio.run(main())
Que resuelve
- Registro del agente y sus pasos
- Decoradores
@control()para pasos sync/async - Evaluacion
preypostpor step - Eventos de ejecucion, bloqueo, steering y error
- Metadata runtime por trace/span
Flujo runtime documentado
argorix_agents.init(...)registra el agente en ARGORIX.- El runtime resuelve controles por
agent_name. - Cada step decorado puede evaluarse
preypost. - El SDK registra:
- decision
- trace_id
- span_id
- duration_ms
- errores operativos
- El backend deja telemetría visible en
Guardrails AgentsyGuardrails Log.
En la consola actual esto aparece separado de forma más explícita en:
Guardrails for Agentspara catálogo, bindings y agentes detectadosGuardrails Logpara eventos runtime y decisionesAI Applications > Risk & Governancecuando el profile consolida señal agentic y runtime
Tipos de integración recomendados
- agentes internos Python
- tools wrappers
- orquestadores async
- workers de automatización
- asistentes con múltiples steps y decisiones runtime
Errores, timeout y retry
AgentControlClient soporta:
timeout_secondsmax_retriesretry_backoff_secondsretry_status_codes
Errores del cliente:
AgentControlErrorstatus_coderesponse_body
Configuración recomendada:
base_urlexplícito por código para producciónAGENT_CONTROL_URLoGOVERNANCE_AI_URLpara entornos gestionados- localhost solo si realmente estás corriendo el backend local
Tests y release
Instalacion editable:
pip install -e ./sdk/python-agents
Tests:
python -m pytest ./sdk/python-agents/tests
Build:
python -m build ./sdk/python-agents
Publicacion:
python -m twine upload dist/*
Release checklist cubierto
- README
- quickstart
- errores y retries
- tests
- changelog
- licencia
- package naming alineado a
argorix-guardrails-agent, congovernanceai-guardrails-agentcomo shim
Semver y changelog
- Version actual:
0.1.0 - Historial:
CHANGELOG.md - Licencia:
LICENSE
Migración desde agent_control
pip uninstall governanceai-guardrails-agent
pip install argorix-guardrails-agent
| Antes | Ahora |
|---|---|
import agent_control |
import argorix_agents |
AgentControlClient |
AgentGuardrailsClient (el nombre viejo sigue exportado) |
AgentControlError |
ArgorixAgentError (idem) |
AGENT_CONTROL_URL |
ARGORIX_API_URL |
AGENT_CONTROL_APP_NUMBER |
ARGORIX_APP_NUMBER |
AGENT_CONTROL_APP_API_KEY |
ARGORIX_APP_API_KEY |
Las variables viejas se siguen leyendo como fallback, y el paquete
governanceai-guardrails-agent 0.3.0 reexporta este SDK —incluido el mismo objeto
state—, así que mezclar ambos imports en un proceso es consistente.
Si instalaste
argorix-guardrails-agent0.2.0, actualiza. Esa versión salió de un respaldo del repo con cuatro meses de atraso y no trae el contrato ACS: le faltanintervention_point,escalatecon aprobaciones,transform, el fail-closed del servidor, la redención de recibos y los controles de presupuesto por sesión.
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file argorix_guardrails_agent-0.3.0.tar.gz.
File metadata
- Download URL: argorix_guardrails_agent-0.3.0.tar.gz
- Upload date:
- Size: 26.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
966e85e2868aa053624eb71c0e50f7e67ec3aa1f23edfffbe645830756f54b1c
|
|
| MD5 |
1b14a9d11c00adbb0a97629d4eb83c9d
|
|
| BLAKE2b-256 |
7125b94d0e3f9c83b14619227f0a509e752574197857a972fd415d828205276d
|
Provenance
The following attestation bundles were made for argorix_guardrails_agent-0.3.0.tar.gz:
Publisher:
publish-pypi.yml on argorixlabs/argorix-guardrails-agent
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
argorix_guardrails_agent-0.3.0.tar.gz -
Subject digest:
966e85e2868aa053624eb71c0e50f7e67ec3aa1f23edfffbe645830756f54b1c - Sigstore transparency entry: 2319224242
- Sigstore integration time:
-
Permalink:
argorixlabs/argorix-guardrails-agent@2fbd3228f017a2db838561133d288f8e428ac77b -
Branch / Tag:
refs/tags/v0.3.0 - Owner: https://github.com/argorixlabs
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-pypi.yml@2fbd3228f017a2db838561133d288f8e428ac77b -
Trigger Event:
push
-
Statement type:
File details
Details for the file argorix_guardrails_agent-0.3.0-py3-none-any.whl.
File metadata
- Download URL: argorix_guardrails_agent-0.3.0-py3-none-any.whl
- Upload date:
- Size: 18.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e4128ab93da5c0d1de5082c274e15b520a766a7651984b69409a827369e00e39
|
|
| MD5 |
204ab7f509374f565b3c98e9af69e269
|
|
| BLAKE2b-256 |
68348859105c58dfa24cdc434a2ae81b06640f889df91a22a405a46d7e46b94d
|
Provenance
The following attestation bundles were made for argorix_guardrails_agent-0.3.0-py3-none-any.whl:
Publisher:
publish-pypi.yml on argorixlabs/argorix-guardrails-agent
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
argorix_guardrails_agent-0.3.0-py3-none-any.whl -
Subject digest:
e4128ab93da5c0d1de5082c274e15b520a766a7651984b69409a827369e00e39 - Sigstore transparency entry: 2319224443
- Sigstore integration time:
-
Permalink:
argorixlabs/argorix-guardrails-agent@2fbd3228f017a2db838561133d288f8e428ac77b -
Branch / Tag:
refs/tags/v0.3.0 - Owner: https://github.com/argorixlabs
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-pypi.yml@2fbd3228f017a2db838561133d288f8e428ac77b -
Trigger Event:
push
-
Statement type: