Skip to main content

Sayfos Protocol — Agent Runtime Control Protocol

Project description

Sayfos SDK

Sayfos SDK is a lightweight community SDK for agent runtime control.

It provides reference data objects, verification hooks, and framework adapters for checking automated actions before they reach tools, APIs, data systems, cloud resources, or embodied endpoints.

This repository is a community reference implementation, not the full enterprise gateway or managed control plane.

What Sayfos Helps With

Automated execution agents often need to answer three questions before a high-risk action is allowed:

  1. Does the action have a verifiable source chain?
  2. Is the action still within its delegated budget and runtime authority?
  3. Does the digital action have enough contextual or embodied evidence?

Sayfos SDK exposes common objects and lightweight reference engines for those checks so developers can add runtime guardrails around AI agents, RPA systems, workflow engines, coding agents, cloud-operation agents, robots, vehicle agents, and IoT agents.

Installation

pip install sayfos-sdk

With the LangChain adapter:

pip install sayfos-sdk[langchain]

With the development API server:

pip install sayfos-sdk[api]

Quick Start

from sayfos import (
    ActionDeclaration,
    IntentVerificationRequest,
    SayfosPipeline,
    Verdict,
)

declaration = ActionDeclaration(
    actor_type="langchain_tool",
    action_type="send_payment",
    target="acct_42",
    parameters={"amount": 150.0, "currency": "CNY"},
    root_authorization_ref="auth://user/alice",
    task_lineage_ref="task://report/step-3",
    risk_level=5,
)

request = IntentVerificationRequest(
    action=declaration,
    touch_events=12,
    screen_on=True,
    device_held=True,
    budget_remaining={"amount": 500.0, "tool_calls": 10},
)

pipeline = SayfosPipeline()
token = pipeline.evaluate(request)

if token.verdict != Verdict.ALLOW:
    raise RuntimeError(f"Blocked: {token.reason_code}")

result = execute_payment(**declaration.parameters)

Standard Objects

The community SDK centers on a small set of machine-readable objects:

Object Role
ActionDeclaration Proposed automated action
IntentVerificationRequest Action plus runtime evidence
EmbodiedResponse Contextual or embodied consistency result
Budget Delegated runtime authority and quotas
PreflightPlan Multi-step execution plan
ExecutionBoundary Machine-readable plan or step boundary
AdjudicationToken Binding verdict and constraints
AuditSummary Machine-verifiable audit summary

Reference Verification Dimensions

Dimension What it checks
Source-chain integrity Whether the action carries required provenance references
Budget governance Whether the action is within delegated runtime authority
Plan preflight Whether a multi-step plan stays within execution boundaries
Embodied consistency Whether digital action evidence matches contextual or physical evidence

The bundled engines are intentionally lightweight. Production deployments should use durable storage, authenticated policy management, operational monitoring, and stronger organization-specific decision logic.

LangChain Adapter

from sayfos.adapters.langchain import SayfosLangChainInterceptor, BlockedActionError

interceptor = SayfosLangChainInterceptor()

@interceptor.guard
@tool
def transfer_funds(amount: float, to: str) -> str:
    return f"Transferred {amount} to {to}"

try:
    transfer_funds(100.0, "acct_evil")
except BlockedActionError as e:
    print(f"Blocked: {e.token.reason_code}")

CLI

sayfos verify --action '{"action_type":"payment","parameters":{"amount":100}}'
sayfos budget create --owner agent-1 --quotas '{"amount_cny":5000}'
sayfos plan preflight --plan '{"steps":[]}' --budget-id <budget-id>

Open Source Boundary

This repository provides public interfaces, reference objects, lightweight verification engines, examples, and adapters under Apache 2.0.

Enterprise gateway capabilities, managed policy engines, certification services, production control planes, and commercial support are separate offerings and are not provided by this community SDK.

Notices

See LICENSE for the Apache 2.0 license.

See PATENT_NOTICE.md and TRADEMARK.md for additional patent and trademark notices related to this project.

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

sayfos_sdk-0.1.0.tar.gz (56.8 kB view details)

Uploaded Source

Built Distribution

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

sayfos_sdk-0.1.0-py3-none-any.whl (73.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: sayfos_sdk-0.1.0.tar.gz
  • Upload date:
  • Size: 56.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.8

File hashes

Hashes for sayfos_sdk-0.1.0.tar.gz
Algorithm Hash digest
SHA256 61ff54c9bd21435df5531cbe3adaade7be77e16d9f9b88e48ac6e8ad9516a245
MD5 69766cff88ca423e595968dfa6168e60
BLAKE2b-256 4b4ec6fc84b0a4c5439355ba267a220e3c86058b978eea4be01fc949ffdf662c

See more details on using hashes here.

File details

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

File metadata

  • Download URL: sayfos_sdk-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 73.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.8

File hashes

Hashes for sayfos_sdk-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c388dfc23b16e9821c83b11ee8bd73f502ed486b71e76ea3f1c7674b0ec8c173
MD5 8b55f80f6cfdab9e813d5460662be1e5
BLAKE2b-256 bbf08e152f1e0147d4f6fc0c915cadac770475df89958f55576b35b6def874b9

See more details on using hashes here.

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