Paved SDK
Project description
Paved SDK
Python SDK for the Paved platform — the governance layer for AI agents. Policy checks, credential-injecting proxy, and agentic tool execution all route through the Paved Platform API.
Install
pip install pvd
Quick Start
from pvd import Agent
agent = Agent(
agent_id="my-agent",
api_key="pvd_live_...", # or set PAVED_API_KEY env var
base_url="https://app.hipaved.com", # default
)
Agentic Gateway
Run a governed agentic loop: the LLM picks tools from your connected integrations, Paved executes each tool call through the credential-injecting proxy with per-action policy checks, and returns the final answer with a full execution trace.
result = agent.agent(
messages=[{"role": "user", "content": "Get me my top 5 Salesforce accounts"}],
integrations=["salesforce"],
model="gpt-4o",
)
print(result.content) # Final LLM response
print(result.finish_reason) # "stop" | "max_rounds" | "policy_denied"
print(result.rounds_used) # Number of tool-use rounds
print(result.tool_executions) # Full trace of every tool call
print(result.usage) # {"prompt_tokens": ..., "completion_tokens": ...}
Multi-integration
Connect multiple integrations in a single session:
result = agent.agent(
messages=[{"role": "user", "content": "Find Acme Corp in Salesforce and create a GitHub issue for follow-up"}],
integrations=["salesforce", "github"],
model="gpt-4o",
max_rounds=10,
)
Delegated Access
Pass end-user context for per-user policy evaluation via OPA:
result = agent.agent(
messages=[{"role": "user", "content": "Get my account details"}],
integrations=["salesforce"],
on_behalf_of={
"user_id": "u_123",
"role": "sales_rep",
"department": "sales",
"clearance": 2,
},
)
AgentResult
The agent() method returns an AgentResult object:
result.content # str — Final LLM text response
result.finish_reason # str — "stop", "max_rounds", or "policy_denied"
result.rounds_used # int — Number of tool-use loop iterations
result.tool_executions # list[dict] — Full trace per tool call
result.usage # dict — {prompt_tokens, completion_tokens, total_tokens}
result.latency_ms # int — Total request time in ms
result.request_id # str — Unique request ID for audit trail
result.model # str — Model used
result.successful_tools # list[dict] — Tools that succeeded
result.denied_tools # list[dict] — Tools denied by policy
str(result) # Returns result.content
Each tool execution trace contains:
{
"round": 1,
"tool_call_id": "call_abc123",
"tool_name": "salesforce__api_request",
"integration_slug": "salesforce",
"action_key": "api_request",
"method": "GET",
"path": "/services/data/v59.0/query?q=SELECT+Id,Name+FROM+Account+LIMIT+5",
"arguments": {"method": "GET", "path": "..."},
"status_code": 200,
"response_body": {"totalSize": 5, "records": [...]},
"decision": "allow",
"reasons": [],
"error": None,
"latency_ms": 492,
}
Proxy
Make governed API calls through connected integrations. Paved injects credentials server-side — secrets never leave the platform.
# GET request
repos = agent.proxy("github", "GET", "/user/repos")
print(repos["body"])
# POST with body
issue = agent.proxy("github", "POST", "/repos/owner/repo/issues", body={
"title": "Bug report",
"body": "Details here",
})
# Delegated access
accounts = agent.proxy(
"salesforce", "GET", "/services/data/v59.0/query",
query={"q": "SELECT Id, Name FROM Account LIMIT 10"},
on_behalf_of={"role": "analyst", "department": "finance"},
)
LLM Wrappers
Drop-in replacements that route through Paved's gateway with policy enforcement.
OpenAI
from pvd.openai import OpenAI
client = OpenAI(
agent_id="my-agent",
paved_api_key="pvd_live_...",
)
response = client.chat.completions.create(
model="gpt-4o",
messages=[{"role": "user", "content": "Hello"}],
)
Anthropic
from pvd.anthropic import Anthropic
client = Anthropic(
agent_id="my-agent",
paved_api_key="pvd_live_...",
)
response = client.messages.create(
model="claude-sonnet-4-5-20250929",
max_tokens=1024,
messages=[{"role": "user", "content": "Hello"}],
)
LiteLLM (100+ providers)
from pvd.litellm import LiteLLM
client = LiteLLM(agent_id="my-agent", api_key="pvd_live_...")
response = client.completion(
model="gpt-4o",
messages=[{"role": "user", "content": "Hello"}],
)
Policy Checks
Explicit policy checks for custom actions:
from pvd import Agent, PolicyDeniedError
agent = Agent(agent_id="my-agent")
try:
agent.check("send_email", {
"to": ["user@example.com"],
"subject": "Report",
"body": "...",
})
except PolicyDeniedError as e:
print(f"Blocked: {e}")
Governance Summary
summary = agent.get_governance_summary()
print(summary["total_checks"])
print(summary["allowed_actions"])
print(summary["denied_actions"])
print(summary["flagged_actions"])
print(summary["overall_decision"]) # "allow", "flag", or "deny"
CLI
pvd login # Authenticate
pvd init my-agent --template llm # Scaffold project
pvd build . -o my-agent.tar.gz # Package
pvd deploy my-agent.tar.gz --name my-agent # Deploy
pvd list # List agents
pvd invoke <agent-id> --payload '{}' # Run
pvd logs <invocation-id> --follow # Stream logs
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
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 pvd-0.2.0.tar.gz.
File metadata
- Download URL: pvd-0.2.0.tar.gz
- Upload date:
- Size: 26.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.7.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3d301edb26b830770bc8e130d5457f38bbe755bbe239a7f6bb79baf4c9a11835
|
|
| MD5 |
01888d0a47acbb7b5adfa76b692b86c6
|
|
| BLAKE2b-256 |
854f8bde6cca221eae1d0065cd872a08ab8297983ea2148235cad7a65f754d55
|
File details
Details for the file pvd-0.2.0-py3-none-any.whl.
File metadata
- Download URL: pvd-0.2.0-py3-none-any.whl
- Upload date:
- Size: 29.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.7.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d01b2e494966019534e38914b6530db4d85433e84650c542a27af8e2041437b6
|
|
| MD5 |
0622cdd7de84b4d49f2f19e56f2c6ed6
|
|
| BLAKE2b-256 |
bebf785df014788d0eeafdea092d553e886fa81fe00ee186975f23c3420cc068
|