CrowTerminal Python SDK - External Brain for AI Agents
Project description
CrowTerminal Python SDK
External Brain for AI Agents - Persistent memory for AI agents working with creators.
While your agent stores 10-50 lines of context, CrowTerminal stores 6 months of versioned history.
Installation
pip install crowterminal
Quick Start
from crowterminal import CrowTerminal
# Initialize with your API key
client = CrowTerminal("ct_your_api_key")
# Get memory for a creator
skill = client.memory.get("client_123")
print(f"Niche: {skill.primary_niche}")
print(f"Engagement: {skill.avg_engagement}%")
print(f"Best hooks: {skill.hook_patterns}")
Self-Registration
Don't have an API key? Register programmatically:
from crowterminal import CrowTerminal
# This creates a new API key and returns an initialized client
client = CrowTerminal.register(
agent_name="MyBot",
agent_description="Content optimization agent"
)
# API key is printed - save it!
Core Features
Memory Operations
# Get current skill
skill = client.memory.get("client_123")
# Get version history
versions = client.memory.get_versions("client_123", limit=10)
# Compare versions
diff = client.memory.get_diff("client_123", from_version=5, to_version=10)
# Track a field over time
pattern = client.memory.get_pattern("client_123", field="avgEngagement")
print(f"Trend: {pattern['trend']}") # increasing, decreasing, stable
Validate Before Changing (Prevent Mistakes)
result = client.memory.validate("client_123", [
{"field": "hookPatterns", "oldValue": ["POV"], "newValue": ["tutorial"]}
])
if result.validation == "blocked":
print("Don't make this change!")
for warning in result.warnings:
print(f" - {warning['message']}")
Engagement Analysis (The Killer Feature)
analysis = client.memory.engagement_analysis("client_123", {
"hookPatterns": ["confession"],
"contentStyle": "casual",
"primaryNiche": "fitness"
})
print(f"Peak engagement: {analysis.peak_engagement}%")
print(f"Your similarity to top performers: {analysis.similarity_to_top}")
for rec in analysis.recommendations:
print(f"Recommendation: {rec}")
Data Ingestion (Push Your Data)
Push platform data we can't access via API:
# Push retention data from TikTok Studio
client.data.ingest(
client_id="client_123",
platform="TIKTOK",
data_type="retention",
video_id="video_456",
data={
"retentionCurve": [100, 95, 88, 75, 60, 45, 30],
"avgWatchTime": 12.5,
"completionRate": 0.30
}
)
# Push demographics
client.data.ingest(
client_id="client_123",
platform="TIKTOK",
data_type="demographics",
data={
"ageGroups": {"18-24": 45, "25-34": 35, "35-44": 15, "45+": 5},
"genderSplit": {"male": 40, "female": 58, "other": 2},
"topCountries": ["BR", "US", "PT"]
}
)
# Bulk ingest (up to 50 items)
client.data.ingest_bulk([
{"clientId": "client_123", "platform": "TIKTOK", "dataType": "retention", "data": {...}},
{"clientId": "client_123", "platform": "TIKTOK", "dataType": "demographics", "data": {...}},
])
Intelligence (Read-Only)
# Get creator profile
profile = client.intelligence.get_profile("client_123")
# Get hook recommendations
hooks = client.intelligence.get_hooks("client_123", count=5)
# Get optimal posting times
timing = client.intelligence.get_timing("client_123")
# Get platform algorithm insights
intel = client.intelligence.get_platform_intel(["TIKTOK", "INSTAGRAM"])
Error Handling
from crowterminal import (
CrowTerminal,
AuthenticationError,
RateLimitError,
ResourceNotFoundError,
)
client = CrowTerminal("ct_your_api_key")
try:
skill = client.memory.get("client_123")
except AuthenticationError:
print("Invalid API key")
except RateLimitError as e:
print(f"Rate limited. Retry after {e.retry_after} seconds")
except ResourceNotFoundError:
print("Client not found")
Webhooks (Async Notifications)
# Register a webhook
webhook = client.webhooks.register(
url="https://your-server.com/webhook",
events=["skill.updated", "data.ingested"]
)
print(f"Webhook ID: {webhook['id']}")
print(f"Secret (save this!): {webhook['secret']}")
# List webhooks
webhooks = client.webhooks.list()
# Delete a webhook
client.webhooks.delete(webhook_id="wh_xxx")
Service Status
# Check service health (no auth required)
status = client.status.get()
print(f"Service status: {status['status']}")
print(f"Database: {status['services']['database']['status']}")
Sandbox Testing
Use the sandbox endpoints for testing without affecting real data:
# Test without auth
import requests
# Get mock client data
response = requests.get("https://api.crowterminal.com/api/agent/sandbox/client")
print(response.json())
# Test validation
response = requests.post(
"https://api.crowterminal.com/api/agent/sandbox/validate",
json={"proposedChanges": [{"field": "hookPatterns", "newValue": ["tutorial"]}]}
)
print(response.json()) # Will show "blocked" response
Valid Data Types
TikTok
- retention, demographics, traffic_sources, watch_time
- audience_activity, follower_growth, video_performance
- sound_performance, hashtag_performance
- retention, demographics, reach_sources, watch_time
- audience_activity, follower_growth, content_interactions
- story_metrics, reel_metrics
YouTube
- retention, demographics, traffic_sources, watch_time
- audience_activity, subscriber_growth, click_through_rate
- impression_sources, end_screen_performance
Links
License
MIT
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 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 crowterminal-0.1.0.tar.gz.
File metadata
- Download URL: crowterminal-0.1.0.tar.gz
- Upload date:
- Size: 10.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
62733f12a744029f485f7c3f42fc6b75c6f891ce9b5246a74a2f67bdbbb6d47e
|
|
| MD5 |
618a097088be138a0fd00b9fbc13f31c
|
|
| BLAKE2b-256 |
3ef1f626c481466cfbf31c0874da58f7a97e20fcddbc8f18f096f6cdf392676d
|
File details
Details for the file crowterminal-0.1.0-py3-none-any.whl.
File metadata
- Download URL: crowterminal-0.1.0-py3-none-any.whl
- Upload date:
- Size: 9.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
94c1ba98adda93537b5fa8c820bd2fd5f83c793543d8451d2429a45fd573ef16
|
|
| MD5 |
43997eb76079a2dec98a88411c0cd62a
|
|
| BLAKE2b-256 |
493141aa683c09e1c8373152bbe0b0ba8a270500b60c046bbd6f1397ea4672c7
|