Skip to main content

Python Quickstart

Use the Pavri Python SDK to instrument an agent and send its registration, policy, and telemetry activity to the Pavri environment assigned to your organization.

Before you begin

  • Python 3.12 or later
  • A Pavri API key and organization identifier
  • The gRPC endpoint and TLS requirement supplied by your Pavri administrator
  • An agent object supported by one of the Pavri framework adapters, or a generic Python object

Do not substitute a guessed gateway URL for the gRPC endpoint. The SDK uses a remote transport only when backend_grpc_url is configured; without it, the SDK uses an in-memory client intended for local development and tests.

Install

python -m venv .venv
source .venv/bin/activate
python -m pip install --upgrade pip
python -m pip install pavri

Configure your environment

Store the values in your approved secret-management workflow, then expose them to the application process:

export PAVRI_API_KEY='provided-by-your-administrator'
export PAVRI_ORG_ID='your-organization-id'
export PAVRI_GRPC_ENDPOINT='provided-by-your-administrator'

Instrument an agent

import os

from pavri import PavriConfig, secure


class OrdersAgent:
name = "orders-agent"

def run(self, request: str) -> str:
return f"Processed: {request}"


secured_agent = secure(
OrdersAgent(),
PavriConfig(
agent_name="orders-agent",
plugin="generic",
api_key=os.environ["PAVRI_API_KEY"],
org_id=os.environ["PAVRI_ORG_ID"],
backend_grpc_url=os.environ["PAVRI_GRPC_ENDPOINT"],
tls_enabled=True,
environment="production",
team="platform",
),
)

print(secured_agent.run("refund request"))

For a local development endpoint without TLS, set tls_enabled=False only when your deployment owner explicitly instructs you to do so. Production endpoints should use TLS.

Verify the integration

  1. Run a representative agent request.
  2. Open Operate → Agents in Pavri and search for orders-agent.
  3. Open the agent and inspect its recent session or activity evidence.
  4. If it does not appear, first verify the organization ID, endpoint, network reachability, and credential scope with your administrator.

After confirming visibility, use policy authoring to introduce governance controls with a narrow, observe-oriented rollout.

Framework adapters

Pass the appropriate plugin value when securing a supported framework:

FrameworkPlugin value
LangGraphlanggraph
CrewAIcrewai
OpenAI Agents SDKopenai_agents
Claude SDKclaude
Google ADKgoogle_adk
AutoGenautogen

The wrapping pattern is the same: create the framework agent first, then pass it and a PavriConfig to secure().