|
| 1 | +# Symbiont SDK for Python — Skills Guide |
| 2 | + |
| 3 | +**Purpose**: This guide helps AI assistants quickly build applications using the Symbiont Python SDK. |
| 4 | + |
| 5 | +**For Full Documentation**: See the [README](README.md). |
| 6 | + |
| 7 | +## What This SDK Does |
| 8 | + |
| 9 | +The Symbiont Python SDK (`symbiont-sdk`) provides a client for interacting with the Symbiont agent runtime. It covers agent lifecycle management, workflow execution, memory systems, vector search, scheduling, channel adapters, AgentPin credential verification, and more. |
| 10 | + |
| 11 | +**Part of the ThirdKey trust stack**: SchemaPin (tool integrity) → AgentPin (agent identity) → Symbiont (runtime) |
| 12 | + |
| 13 | +--- |
| 14 | + |
| 15 | +## Quick Start |
| 16 | + |
| 17 | +```bash |
| 18 | +pip install symbiont-sdk |
| 19 | +``` |
| 20 | + |
| 21 | +```python |
| 22 | +from symbiont_sdk import Client |
| 23 | + |
| 24 | +client = Client( |
| 25 | + api_key="your-api-key", |
| 26 | + base_url="http://localhost:8080/api/v1", |
| 27 | +) |
| 28 | +``` |
| 29 | + |
| 30 | +--- |
| 31 | + |
| 32 | +## Core APIs |
| 33 | + |
| 34 | +### Agent Management |
| 35 | + |
| 36 | +```python |
| 37 | +# List agents |
| 38 | +agents = client.list_agents() |
| 39 | + |
| 40 | +# Create an agent |
| 41 | +agent = client.create_agent({ |
| 42 | + "id": "my-agent", |
| 43 | + "name": "My Agent", |
| 44 | + "tools": ["search", "summarize"], |
| 45 | +}) |
| 46 | + |
| 47 | +# Check status |
| 48 | +status = client.get_agent_status("my-agent") |
| 49 | + |
| 50 | +# Get metrics |
| 51 | +metrics = client.get_agent_metrics("my-agent") |
| 52 | + |
| 53 | +# Execute a workflow |
| 54 | +from symbiont_sdk.types import WorkflowExecutionRequest |
| 55 | + |
| 56 | +result = client.execute_workflow(WorkflowExecutionRequest( |
| 57 | + workflow_id="wf-id", |
| 58 | + parameters={"input": "process this"}, |
| 59 | +)) |
| 60 | +``` |
| 61 | + |
| 62 | +### AgentPin Integration (`client.agentpin`) |
| 63 | + |
| 64 | +Cryptographic agent identity verification: |
| 65 | + |
| 66 | +```python |
| 67 | +# Generate P-256 keypair |
| 68 | +keys = client.agentpin.generate_key_pair() |
| 69 | + |
| 70 | +# Issue a JWT credential |
| 71 | +jwt = client.agentpin.issue_credential( |
| 72 | + private_key_pem=keys.private_key_pem, |
| 73 | + kid="key-1", |
| 74 | + issuer="https://example.com", |
| 75 | + agent_id="my-agent", |
| 76 | + capabilities=["read", "write"], |
| 77 | + ttl_secs=3600, |
| 78 | +) |
| 79 | + |
| 80 | +# Verify credential (online) |
| 81 | +result = client.agentpin.verify_credential(jwt) |
| 82 | + |
| 83 | +# Verify credential (offline with local discovery) |
| 84 | +result = client.agentpin.verify_credential_offline(jwt, discovery_doc) |
| 85 | + |
| 86 | +# Verify with trust bundle |
| 87 | +result = client.agentpin.verify_credential_with_bundle(jwt, bundle) |
| 88 | + |
| 89 | +# Fetch discovery document |
| 90 | +doc = client.agentpin.fetch_discovery_document("example.com") |
| 91 | + |
| 92 | +# Trust management |
| 93 | +bundle = client.agentpin.create_trust_bundle() |
| 94 | +client.agentpin.save_trust_bundle(bundle, "bundle.json") |
| 95 | +bundle = client.agentpin.load_trust_bundle("bundle.json") |
| 96 | +``` |
| 97 | + |
| 98 | +### Memory System |
| 99 | + |
| 100 | +Hierarchical memory with short-term, long-term, episodic, and semantic levels: |
| 101 | + |
| 102 | +```python |
| 103 | +from symbiont_sdk.types import MemoryStoreRequest, MemorySearchRequest |
| 104 | + |
| 105 | +# Store a memory |
| 106 | +client.add_memory(MemoryStoreRequest( |
| 107 | + agent_id="my-agent", |
| 108 | + content="Important fact", |
| 109 | + memory_type="fact", |
| 110 | + level="long-term", |
| 111 | +)) |
| 112 | + |
| 113 | +# Search memories |
| 114 | +results = client.search_memory(MemorySearchRequest( |
| 115 | + agent_id="my-agent", |
| 116 | + query="important", |
| 117 | + limit=10, |
| 118 | +)) |
| 119 | + |
| 120 | +# Get conversation context |
| 121 | +context = client.get_conversation_context("conv-123", "my-agent") |
| 122 | + |
| 123 | +# Consolidate memory |
| 124 | +client.consolidate_memory("my-agent") |
| 125 | +``` |
| 126 | + |
| 127 | +### Vector Database (Qdrant) |
| 128 | + |
| 129 | +```python |
| 130 | +from symbiont_sdk.types import ( |
| 131 | + CollectionCreateRequest, VectorUpsertRequest, VectorSearchRequest, |
| 132 | +) |
| 133 | + |
| 134 | +# Create a collection |
| 135 | +client.create_vector_collection(CollectionCreateRequest( |
| 136 | + name="knowledge", |
| 137 | + dimension=384, |
| 138 | +)) |
| 139 | + |
| 140 | +# Add vectors |
| 141 | +client.add_vectors(VectorUpsertRequest( |
| 142 | + collection="knowledge", |
| 143 | + vectors=[{"id": "1", "values": [...], "metadata": {"text": "content"}}], |
| 144 | +)) |
| 145 | + |
| 146 | +# Semantic search |
| 147 | +results = client.search_vectors(VectorSearchRequest( |
| 148 | + collection="knowledge", |
| 149 | + query_vector=[...], |
| 150 | + top_k=5, |
| 151 | +)) |
| 152 | +``` |
| 153 | + |
| 154 | +### Scheduling (`client.schedules`) |
| 155 | + |
| 156 | +```python |
| 157 | +# Create a scheduled task |
| 158 | +schedule = client.schedules.create({ |
| 159 | + "agent_id": "my-agent", |
| 160 | + "cron": "0 */6 * * *", # Every 6 hours |
| 161 | + "parameters": {"task": "cleanup"}, |
| 162 | +}) |
| 163 | + |
| 164 | +# List schedules |
| 165 | +schedules = client.schedules.list() |
| 166 | +``` |
| 167 | + |
| 168 | +### Channel Adapters (`client.channels`) |
| 169 | + |
| 170 | +Manage Slack, Teams, and Mattermost integrations: |
| 171 | + |
| 172 | +```python |
| 173 | +channels = client.channels.list() |
| 174 | +``` |
| 175 | + |
| 176 | +--- |
| 177 | + |
| 178 | +## Configuration |
| 179 | + |
| 180 | +```python |
| 181 | +# Direct configuration |
| 182 | +client = Client(api_key="key", base_url="http://localhost:8080/api/v1") |
| 183 | + |
| 184 | +# From config file (YAML or JSON) |
| 185 | +from symbiont_sdk.config import ConfigManager |
| 186 | + |
| 187 | +config = ConfigManager.load("config.yaml") |
| 188 | +client = Client(config=config) |
| 189 | + |
| 190 | +# From environment variables |
| 191 | +# SYMBIONT_API_KEY, SYMBIONT_BASE_URL |
| 192 | +client = Client() |
| 193 | +``` |
| 194 | + |
| 195 | +--- |
| 196 | + |
| 197 | +## Authentication |
| 198 | + |
| 199 | +```python |
| 200 | +from symbiont_sdk.auth import AuthManager |
| 201 | + |
| 202 | +auth = AuthManager(client) |
| 203 | +# JWT/RBAC authentication built in |
| 204 | +``` |
| 205 | + |
| 206 | +--- |
| 207 | + |
| 208 | +## Sub-Clients |
| 209 | + |
| 210 | +| Client | Access | Purpose | |
| 211 | +|--------|--------|---------| |
| 212 | +| `client.agentpin` | Lazy-loaded | AgentPin credential management | |
| 213 | +| `client.schedules` | Lazy-loaded | Cron scheduling | |
| 214 | +| `client.channels` | Lazy-loaded | Chat channel adapters | |
| 215 | + |
| 216 | +--- |
| 217 | + |
| 218 | +## Pro Tips for AI Assistants |
| 219 | + |
| 220 | +1. **Lazy-loaded sub-clients** — `client.agentpin`, `client.schedules`, `client.channels` are initialized on first access |
| 221 | +2. **AgentPin is ES256 only** — credentials use ECDSA P-256, no other algorithms accepted |
| 222 | +3. **Short-lived credentials** — prefer TTLs of hours, not days |
| 223 | +4. **Trust bundles** for offline/air-gapped environments — bundle discovery + revocation docs |
| 224 | +5. **Memory hierarchy** — use `fact` for persistent knowledge, `conversation` for chat context, `experience` for episodic |
| 225 | +6. **Vector search** with Qdrant — use for semantic similarity over agent knowledge bases |
| 226 | +7. **Config from files** — `ConfigManager.load()` supports YAML and JSON for deployment flexibility |
| 227 | +8. **Secrets via backends** — Vault, Redis, or PostgreSQL backends available; never hardcode secrets |
0 commit comments