Skip to main content

Official Governance AI Agent Guardrails SDK for Python agents and tool execution

Project description

Governance AI Agent Guardrails SDK for Python

SDK oficial para instrumentar agentes, tools y pasos LLM con Governance AI Agent Guardrails.

Publicacion objetivo en PyPI:

pip install governanceai-guardrails-agent

Import principal:

import agent_control
from agent_control import ControlViolationError, ControlSteerError, control

API cubierta

  • POST /agent-guardrails/runtime/agents/init
  • GET /agent-guardrails/runtime/agents/{agent_name}/controls
  • POST /agent-guardrails/runtime/evaluate
  • POST /agent-guardrails/runtime/events

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

Quick start

import asyncio

import agent_control
from agent_control 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:
    agent_control.init(
        agent_name="support_bot",
        agent_description="Customer support automation",
        base_url="https://api.governanceai.example",
        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

Errores, timeout y retry

AgentControlClient soporta:

  • timeout_seconds
  • max_retries
  • retry_backoff_seconds
  • retry_status_codes

Errores del cliente:

  • AgentControlError
  • status_code
  • response_body

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/*

Semver y changelog

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

governanceai_guardrails_agent-0.1.0.tar.gz (12.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

governanceai_guardrails_agent-0.1.0-py3-none-any.whl (11.3 kB view details)

Uploaded Python 3

File details

Details for the file governanceai_guardrails_agent-0.1.0.tar.gz.

File metadata

File hashes

Hashes for governanceai_guardrails_agent-0.1.0.tar.gz
Algorithm Hash digest
SHA256 7451d03c4415b529ed44e92e02e476285050d518da266869d0419c98c0009a67
MD5 edd4118b97aaf40b486028d40c8bed20
BLAKE2b-256 bf390f97929e20fad6dd1b768b047987f7b4d54a7e612b6ead54da95c6f0e768

See more details on using hashes here.

Provenance

The following attestation bundles were made for governanceai_guardrails_agent-0.1.0.tar.gz:

Publisher: publish-pypi.yml on l33tm3/governanceai-guardrails-agent

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file governanceai_guardrails_agent-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for governanceai_guardrails_agent-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 b28ff739d052887c1001b65de4384d24ae896896981893a8a35ff96abeae6f41
MD5 d3b3a3345deaee6d6183154c25ad7c50
BLAKE2b-256 2457e4361324a06e660d0c1d2fda373253daa32c7fe9bd92b2fdfdf025a01652

See more details on using hashes here.

Provenance

The following attestation bundles were made for governanceai_guardrails_agent-0.1.0-py3-none-any.whl:

Publisher: publish-pypi.yml on l33tm3/governanceai-guardrails-agent

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page