chainthread 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- chainthread-0.1.0/PKG-INFO +64 -0
- chainthread-0.1.0/README.md +45 -0
- chainthread-0.1.0/chainthread.egg-info/PKG-INFO +64 -0
- chainthread-0.1.0/chainthread.egg-info/SOURCES.txt +8 -0
- chainthread-0.1.0/chainthread.egg-info/dependency_links.txt +1 -0
- chainthread-0.1.0/chainthread.egg-info/requires.txt +1 -0
- chainthread-0.1.0/chainthread.egg-info/top_level.txt +1 -0
- chainthread-0.1.0/chainthread.py +105 -0
- chainthread-0.1.0/setup.cfg +4 -0
- chainthread-0.1.0/setup.py +16 -0
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: chainthread
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Open agent handoff protocol and verification infrastructure.
|
|
5
|
+
Home-page: https://github.com/eugene001dayne/chain-thread
|
|
6
|
+
Author: Eugene Dayne Mawuli
|
|
7
|
+
Author-email: bitelance.team@gmail.com
|
|
8
|
+
Requires-Python: >=3.9
|
|
9
|
+
Description-Content-Type: text/markdown
|
|
10
|
+
Requires-Dist: httpx
|
|
11
|
+
Dynamic: author
|
|
12
|
+
Dynamic: author-email
|
|
13
|
+
Dynamic: description
|
|
14
|
+
Dynamic: description-content-type
|
|
15
|
+
Dynamic: home-page
|
|
16
|
+
Dynamic: requires-dist
|
|
17
|
+
Dynamic: requires-python
|
|
18
|
+
Dynamic: summary
|
|
19
|
+
|
|
20
|
+
# ChainThread Python SDK
|
|
21
|
+
|
|
22
|
+
Open agent handoff protocol and verification infrastructure.
|
|
23
|
+
|
|
24
|
+
## Install
|
|
25
|
+
```bash
|
|
26
|
+
pip install chainthread
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
## Quick Start
|
|
30
|
+
```python
|
|
31
|
+
from chainthread import ChainThread
|
|
32
|
+
|
|
33
|
+
ct = ChainThread()
|
|
34
|
+
|
|
35
|
+
# Create a chain
|
|
36
|
+
chain = ct.create_chain(
|
|
37
|
+
name="my-agent-pipeline",
|
|
38
|
+
description="Research to writer handoff"
|
|
39
|
+
)
|
|
40
|
+
|
|
41
|
+
# Send a handoff envelope
|
|
42
|
+
envelope = ct.send_envelope(
|
|
43
|
+
chain_id=chain["chain_id"],
|
|
44
|
+
sender_id="research-agent",
|
|
45
|
+
sender_role="researcher",
|
|
46
|
+
receiver_id="writer-agent",
|
|
47
|
+
receiver_role="writer",
|
|
48
|
+
payload={"summary": "AI is transforming software.", "confidence": 0.95},
|
|
49
|
+
summary="Research complete, handing off to writer",
|
|
50
|
+
provenance=[{"field": "summary", "source": "model_generated", "confidence": 0.95}],
|
|
51
|
+
contract={
|
|
52
|
+
"required_fields": ["summary", "confidence"],
|
|
53
|
+
"assertions": [{"field": "confidence", "type": "range", "value": {"min": 0.0, "max": 1.0}}],
|
|
54
|
+
"on_fail": "block"
|
|
55
|
+
}
|
|
56
|
+
)
|
|
57
|
+
|
|
58
|
+
print(envelope["contract_passed"])
|
|
59
|
+
print(ct.stats())
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
## Links
|
|
63
|
+
- GitHub: https://github.com/eugene001dayne/chain-thread
|
|
64
|
+
- Live API: https://chain-thread.onrender.com
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
# ChainThread Python SDK
|
|
2
|
+
|
|
3
|
+
Open agent handoff protocol and verification infrastructure.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
```bash
|
|
7
|
+
pip install chainthread
|
|
8
|
+
```
|
|
9
|
+
|
|
10
|
+
## Quick Start
|
|
11
|
+
```python
|
|
12
|
+
from chainthread import ChainThread
|
|
13
|
+
|
|
14
|
+
ct = ChainThread()
|
|
15
|
+
|
|
16
|
+
# Create a chain
|
|
17
|
+
chain = ct.create_chain(
|
|
18
|
+
name="my-agent-pipeline",
|
|
19
|
+
description="Research to writer handoff"
|
|
20
|
+
)
|
|
21
|
+
|
|
22
|
+
# Send a handoff envelope
|
|
23
|
+
envelope = ct.send_envelope(
|
|
24
|
+
chain_id=chain["chain_id"],
|
|
25
|
+
sender_id="research-agent",
|
|
26
|
+
sender_role="researcher",
|
|
27
|
+
receiver_id="writer-agent",
|
|
28
|
+
receiver_role="writer",
|
|
29
|
+
payload={"summary": "AI is transforming software.", "confidence": 0.95},
|
|
30
|
+
summary="Research complete, handing off to writer",
|
|
31
|
+
provenance=[{"field": "summary", "source": "model_generated", "confidence": 0.95}],
|
|
32
|
+
contract={
|
|
33
|
+
"required_fields": ["summary", "confidence"],
|
|
34
|
+
"assertions": [{"field": "confidence", "type": "range", "value": {"min": 0.0, "max": 1.0}}],
|
|
35
|
+
"on_fail": "block"
|
|
36
|
+
}
|
|
37
|
+
)
|
|
38
|
+
|
|
39
|
+
print(envelope["contract_passed"])
|
|
40
|
+
print(ct.stats())
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
## Links
|
|
44
|
+
- GitHub: https://github.com/eugene001dayne/chain-thread
|
|
45
|
+
- Live API: https://chain-thread.onrender.com
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: chainthread
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Open agent handoff protocol and verification infrastructure.
|
|
5
|
+
Home-page: https://github.com/eugene001dayne/chain-thread
|
|
6
|
+
Author: Eugene Dayne Mawuli
|
|
7
|
+
Author-email: bitelance.team@gmail.com
|
|
8
|
+
Requires-Python: >=3.9
|
|
9
|
+
Description-Content-Type: text/markdown
|
|
10
|
+
Requires-Dist: httpx
|
|
11
|
+
Dynamic: author
|
|
12
|
+
Dynamic: author-email
|
|
13
|
+
Dynamic: description
|
|
14
|
+
Dynamic: description-content-type
|
|
15
|
+
Dynamic: home-page
|
|
16
|
+
Dynamic: requires-dist
|
|
17
|
+
Dynamic: requires-python
|
|
18
|
+
Dynamic: summary
|
|
19
|
+
|
|
20
|
+
# ChainThread Python SDK
|
|
21
|
+
|
|
22
|
+
Open agent handoff protocol and verification infrastructure.
|
|
23
|
+
|
|
24
|
+
## Install
|
|
25
|
+
```bash
|
|
26
|
+
pip install chainthread
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
## Quick Start
|
|
30
|
+
```python
|
|
31
|
+
from chainthread import ChainThread
|
|
32
|
+
|
|
33
|
+
ct = ChainThread()
|
|
34
|
+
|
|
35
|
+
# Create a chain
|
|
36
|
+
chain = ct.create_chain(
|
|
37
|
+
name="my-agent-pipeline",
|
|
38
|
+
description="Research to writer handoff"
|
|
39
|
+
)
|
|
40
|
+
|
|
41
|
+
# Send a handoff envelope
|
|
42
|
+
envelope = ct.send_envelope(
|
|
43
|
+
chain_id=chain["chain_id"],
|
|
44
|
+
sender_id="research-agent",
|
|
45
|
+
sender_role="researcher",
|
|
46
|
+
receiver_id="writer-agent",
|
|
47
|
+
receiver_role="writer",
|
|
48
|
+
payload={"summary": "AI is transforming software.", "confidence": 0.95},
|
|
49
|
+
summary="Research complete, handing off to writer",
|
|
50
|
+
provenance=[{"field": "summary", "source": "model_generated", "confidence": 0.95}],
|
|
51
|
+
contract={
|
|
52
|
+
"required_fields": ["summary", "confidence"],
|
|
53
|
+
"assertions": [{"field": "confidence", "type": "range", "value": {"min": 0.0, "max": 1.0}}],
|
|
54
|
+
"on_fail": "block"
|
|
55
|
+
}
|
|
56
|
+
)
|
|
57
|
+
|
|
58
|
+
print(envelope["contract_passed"])
|
|
59
|
+
print(ct.stats())
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
## Links
|
|
63
|
+
- GitHub: https://github.com/eugene001dayne/chain-thread
|
|
64
|
+
- Live API: https://chain-thread.onrender.com
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
httpx
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
chainthread
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import httpx
|
|
2
|
+
from typing import Optional, List, Dict, Any
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
class ChainThread:
|
|
6
|
+
"""
|
|
7
|
+
Python SDK for ChainThread — open agent handoff protocol
|
|
8
|
+
and verification infrastructure.
|
|
9
|
+
"""
|
|
10
|
+
|
|
11
|
+
def __init__(self, base_url: str = "https://chain-thread.onrender.com"):
|
|
12
|
+
self.base_url = base_url.rstrip("/")
|
|
13
|
+
|
|
14
|
+
def _get(self, path: str):
|
|
15
|
+
with httpx.Client() as client:
|
|
16
|
+
r = client.get(f"{self.base_url}{path}")
|
|
17
|
+
r.raise_for_status()
|
|
18
|
+
return r.json()
|
|
19
|
+
|
|
20
|
+
def _post(self, path: str, data: dict):
|
|
21
|
+
with httpx.Client() as client:
|
|
22
|
+
r = client.post(f"{self.base_url}{path}", json=data)
|
|
23
|
+
r.raise_for_status()
|
|
24
|
+
return r.json()
|
|
25
|
+
|
|
26
|
+
# --- Chains ---
|
|
27
|
+
|
|
28
|
+
def create_chain(self, name: str, description: str = None, tags: dict = {}):
|
|
29
|
+
return self._post("/chains", {
|
|
30
|
+
"name": name,
|
|
31
|
+
"description": description,
|
|
32
|
+
"tags": tags
|
|
33
|
+
})
|
|
34
|
+
|
|
35
|
+
def list_chains(self):
|
|
36
|
+
return self._get("/chains")
|
|
37
|
+
|
|
38
|
+
# --- Envelopes ---
|
|
39
|
+
|
|
40
|
+
def send_envelope(
|
|
41
|
+
self,
|
|
42
|
+
chain_id: str,
|
|
43
|
+
sender_id: str,
|
|
44
|
+
sender_role: str,
|
|
45
|
+
receiver_id: str,
|
|
46
|
+
receiver_role: str,
|
|
47
|
+
payload: Dict[str, Any],
|
|
48
|
+
summary: str,
|
|
49
|
+
provenance: List[Dict] = [],
|
|
50
|
+
contract: Dict = {},
|
|
51
|
+
on_fail: str = "block"
|
|
52
|
+
):
|
|
53
|
+
return self._post("/envelopes", {
|
|
54
|
+
"chain_id": chain_id,
|
|
55
|
+
"sender_id": sender_id,
|
|
56
|
+
"sender_role": sender_role,
|
|
57
|
+
"receiver_id": receiver_id,
|
|
58
|
+
"receiver_role": receiver_role,
|
|
59
|
+
"payload": payload,
|
|
60
|
+
"summary": summary,
|
|
61
|
+
"provenance": provenance,
|
|
62
|
+
"contract": contract,
|
|
63
|
+
"on_fail": on_fail
|
|
64
|
+
})
|
|
65
|
+
|
|
66
|
+
def get_envelope(self, envelope_id: str):
|
|
67
|
+
return self._get(f"/envelopes/{envelope_id}")
|
|
68
|
+
|
|
69
|
+
def get_chain_envelopes(self, chain_id: str):
|
|
70
|
+
return self._get(f"/chains/{chain_id}/envelopes")
|
|
71
|
+
|
|
72
|
+
def validate_envelope(self, envelope_id: str):
|
|
73
|
+
return self._post(f"/envelopes/{envelope_id}/validate", {})
|
|
74
|
+
|
|
75
|
+
# --- Violations ---
|
|
76
|
+
|
|
77
|
+
def get_violations(self):
|
|
78
|
+
return self._get("/violations")
|
|
79
|
+
|
|
80
|
+
# --- Checkpoints ---
|
|
81
|
+
|
|
82
|
+
def create_checkpoint(
|
|
83
|
+
self,
|
|
84
|
+
chain_id: str,
|
|
85
|
+
state_snapshot: Dict[str, Any],
|
|
86
|
+
envelope_id: str = None,
|
|
87
|
+
checkpoint_name: str = None
|
|
88
|
+
):
|
|
89
|
+
return self._post("/checkpoints", {
|
|
90
|
+
"chain_id": chain_id,
|
|
91
|
+
"envelope_id": envelope_id,
|
|
92
|
+
"state_snapshot": state_snapshot,
|
|
93
|
+
"checkpoint_name": checkpoint_name
|
|
94
|
+
})
|
|
95
|
+
|
|
96
|
+
def get_checkpoints(self, chain_id: str):
|
|
97
|
+
return self._get(f"/checkpoints/{chain_id}")
|
|
98
|
+
|
|
99
|
+
# --- Dashboard ---
|
|
100
|
+
|
|
101
|
+
def stats(self):
|
|
102
|
+
return self._get("/dashboard/stats")
|
|
103
|
+
|
|
104
|
+
def health(self):
|
|
105
|
+
return self._get("/health")
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
from setuptools import setup, find_packages
|
|
2
|
+
|
|
3
|
+
setup(
|
|
4
|
+
name="chainthread",
|
|
5
|
+
version="0.1.0",
|
|
6
|
+
description="Open agent handoff protocol and verification infrastructure.",
|
|
7
|
+
long_description=open("README.md").read(),
|
|
8
|
+
long_description_content_type="text/markdown",
|
|
9
|
+
author="Eugene Dayne Mawuli",
|
|
10
|
+
author_email="bitelance.team@gmail.com",
|
|
11
|
+
url="https://github.com/eugene001dayne/chain-thread",
|
|
12
|
+
packages=find_packages(),
|
|
13
|
+
py_modules=["chainthread"],
|
|
14
|
+
python_requires=">=3.9",
|
|
15
|
+
install_requires=["httpx"],
|
|
16
|
+
)
|