Skip to main content

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/init
  • GET /v1/agent-guardrails/runtime/agents/{agent_name}/controls
  • POST /v1/agent-guardrails/runtime/evaluate
  • POST /v1/agent-guardrails/runtime/evaluate/stream
  • GET /v1/agent-guardrails/runtime/approvals/{approval_id}
  • POST /v1/agent-guardrails/runtime/receipts/consume
  • POST /v1/agent-guardrails/runtime/events
  • Legacy aliases without /v1 remain available for compatibility

Flujo que resuelve

  1. argorix_agents.init(...) registra el agente y su contexto base.
  2. Los decoradores @control(...) envuelven pasos sync/async.
  3. El SDK evalúa antes y después del paso, enviando el punto de intervención ACS (pre_tool_call, post_model_call, …) junto al stage legacy.
  4. Si corresponde:
    • bloquea (ControlViolationError)
    • pide aprobación humana (ControlEscalationError)
    • sugiere steering (ControlSteerError)
    • aplica el payload transformado que devuelve el servidor
    • registra eventos runtime
  5. El backend deja trazabilidad por agent_name, step, trace_id y span_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_number en requests
  • Authorization: Bearer <APP_API_KEY>

Puedes configurar por argumentos o por variables:

  • AGENT_CONTROL_URL
  • AGENT_CONTROL_APP_NUMBER
  • AGENT_CONTROL_APP_API_KEY
  • GOVERNANCE_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 pre y post por step
  • Eventos de ejecucion, bloqueo, steering y error
  • Metadata runtime por trace/span

Flujo runtime documentado

  1. argorix_agents.init(...) registra el agente en ARGORIX.
  2. El runtime resuelve controles por agent_name.
  3. Cada step decorado puede evaluarse pre y post.
  4. El SDK registra:
    • decision
    • trace_id
    • span_id
    • duration_ms
    • errores operativos
  5. El backend deja telemetría visible en Guardrails Agents y Guardrails Log.

En la consola actual esto aparece separado de forma más explícita en:

  • Guardrails for Agents para catálogo, bindings y agentes detectados
  • Guardrails Log para eventos runtime y decisiones
  • AI Applications > Risk & Governance cuando 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_seconds
  • max_retries
  • retry_backoff_seconds
  • retry_status_codes

Errores del cliente:

  • AgentControlError
  • status_code
  • response_body

Configuración recomendada:

  • base_url explícito por código para producción
  • AGENT_CONTROL_URL o GOVERNANCE_AI_URL para 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, con governanceai-guardrails-agent como shim

Semver y changelog

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-agent 0.2.0, actualiza. Esa versión salió de un respaldo del repo con cuatro meses de atraso y no trae el contrato ACS: le faltan intervention_point, escalate con aprobaciones, transform, el fail-closed del servidor, la redención de recibos y los controles de presupuesto por sesión.

Metadata

Release files for argorix-guardrails-agent 0.4.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for argorix-guardrails-agent 0.4.0
File Size Uploaded Provenance
argorix_guardrails_agent-0.4.0.tar.gz 26.1 kB With provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for argorix-guardrails-agent 0.4.0
File Interpreter ABI Platform
argorix_guardrails_agent-0.4.0-py3-none-any.whl Python 3 none any Details

Total release size: 44.9 kB

Release files / argorix_guardrails_agent-0.4.0.tar.gz

Download URL argorix_guardrails_agent-0.4.0.tar.gz
Size 26.1 kB
Tags Source
SHA-256 checksum
How to use checksums
d4b310c0d893193a9be59cde746488d5ef62b24d7041a6fa40d571632be8395e
BLAKE2b-256 checksum
How to use checksums
6e9f1d0f4339067d1d7eab912316321c4f10ef24a871caba68b6ad28d3497947
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 8, 2026.

Transparency log

Release files / argorix_guardrails_agent-0.4.0-py3-none-any.whl

Download URL argorix_guardrails_agent-0.4.0-py3-none-any.whl
Size 18.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5520dbb5521b9bc9672037bc066e38e29be2fd792597cefa4d3d80a53796cd8b
BLAKE2b-256 checksum
How to use checksums
ee62d7cbb52932af9bd3f7917f7e91e85dc2b57ea74c3906a943eda8ca7948ed
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 8, 2026.

Transparency log

Security for argorix-guardrails-agent 0.4.0

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.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for argorix_guardrails_agent-0.4.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 8, 2026.

Transparency log

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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page