OpenTerms protocol integration for CrewAI: permission-aware AI agents
Project description
crewai-openterms
Permission-aware CrewAI tools for checking OpenTerms before an agent acts.
Install
pip install crewai-openterms
Canonical actions
The package documents and checks only these OpenTerms permission keys:
read_contentscrape_dataapi_accesscreate_accountmake_purchasespost_contentallow_training
Default behavior
The guard is fail-closed by default.
| Result | Default behavior |
|---|---|
allowed |
Proceed |
denied |
Block |
null |
Block |
not_specified |
Block |
no_openterms_json |
Block |
| low confidence | Block or escalate |
| conditional result | Block or escalate unless conditions are verified |
During public alpha, many domains do not publish openterms.json. That is expected, but it blocks by default. To allow permissive fallback, pass fail_closed=False explicitly.
OpenTermsCheckTool
Use this when an agent needs a structured permission check.
from crewai import Agent, Task, Crew
from crewai_openterms import OpenTermsCheckTool
checker = OpenTermsCheckTool()
researcher = Agent(
role="Web Researcher",
goal="Gather information from websites while respecting their terms",
backstory=(
"Before accessing a website, check its OpenTerms permissions "
"using the openterms_check tool."
),
tools=[checker],
)
task = Task(
description="Check whether github.com allows read_content and scrape_data.",
expected_output="A summary of permitted actions on github.com.",
agent=researcher,
)
crew = Crew(agents=[researcher], tasks=[task])
result = crew.kickoff()
OpenTermsGuardTool
Use this when an agent should receive a go or no-go decision before acting.
from crewai import Agent, Task, Crew
from crewai_openterms import OpenTermsGuardTool
guard = OpenTermsGuardTool(fail_closed=True) # default
researcher = Agent(
role="Permission-aware researcher",
goal="Use websites only when OpenTerms permits the intended action",
backstory=(
"Before taking action on a website, use openterms_guard. "
"If it blocks or escalates, do not proceed."
),
tools=[guard],
)
task = Task(
description="Check whether example.com permits scrape_data before scraping.",
expected_output="A go or no-go decision.",
agent=researcher,
)
crew = Crew(agents=[researcher], tasks=[task])
result = crew.kickoff()
Permissive fallback must be explicit:
guard = OpenTermsGuardTool(fail_closed=False)
OpenTermsGuardedTool
Use this pattern when OpenTerms should mechanically control whether a downstream tool executes.
from crewai.tools import BaseTool
from crewai_openterms import OpenTermsGuardedTool
class FetchPageTool(BaseTool):
name: str = "fetch_page"
description: str = "Fetch a page after permission is granted."
def _run(self, url: str, **kwargs):
return f"Fetched {url}"
fetch_page = FetchPageTool()
guarded_fetch = OpenTermsGuardedTool(
wrapped_tool=fetch_page,
action="read_content",
fail_closed=True, # default
)
result = guarded_fetch._run(url="https://example.com/page")
OpenTermsGuardedTool blocks the wrapped tool by default unless the OpenTerms check returns allowed. fail_closed=False is the only permissive fallback.
Discovery integration
When a domain's openterms.json includes a discovery block, the guard can surface MCP server URLs and API spec URLs in the allowed response.
Example:
ALLOWED: acme-corp.com permits 'api_access'. You may proceed. MCP servers available: https://acme-corp.com/mcp/sse. API specs available: https://api.acme-corp.com/v1/openapi.json.
Notes on openterms-py
The package uses openterms-py when installed through the SDK extra or development dependencies. If the SDK is unavailable, the client falls back to direct openterms.json fetch behavior.
Links
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 crewai_openterms-0.4.0.tar.gz.
File metadata
- Download URL: crewai_openterms-0.4.0.tar.gz
- Upload date:
- Size: 10.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9d5dcafec728607b4b2556433b3e09dd84f6333955525a284be53d047b26944e
|
|
| MD5 |
890031d6d8e75730a69c607df00defc9
|
|
| BLAKE2b-256 |
eddb1cb6ee48df09f80ca9d17a7ed9e44e3d41c1dc88a9c16e6465acb47c260e
|
Provenance
The following attestation bundles were made for crewai_openterms-0.4.0.tar.gz:
Publisher:
publish.yml on jstibal/crewai-openterms
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
crewai_openterms-0.4.0.tar.gz -
Subject digest:
9d5dcafec728607b4b2556433b3e09dd84f6333955525a284be53d047b26944e - Sigstore transparency entry: 1476521148
- Sigstore integration time:
-
Permalink:
jstibal/crewai-openterms@b6efcdb3b2614d501b0d9ef9f8d4beca89147b07 -
Branch / Tag:
refs/tags/v0.4.0 - Owner: https://github.com/jstibal
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@b6efcdb3b2614d501b0d9ef9f8d4beca89147b07 -
Trigger Event:
release
-
Statement type:
File details
Details for the file crewai_openterms-0.4.0-py3-none-any.whl.
File metadata
- Download URL: crewai_openterms-0.4.0-py3-none-any.whl
- Upload date:
- Size: 8.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a4736361777263fdf6cb02227f05aea676aaa4ea1022c57c60e146b485ba8997
|
|
| MD5 |
719b2a717c2df66d5d8633f2490c47eb
|
|
| BLAKE2b-256 |
29b681f2c097a87e7c3560ba32f02ece663550671e0aee526bd2ad1b27060bac
|
Provenance
The following attestation bundles were made for crewai_openterms-0.4.0-py3-none-any.whl:
Publisher:
publish.yml on jstibal/crewai-openterms
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
crewai_openterms-0.4.0-py3-none-any.whl -
Subject digest:
a4736361777263fdf6cb02227f05aea676aaa4ea1022c57c60e146b485ba8997 - Sigstore transparency entry: 1476521290
- Sigstore integration time:
-
Permalink:
jstibal/crewai-openterms@b6efcdb3b2614d501b0d9ef9f8d4beca89147b07 -
Branch / Tag:
refs/tags/v0.4.0 - Owner: https://github.com/jstibal
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@b6efcdb3b2614d501b0d9ef9f8d4beca89147b07 -
Trigger Event:
release
-
Statement type: