Python SDK for Intended — The Authority Runtime for AI Agents (incl. physical-AI helpers)
Project description
intended
Python SDK for Intended — the intent verification runtime for autonomous agents.
Evaluate every AI agent action against your organization's policies before execution. Fail-closed by default: if the authority service is unreachable, all actions are denied.
Installation
pip install intended
Quick Start
Synchronous
from intended import IntendedClient
client = IntendedSdk(api_key="intended_live_...", tenant_id="tenant-a")
decision = client.authorize("deploy to production", actor="ci-agent", system="github")
if decision.allowed:
print(f"Approved — token: {decision.token}")
elif decision.escalated:
print(f"Awaiting human approval: {decision.escalation_id}")
else:
print(f"Denied: {decision.reason}")
Asynchronous
from intended.client import AsyncIntendedClient
async with AsyncIntendedClient(api_key="intended_live_...", tenant_id="tenant-a") as client:
decision = await client.authorize("scale cluster to 100 nodes", actor="auto-scaler")
if decision.allowed:
await scale_cluster(100)
MCP Integration
Wrap any MCP tool function with Intended authority checks:
from intended.mcp import IntendedMCPMiddleware
middleware = IntendedMCPMiddleware(api_key="intended_live_...", tenant_id="tenant-a")
@middleware.protect
def execute_sql(query: str) -> str:
# Only runs if Intended approves
return db.execute(query)
# Or check manually
decision = middleware.check("execute_sql", {"query": "DROP TABLE users"})
print(decision.decision) # "DENY"
LangChain Integration
Guard any LangChain tool with Intended:
from intended.langchain import IntendedToolGuard
from langchain.tools import ShellTool
guard = IntendedToolGuard(api_key="intended_live_...", tenant_id="tenant-a")
shell = ShellTool()
safe_shell = guard.wrap(shell)
# Now shell.run() checks with INTENDED before executing
agent = create_react_agent(llm, tools=[safe_shell])
PydanticAI Integration
Use as a decorator on PydanticAI tool functions:
from intended.pydantic_ai import IntendedPydanticGuard
from pydantic_ai import Agent
guard = IntendedPydanticGuard(api_key="intended_live_...", tenant_id="tenant-a")
agent = Agent('openai:gpt-4o')
@agent.tool
@guard.protect
async def deploy(env: str) -> str:
return f"Deployed to {env}"
AuthorityDecision
Every call to authorize() returns an AuthorityDecision:
| Field | Type | Description |
|---|---|---|
decision |
str |
"ALLOW", "DENY", or "ESCALATE" |
intent_id |
str |
Unique ID of the evaluated intent |
risk_score |
int |
0-100 risk assessment |
confidence |
float |
Confidence in the risk assessment |
reason |
str |
Human-readable explanation |
token |
str | None |
Authority token for approved actions |
escalation_id |
str | None |
ID for tracking escalated actions |
Convenience properties: decision.allowed, decision.denied, decision.escalated.
Business Intent APIs
The Python SDK also exposes the business-intent compiler and runtime feedback surfaces:
from intended import IntendedClient
client = IntendedSdk(api_key="intended_live_...", tenant_id="tenant-a", api_url="http://localhost:3101")
compiled = client.compile_business_intent_and_plan(
"Shift the nightly ETL window to 3am",
workflow_family="enterprise-operations",
target_system="airflow",
metadata={"environment": "production"},
)
print(compiled["prediction"]["canonicalIntent"])
print(compiled["intentObject"]["process"]["stages"])
object_evals = client.get_business_intent_object_evals()
print(object_evals["report"]["summary"]["passedCases"])
feedback = client.capture_business_intent_feedback(
input_text="Shift the nightly ETL window to 3am",
predicted_intent="ops.batch.schedule",
workflow_family="enterprise-operations",
outcome="accepted",
confidence=0.93,
target_system="airflow",
execution_status="succeeded",
verification_status="verified",
)
evals = client.get_business_intent_feedback_evals(workflow_family="enterprise-operations")
print(evals["evals"]["verification"]["verificationRate"])
summary = client.get_business_intent_feedback_summary(workflow_family="enterprise-operations")
print(summary["summary"]["approvalPredictionHits"])
report = client.get_business_intent_feedback_report(workflow_family="enterprise-operations")
print(report["report"]["metadataDrift"])
Available helper methods:
compile_business_intent()compile_business_intent_and_plan()capture_business_intent_feedback()get_business_intent_object_evals()get_business_intent_feedback_summary()get_business_intent_feedback_report()get_business_intent_feedback_evals()get_business_intent_feedback_backlog()review_business_intent_feedback()promote_business_intent_feedback()
Example review and promote flow:
backlog = client.get_business_intent_feedback_backlog(workflow_family="enterprise-operations")
for record in backlog["backlog"]:
client.review_business_intent_feedback(record["id"], "approved")
promotion = client.promote_business_intent_feedback("enterprise-operations")
print(promotion["snapshotVersion"])
print(promotion["snapshotPath"])
Fail-Closed Behavior
If the INTENDED API is unreachable or returns an error, the SDK returns a DENY decision with risk_score=100 and confidence=0. This ensures that network issues or misconfigurations never result in unauthorized actions.
License
Apache-2.0
Project details
Release history Release notifications | RSS feed
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 intended-0.2.1.tar.gz.
File metadata
- Download URL: intended-0.2.1.tar.gz
- Upload date:
- Size: 19.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4de9f152a921f8c055a72df5e661e284d73772bb29dd0bf7d6b5bbb9cf35d6ad
|
|
| MD5 |
2a7cb7a60086a27df0839cc4e894e3f4
|
|
| BLAKE2b-256 |
d2a8caf00360731aa5ea8d49755c02912d7bd2a3c132734f68c2c1c83364ae8a
|
File details
Details for the file intended-0.2.1-py3-none-any.whl.
File metadata
- Download URL: intended-0.2.1-py3-none-any.whl
- Upload date:
- Size: 17.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
405dde53f9530f15e4b7f36b008b82beb2e1e3830ec85a8836f82e5b4d9bc741
|
|
| MD5 |
2ed11240dfe122101178ed772276785d
|
|
| BLAKE2b-256 |
ad3e4160687155a00e4119bedef2a0c89e58ba74e856b7c08cd0c957661098b3
|