Python SDK for Yantrix — agent infrastructure with governance built in
Project description
yantrix
Python SDK for Yantrix — agent infrastructure with governance built in.
Install
pip install yantrix
Quickstart
import yantrix
# Configure once
yantrix.configure(
api_key="ytx_your_key_here",
agent_id="my_agent"
)
# Run anything — policy check + memory + execution + audit, automatically
result = yantrix.run(
intent="research openai pricing changes",
task={
"steps": [
{
"name": "fetch",
"type": "http",
"url": "https://gateway.yantrix.ai/proxy/compwatch/competitor/scan",
"method": "POST",
"body": {"company": "openai"},
"output_key": "intel"
}
]
}
)
print(result["trace_id"]) # ytx_run_abc123
print(result["output"]) # {"intel": {...}}
print(result["timeline"]) # [{layer: "policy", ...}, {layer: "memory", ...}, ...]
What happens on every .run() call
1. Policy Engine evaluates the action → is this allowed?
2. Memory searched for context → what does agent already know?
3. Execution routed automatically → direct | sequential | graph
4. Result stored in semantic memory → agent learns from this
5. Full trace returned → audit trail included
Client API
from yantrix import Yantrix
ytx = Yantrix(api_key="ytx_...")
# Runtime
result = ytx.run(intent="...", task={...})
trace = ytx.get_trace(result["trace_id"])
# Policy Engine
ytx.set_budget(daily_limit_usd=10.0, per_action_limit_usd=1.0)
spend = ytx.get_spend()
policy = ytx.evaluate_policy("data_call", "web_crawler.fetch", estimated_cost=0.005)
logs = ytx.get_audit_logs(limit=20)
# Memory
ytx.remember(key="user_pref", value="dark mode", memory_type="semantic")
results = ytx.recall(query="what does the user prefer?", top_k=5)
ytx.forget(key="user_pref")
# Flows
flow = ytx.create_flow(name="my_flow", steps=[...])
output = ytx.run_flow(flow["flow_id"], input_data={})
# Graphs
graph = ytx.create_graph(name="my_graph", nodes=[...], edges=[...])
output = ytx.run_graph(graph["graph_id"], input_data={})
Async support
import asyncio
from yantrix import Yantrix
ytx = Yantrix(api_key="ytx_...")
async def main():
result = await ytx.arun(intent="...", task={...})
print(result)
asyncio.run(main())
Environment variables
export YANTRIX_API_KEY=ytx_your_key_here
export YANTRIX_AGENT_ID=my_agent
Then use without configure():
import yantrix
result = yantrix.run(intent="...")
Error handling
from yantrix import Yantrix
from yantrix.client import PolicyDeniedError, YantrixError
ytx = Yantrix(api_key="ytx_...")
try:
result = ytx.run(intent="expensive operation", task={...})
except PolicyDeniedError as e:
print(f"Blocked by policy: {e.reason}")
print(f"Audit ID: {e.audit_id}")
except YantrixError as e:
print(f"Error {e.status_code}: {e}")
Links
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
yantrix-1.0.0.tar.gz
(8.5 kB
view details)
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 yantrix-1.0.0.tar.gz.
File metadata
- Download URL: yantrix-1.0.0.tar.gz
- Upload date:
- Size: 8.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
72da5f25478f6778b057e3b1d23f892719a49a59d32b4445ffbd10f558979809
|
|
| MD5 |
c5bac681e6d92b365f47f82eb58e2b30
|
|
| BLAKE2b-256 |
bfb2c01108686566755d2bb89ddd8adcf47c16a026e5f116b7dbb3a034cb1afd
|
File details
Details for the file yantrix-1.0.0-py3-none-any.whl.
File metadata
- Download URL: yantrix-1.0.0-py3-none-any.whl
- Upload date:
- Size: 8.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
108ef46add283a381b8594c2c12db4d74192c488127cd47bac2d0df117706783
|
|
| MD5 |
e9fad035442bedb02130c87877045b68
|
|
| BLAKE2b-256 |
bd3d0bca788613bb6f4a323620261c0df7a0a47b05b92c9d6b1499d76c24e4b9
|