PlanSpec + lint + safety gates for agent plans.
Project description
sdf-plan
Tool safety gates for agent workflows.
30-Second Quickstart (ToolGate-first)
from sdf_plan import confirm, propose
first = propose(
tool_name="filesystem.write",
args={"path": "/tmp/demo.txt", "content": "hello"},
meta={"workspace_id": "demo-ws"},
run_context={"workspace_id": "demo-ws"},
)
print(first.decision.value) # BLOCK
token = first.resume.token
_ = confirm(token, user_ok=True)
second = propose(
tool_name="filesystem.write",
args={"path": "/tmp/demo.txt", "content": "hello"},
meta={"workspace_id": "demo-ws", "confirmed_token": token},
run_context={"workspace_id": "demo-ws"},
)
print(second.decision.value) # ALLOW
Expected flow: BLOCKED -> CONFIRM -> CONTINUE
Install
pip install sdf-plan
5-Minute First Success
python examples/tool_gate_quickstart.py
python examples/tool_gate_openai_input.py
python examples/plan_mode_preflight.py
What You Get
- ToolGate runtime decisions (
ALLOW | WARN | BLOCK) - Signed confirmation tokens + resume flow
- Idempotency key derivation from scope + tool + canonical args
- Tool-mode lint rules + policy defaults
- PlanSpec lint and preflight (optional mode)
- LangGraph adapter (official thin wrapper)
Optional PlanSpec Mode
Plan mode remains supported for existing users.
from sdf_plan import lint_plan, policy_annotate, preflight_lint
plan = {
"steps": [
{
"id": "S1",
"type": "ACT",
"title": "send email",
"intent": "send email",
"inputs": [],
"outputs": ["ctx.sent"],
"depends_on": [],
"stop_condition": "Step S1 completed",
"fallback": "reduce_scope",
"idempotency_key": "idem-1",
}
]
}
plan, summary = policy_annotate(plan)
findings = lint_plan(plan, max_steps=12, safety_mode="safe")
preflight_lint(plan, max_steps=12, safety_mode="safe")
Guides
docs/ADAPTER_TEMPLATE.mddocs/POLICY_TUNING.mddocs/TOOL_CLASSIFICATION.mddocs/COMPATIBILITY.md
Examples
examples/tool_gate_quickstart.pyexamples/tool_gate_openai_input.pyexamples/plan_mode_preflight.pyexamples/adapter_minimal.pyexamples/langgraph_plangate_demo.pyexamples/crewai_plangate_demo.py
Compatibility
Use Cloud schema hash checks to detect contract drift:
from sdf_plan.compat import assert_schema_compat, package_version
assert_schema_compat(package_version(), "schema_hash_from_/v1/schema")
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 Distributions
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 sdf_plan-0.2.4-py3-none-any.whl.
File metadata
- Download URL: sdf_plan-0.2.4-py3-none-any.whl
- Upload date:
- Size: 28.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1555f99a14727cdb9fdc2bbdd346025d863379b92c1bdd79c10248f6e63b9a89
|
|
| MD5 |
e3ee9b277523ce1ed6064b910ee4fd93
|
|
| BLAKE2b-256 |
697f3ac75aaad8a46af5eefea3f5db08ab9edb8eea764354cb3dea346b773d25
|
Provenance
The following attestation bundles were made for sdf_plan-0.2.4-py3-none-any.whl:
Publisher:
release.yml on directiveproto/sdf-plan
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
sdf_plan-0.2.4-py3-none-any.whl -
Subject digest:
1555f99a14727cdb9fdc2bbdd346025d863379b92c1bdd79c10248f6e63b9a89 - Sigstore transparency entry: 953498455
- Sigstore integration time:
-
Permalink:
directiveproto/sdf-plan@a369ebd3fa5dc51f22e781a32d65b943e55a95a4 -
Branch / Tag:
refs/tags/v0.2.4 - Owner: https://github.com/directiveproto
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@a369ebd3fa5dc51f22e781a32d65b943e55a95a4 -
Trigger Event:
push
-
Statement type: