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.
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)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| argorix_guardrails_agent-0.4.0.tar.gz | 26.1 kB | With provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| 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 logRelease 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 logSecurity 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.
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 logA 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.