crowterminal 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.
@@ -0,0 +1,271 @@
1
+ Metadata-Version: 2.4
2
+ Name: crowterminal
3
+ Version: 0.1.0
4
+ Summary: CrowTerminal Python SDK - External Brain for AI Agents
5
+ Author-email: CrowTerminal <agents@crowterminal.com>
6
+ License: MIT
7
+ Project-URL: Homepage, https://crowterminal.com
8
+ Project-URL: Documentation, https://crowterminal.com/llms.txt
9
+ Project-URL: Repository, https://github.com/WillNigri/FluxOps
10
+ Project-URL: Issues, https://github.com/WillNigri/FluxOps/issues
11
+ Keywords: ai,agents,memory,creators,influencers,crowterminal
12
+ Classifier: Development Status :: 4 - Beta
13
+ Classifier: Intended Audience :: Developers
14
+ Classifier: License :: OSI Approved :: MIT License
15
+ Classifier: Operating System :: OS Independent
16
+ Classifier: Programming Language :: Python :: 3
17
+ Classifier: Programming Language :: Python :: 3.8
18
+ Classifier: Programming Language :: Python :: 3.9
19
+ Classifier: Programming Language :: Python :: 3.10
20
+ Classifier: Programming Language :: Python :: 3.11
21
+ Classifier: Programming Language :: Python :: 3.12
22
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
23
+ Requires-Python: >=3.8
24
+ Description-Content-Type: text/markdown
25
+ Requires-Dist: requests>=2.25.0
26
+ Provides-Extra: dev
27
+ Requires-Dist: pytest>=7.0.0; extra == "dev"
28
+ Requires-Dist: pytest-cov>=4.0.0; extra == "dev"
29
+ Requires-Dist: black>=23.0.0; extra == "dev"
30
+ Requires-Dist: mypy>=1.0.0; extra == "dev"
31
+ Requires-Dist: types-requests>=2.28.0; extra == "dev"
32
+
33
+ # CrowTerminal Python SDK
34
+
35
+ > External Brain for AI Agents - Persistent memory for AI agents working with creators.
36
+
37
+ While your agent stores 10-50 lines of context, CrowTerminal stores 6 months of versioned history.
38
+
39
+ ## Installation
40
+
41
+ ```bash
42
+ pip install crowterminal
43
+ ```
44
+
45
+ ## Quick Start
46
+
47
+ ```python
48
+ from crowterminal import CrowTerminal
49
+
50
+ # Initialize with your API key
51
+ client = CrowTerminal("ct_your_api_key")
52
+
53
+ # Get memory for a creator
54
+ skill = client.memory.get("client_123")
55
+ print(f"Niche: {skill.primary_niche}")
56
+ print(f"Engagement: {skill.avg_engagement}%")
57
+ print(f"Best hooks: {skill.hook_patterns}")
58
+ ```
59
+
60
+ ## Self-Registration
61
+
62
+ Don't have an API key? Register programmatically:
63
+
64
+ ```python
65
+ from crowterminal import CrowTerminal
66
+
67
+ # This creates a new API key and returns an initialized client
68
+ client = CrowTerminal.register(
69
+ agent_name="MyBot",
70
+ agent_description="Content optimization agent"
71
+ )
72
+ # API key is printed - save it!
73
+ ```
74
+
75
+ ## Core Features
76
+
77
+ ### Memory Operations
78
+
79
+ ```python
80
+ # Get current skill
81
+ skill = client.memory.get("client_123")
82
+
83
+ # Get version history
84
+ versions = client.memory.get_versions("client_123", limit=10)
85
+
86
+ # Compare versions
87
+ diff = client.memory.get_diff("client_123", from_version=5, to_version=10)
88
+
89
+ # Track a field over time
90
+ pattern = client.memory.get_pattern("client_123", field="avgEngagement")
91
+ print(f"Trend: {pattern['trend']}") # increasing, decreasing, stable
92
+ ```
93
+
94
+ ### Validate Before Changing (Prevent Mistakes)
95
+
96
+ ```python
97
+ result = client.memory.validate("client_123", [
98
+ {"field": "hookPatterns", "oldValue": ["POV"], "newValue": ["tutorial"]}
99
+ ])
100
+
101
+ if result.validation == "blocked":
102
+ print("Don't make this change!")
103
+ for warning in result.warnings:
104
+ print(f" - {warning['message']}")
105
+ ```
106
+
107
+ ### Engagement Analysis (The Killer Feature)
108
+
109
+ ```python
110
+ analysis = client.memory.engagement_analysis("client_123", {
111
+ "hookPatterns": ["confession"],
112
+ "contentStyle": "casual",
113
+ "primaryNiche": "fitness"
114
+ })
115
+
116
+ print(f"Peak engagement: {analysis.peak_engagement}%")
117
+ print(f"Your similarity to top performers: {analysis.similarity_to_top}")
118
+
119
+ for rec in analysis.recommendations:
120
+ print(f"Recommendation: {rec}")
121
+ ```
122
+
123
+ ### Data Ingestion (Push Your Data)
124
+
125
+ Push platform data we can't access via API:
126
+
127
+ ```python
128
+ # Push retention data from TikTok Studio
129
+ client.data.ingest(
130
+ client_id="client_123",
131
+ platform="TIKTOK",
132
+ data_type="retention",
133
+ video_id="video_456",
134
+ data={
135
+ "retentionCurve": [100, 95, 88, 75, 60, 45, 30],
136
+ "avgWatchTime": 12.5,
137
+ "completionRate": 0.30
138
+ }
139
+ )
140
+
141
+ # Push demographics
142
+ client.data.ingest(
143
+ client_id="client_123",
144
+ platform="TIKTOK",
145
+ data_type="demographics",
146
+ data={
147
+ "ageGroups": {"18-24": 45, "25-34": 35, "35-44": 15, "45+": 5},
148
+ "genderSplit": {"male": 40, "female": 58, "other": 2},
149
+ "topCountries": ["BR", "US", "PT"]
150
+ }
151
+ )
152
+
153
+ # Bulk ingest (up to 50 items)
154
+ client.data.ingest_bulk([
155
+ {"clientId": "client_123", "platform": "TIKTOK", "dataType": "retention", "data": {...}},
156
+ {"clientId": "client_123", "platform": "TIKTOK", "dataType": "demographics", "data": {...}},
157
+ ])
158
+ ```
159
+
160
+ ### Intelligence (Read-Only)
161
+
162
+ ```python
163
+ # Get creator profile
164
+ profile = client.intelligence.get_profile("client_123")
165
+
166
+ # Get hook recommendations
167
+ hooks = client.intelligence.get_hooks("client_123", count=5)
168
+
169
+ # Get optimal posting times
170
+ timing = client.intelligence.get_timing("client_123")
171
+
172
+ # Get platform algorithm insights
173
+ intel = client.intelligence.get_platform_intel(["TIKTOK", "INSTAGRAM"])
174
+ ```
175
+
176
+ ## Error Handling
177
+
178
+ ```python
179
+ from crowterminal import (
180
+ CrowTerminal,
181
+ AuthenticationError,
182
+ RateLimitError,
183
+ ResourceNotFoundError,
184
+ )
185
+
186
+ client = CrowTerminal("ct_your_api_key")
187
+
188
+ try:
189
+ skill = client.memory.get("client_123")
190
+ except AuthenticationError:
191
+ print("Invalid API key")
192
+ except RateLimitError as e:
193
+ print(f"Rate limited. Retry after {e.retry_after} seconds")
194
+ except ResourceNotFoundError:
195
+ print("Client not found")
196
+ ```
197
+
198
+ ## Webhooks (Async Notifications)
199
+
200
+ ```python
201
+ # Register a webhook
202
+ webhook = client.webhooks.register(
203
+ url="https://your-server.com/webhook",
204
+ events=["skill.updated", "data.ingested"]
205
+ )
206
+ print(f"Webhook ID: {webhook['id']}")
207
+ print(f"Secret (save this!): {webhook['secret']}")
208
+
209
+ # List webhooks
210
+ webhooks = client.webhooks.list()
211
+
212
+ # Delete a webhook
213
+ client.webhooks.delete(webhook_id="wh_xxx")
214
+ ```
215
+
216
+ ## Service Status
217
+
218
+ ```python
219
+ # Check service health (no auth required)
220
+ status = client.status.get()
221
+ print(f"Service status: {status['status']}")
222
+ print(f"Database: {status['services']['database']['status']}")
223
+ ```
224
+
225
+ ## Sandbox Testing
226
+
227
+ Use the sandbox endpoints for testing without affecting real data:
228
+
229
+ ```python
230
+ # Test without auth
231
+ import requests
232
+
233
+ # Get mock client data
234
+ response = requests.get("https://api.crowterminal.com/api/agent/sandbox/client")
235
+ print(response.json())
236
+
237
+ # Test validation
238
+ response = requests.post(
239
+ "https://api.crowterminal.com/api/agent/sandbox/validate",
240
+ json={"proposedChanges": [{"field": "hookPatterns", "newValue": ["tutorial"]}]}
241
+ )
242
+ print(response.json()) # Will show "blocked" response
243
+ ```
244
+
245
+ ## Valid Data Types
246
+
247
+ ### TikTok
248
+ - retention, demographics, traffic_sources, watch_time
249
+ - audience_activity, follower_growth, video_performance
250
+ - sound_performance, hashtag_performance
251
+
252
+ ### Instagram
253
+ - retention, demographics, reach_sources, watch_time
254
+ - audience_activity, follower_growth, content_interactions
255
+ - story_metrics, reel_metrics
256
+
257
+ ### YouTube
258
+ - retention, demographics, traffic_sources, watch_time
259
+ - audience_activity, subscriber_growth, click_through_rate
260
+ - impression_sources, end_screen_performance
261
+
262
+ ## Links
263
+
264
+ - [Full Documentation](https://crowterminal.com/llms.txt)
265
+ - [MCP Manifest](https://crowterminal.com/.well-known/mcp.json)
266
+ - [GitHub](https://github.com/WillNigri/FluxOps)
267
+ - [Contact](mailto:agents@crowterminal.com)
268
+
269
+ ## License
270
+
271
+ MIT
@@ -0,0 +1,239 @@
1
+ # CrowTerminal Python SDK
2
+
3
+ > External Brain for AI Agents - Persistent memory for AI agents working with creators.
4
+
5
+ While your agent stores 10-50 lines of context, CrowTerminal stores 6 months of versioned history.
6
+
7
+ ## Installation
8
+
9
+ ```bash
10
+ pip install crowterminal
11
+ ```
12
+
13
+ ## Quick Start
14
+
15
+ ```python
16
+ from crowterminal import CrowTerminal
17
+
18
+ # Initialize with your API key
19
+ client = CrowTerminal("ct_your_api_key")
20
+
21
+ # Get memory for a creator
22
+ skill = client.memory.get("client_123")
23
+ print(f"Niche: {skill.primary_niche}")
24
+ print(f"Engagement: {skill.avg_engagement}%")
25
+ print(f"Best hooks: {skill.hook_patterns}")
26
+ ```
27
+
28
+ ## Self-Registration
29
+
30
+ Don't have an API key? Register programmatically:
31
+
32
+ ```python
33
+ from crowterminal import CrowTerminal
34
+
35
+ # This creates a new API key and returns an initialized client
36
+ client = CrowTerminal.register(
37
+ agent_name="MyBot",
38
+ agent_description="Content optimization agent"
39
+ )
40
+ # API key is printed - save it!
41
+ ```
42
+
43
+ ## Core Features
44
+
45
+ ### Memory Operations
46
+
47
+ ```python
48
+ # Get current skill
49
+ skill = client.memory.get("client_123")
50
+
51
+ # Get version history
52
+ versions = client.memory.get_versions("client_123", limit=10)
53
+
54
+ # Compare versions
55
+ diff = client.memory.get_diff("client_123", from_version=5, to_version=10)
56
+
57
+ # Track a field over time
58
+ pattern = client.memory.get_pattern("client_123", field="avgEngagement")
59
+ print(f"Trend: {pattern['trend']}") # increasing, decreasing, stable
60
+ ```
61
+
62
+ ### Validate Before Changing (Prevent Mistakes)
63
+
64
+ ```python
65
+ result = client.memory.validate("client_123", [
66
+ {"field": "hookPatterns", "oldValue": ["POV"], "newValue": ["tutorial"]}
67
+ ])
68
+
69
+ if result.validation == "blocked":
70
+ print("Don't make this change!")
71
+ for warning in result.warnings:
72
+ print(f" - {warning['message']}")
73
+ ```
74
+
75
+ ### Engagement Analysis (The Killer Feature)
76
+
77
+ ```python
78
+ analysis = client.memory.engagement_analysis("client_123", {
79
+ "hookPatterns": ["confession"],
80
+ "contentStyle": "casual",
81
+ "primaryNiche": "fitness"
82
+ })
83
+
84
+ print(f"Peak engagement: {analysis.peak_engagement}%")
85
+ print(f"Your similarity to top performers: {analysis.similarity_to_top}")
86
+
87
+ for rec in analysis.recommendations:
88
+ print(f"Recommendation: {rec}")
89
+ ```
90
+
91
+ ### Data Ingestion (Push Your Data)
92
+
93
+ Push platform data we can't access via API:
94
+
95
+ ```python
96
+ # Push retention data from TikTok Studio
97
+ client.data.ingest(
98
+ client_id="client_123",
99
+ platform="TIKTOK",
100
+ data_type="retention",
101
+ video_id="video_456",
102
+ data={
103
+ "retentionCurve": [100, 95, 88, 75, 60, 45, 30],
104
+ "avgWatchTime": 12.5,
105
+ "completionRate": 0.30
106
+ }
107
+ )
108
+
109
+ # Push demographics
110
+ client.data.ingest(
111
+ client_id="client_123",
112
+ platform="TIKTOK",
113
+ data_type="demographics",
114
+ data={
115
+ "ageGroups": {"18-24": 45, "25-34": 35, "35-44": 15, "45+": 5},
116
+ "genderSplit": {"male": 40, "female": 58, "other": 2},
117
+ "topCountries": ["BR", "US", "PT"]
118
+ }
119
+ )
120
+
121
+ # Bulk ingest (up to 50 items)
122
+ client.data.ingest_bulk([
123
+ {"clientId": "client_123", "platform": "TIKTOK", "dataType": "retention", "data": {...}},
124
+ {"clientId": "client_123", "platform": "TIKTOK", "dataType": "demographics", "data": {...}},
125
+ ])
126
+ ```
127
+
128
+ ### Intelligence (Read-Only)
129
+
130
+ ```python
131
+ # Get creator profile
132
+ profile = client.intelligence.get_profile("client_123")
133
+
134
+ # Get hook recommendations
135
+ hooks = client.intelligence.get_hooks("client_123", count=5)
136
+
137
+ # Get optimal posting times
138
+ timing = client.intelligence.get_timing("client_123")
139
+
140
+ # Get platform algorithm insights
141
+ intel = client.intelligence.get_platform_intel(["TIKTOK", "INSTAGRAM"])
142
+ ```
143
+
144
+ ## Error Handling
145
+
146
+ ```python
147
+ from crowterminal import (
148
+ CrowTerminal,
149
+ AuthenticationError,
150
+ RateLimitError,
151
+ ResourceNotFoundError,
152
+ )
153
+
154
+ client = CrowTerminal("ct_your_api_key")
155
+
156
+ try:
157
+ skill = client.memory.get("client_123")
158
+ except AuthenticationError:
159
+ print("Invalid API key")
160
+ except RateLimitError as e:
161
+ print(f"Rate limited. Retry after {e.retry_after} seconds")
162
+ except ResourceNotFoundError:
163
+ print("Client not found")
164
+ ```
165
+
166
+ ## Webhooks (Async Notifications)
167
+
168
+ ```python
169
+ # Register a webhook
170
+ webhook = client.webhooks.register(
171
+ url="https://your-server.com/webhook",
172
+ events=["skill.updated", "data.ingested"]
173
+ )
174
+ print(f"Webhook ID: {webhook['id']}")
175
+ print(f"Secret (save this!): {webhook['secret']}")
176
+
177
+ # List webhooks
178
+ webhooks = client.webhooks.list()
179
+
180
+ # Delete a webhook
181
+ client.webhooks.delete(webhook_id="wh_xxx")
182
+ ```
183
+
184
+ ## Service Status
185
+
186
+ ```python
187
+ # Check service health (no auth required)
188
+ status = client.status.get()
189
+ print(f"Service status: {status['status']}")
190
+ print(f"Database: {status['services']['database']['status']}")
191
+ ```
192
+
193
+ ## Sandbox Testing
194
+
195
+ Use the sandbox endpoints for testing without affecting real data:
196
+
197
+ ```python
198
+ # Test without auth
199
+ import requests
200
+
201
+ # Get mock client data
202
+ response = requests.get("https://api.crowterminal.com/api/agent/sandbox/client")
203
+ print(response.json())
204
+
205
+ # Test validation
206
+ response = requests.post(
207
+ "https://api.crowterminal.com/api/agent/sandbox/validate",
208
+ json={"proposedChanges": [{"field": "hookPatterns", "newValue": ["tutorial"]}]}
209
+ )
210
+ print(response.json()) # Will show "blocked" response
211
+ ```
212
+
213
+ ## Valid Data Types
214
+
215
+ ### TikTok
216
+ - retention, demographics, traffic_sources, watch_time
217
+ - audience_activity, follower_growth, video_performance
218
+ - sound_performance, hashtag_performance
219
+
220
+ ### Instagram
221
+ - retention, demographics, reach_sources, watch_time
222
+ - audience_activity, follower_growth, content_interactions
223
+ - story_metrics, reel_metrics
224
+
225
+ ### YouTube
226
+ - retention, demographics, traffic_sources, watch_time
227
+ - audience_activity, subscriber_growth, click_through_rate
228
+ - impression_sources, end_screen_performance
229
+
230
+ ## Links
231
+
232
+ - [Full Documentation](https://crowterminal.com/llms.txt)
233
+ - [MCP Manifest](https://crowterminal.com/.well-known/mcp.json)
234
+ - [GitHub](https://github.com/WillNigri/FluxOps)
235
+ - [Contact](mailto:agents@crowterminal.com)
236
+
237
+ ## License
238
+
239
+ MIT
@@ -0,0 +1,48 @@
1
+ """
2
+ CrowTerminal Python SDK
3
+
4
+ External Brain for AI Agents - Persistent memory for AI agents working with creators.
5
+
6
+ Usage:
7
+ from crowterminal import CrowTerminal
8
+
9
+ client = CrowTerminal("ct_your_api_key")
10
+
11
+ # Get memory for a creator
12
+ skill = client.memory.get("client_123")
13
+ print(f"Niche: {skill.primary_niche}")
14
+
15
+ # Validate changes before making them
16
+ result = client.memory.validate("client_123", [
17
+ {"field": "hookPatterns", "oldValue": ["POV"], "newValue": ["tutorial"]}
18
+ ])
19
+ if result.validation == "blocked":
20
+ print("Don't make this change!")
21
+
22
+ # Push platform data
23
+ client.data.ingest(
24
+ client_id="client_123",
25
+ platform="TIKTOK",
26
+ data_type="retention",
27
+ data={"retentionCurve": [100, 95, 88, 75, 60]}
28
+ )
29
+ """
30
+
31
+ from .client import CrowTerminal
32
+ from .exceptions import (
33
+ CrowTerminalError,
34
+ AuthenticationError,
35
+ ValidationError,
36
+ ResourceNotFoundError,
37
+ RateLimitError,
38
+ )
39
+
40
+ __version__ = "0.1.0"
41
+ __all__ = [
42
+ "CrowTerminal",
43
+ "CrowTerminalError",
44
+ "AuthenticationError",
45
+ "ValidationError",
46
+ "ResourceNotFoundError",
47
+ "RateLimitError",
48
+ ]