Spineforge SDK v2
AI agent identity, credentials, and observability — Okta + Datadog for the AI agent era.
Homepage | Documentation | Dashboard
Spineforge assigns every AI agent a stable identity (Spine ID), manages credential leasing securely, and instruments LLM and tool calls via OpenLLMetry (OpenTelemetry-based auto-instrumentation).
Quick Start
1. Setup in Dashboard
- Go to the Spineforge Dashboard.
- Add your LLM provider keys (e.g., OpenAI, Groq) in the Settings > LLM Keys section. These are securely stored in a zero-trust vault and bound specifically to your user account.
- Create a new Agent in the dashboard and generate a Spineforge API Key (starts with
sf-).
2. Install
pip install spineforge
3. Usage (3 lines to integrate)
import spineforge
from groq import Groq
# 1. Init — maps directly to your dashboard agent via the API key
spine = spineforge.init(api_key="sf-xxxx-xxxx")
# 2. Lease an API key dynamically (Zero client-side secrets!)
groq_key = spine.lease_credential("groq-api-key")
# 3. Instantiate your LLM client with the leased key
client = Groq(api_key=groq_key)
# 4. Wrap your agent's top-level invocation in a run
with spine.run(input=user_query) as run:
result = client.chat.completions.create(
model="llama3-8b-8192",
messages=[{"role": "user", "content": user_query}]
)
run.set_output(result.choices[0].message.content)
That's it. Spineforge auto-instruments LLM calls (Groq, LangChain) in the background via OpenTelemetry. No code changes to your agent logic.
Gateway Agents (No SDK Required)
If you don't want to install the Python SDK or rewrite your code, you can still get observability, cost tracking, and secure key management through our Gateway Agents. Just route your standard OpenAI/OpenAI-compatible requests through our proxy URL, attaching your Gateway Key (sfgw-xxxx):
from openai import OpenAI
client = OpenAI(
base_url="https://spineforge-backend.onrender.com/gateway/v1",
api_key="sfgw-xxxx-xxxx"
)
# We will automatically resolve your actual LLM keys from the vault and log the request!
Credential Leasing
For SDK agents, Spineforge allows you to inject keys dynamically without storing .env files locally.
spine = spineforge.init(api_key="sf-xxxx")
# Lease credentials mapped to your user account
openai_key = spine.lease_credential("openai-api-key")
anthropic_key = spine.lease_credential("anthropic-api-key")
The agent must have the appropriate lease:<provider-key> scope to perform this action.
Security Scopes
Spineforge enforces strict security boundaries via Scopes.
By default, standard scopes like telemetry:write are automatically granted.
You can declare additional scopes from code at registration time:
spine = spineforge.init(
api_key="sf-xxxx",
allowed_scopes=["lease:openai-api-key", "lease:groq-api-key", "telemetry:write"]
)
Note: While you can request scopes via code, you can also seamlessly manage and enforce scope policies globally across your entire fleet straight from the Spineforge Dashboard.
How It Works
init() → Spine
- Resolves identity — Uses your
sf-API key to authenticate and fetch the exact agent identity generated in the dashboard. - Wires instrumentation — creates an OpenTelemetry
TracerProvider, registers a customSpineforgeSpanProcessor, and activates OpenLLMetry instrumentors for installed libraries (Groq, LangChain). - Returns a
Spinehandle — usespine.run()to group actions into runs.
spine.run(input=...) → context manager
The with spine.run(...) block:
- Generates a
run_idand sets it in aContextVarso all spans created during the block are associated with this run. - Emits a
RunEvent(status="running")at entry. - Emits a
RunEvent(status="success")orRunEvent(status="error")at exit. - Force-flushes the OTel pipeline to ensure all action spans are written before the run-end event.
Sink Abstraction
All events flow through a Sink interface:
class Sink(ABC):
def emit(self, event: dict) -> None: ...
def flush(self) -> None: ...
def shutdown(self) -> None: ...
Built-in sinks:
ConsoleSink— compact, coloured one-liners to stdoutFileSink— non-blocking JSONL append via background thread + queueAPISink— batched, non-blocking POSTs to the Spineforge backend with automatic retry and local file fallback
| Variable | Default | Description |
|---|---|---|
SPINEFORGE_REGISTRY_URL |
https://spineforge-backend.onrender.com |
URL of the Spineforge backend. Set to empty string ("") for offline mode. |
Adding a New Framework Instrumentor
To add support for a new framework (e.g. CrewAI):
1. Install the instrumentor package
pip install opentelemetry-instrumentation-crewai
2. Add activation in instrumentation.py
# In _instrument_libraries():
try:
from opentelemetry.instrumentation.crewai import CrewAIInstrumentor
CrewAIInstrumentor().instrument(tracer_provider=provider)
_log_instrumentor_status("CrewAI", True)
except ImportError:
_log_instrumentor_status("CrewAI", False, "not installed")
License
This software is proprietary and confidential. Unauthorized copying, distribution, reproduction, publication, or modification of this software, via any medium, is strictly prohibited. For internal use only.
Metadata
Release files for spineforge 2.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| spineforge-2.0.0.tar.gz | 42.0 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| spineforge-2.0.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 77.4 kB
Release files / spineforge-2.0.0.tar.gz
| Download URL | spineforge-2.0.0.tar.gz |
|---|---|
| Size | 42.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
8fe0ec5e461c3a0d8c7309fa5530dd344ff8d24342dfbdbb01bd31456be59823
|
|
BLAKE2b-256 checksum How to use checksums |
4e18cc763e5dbdabda71c2e019e79ac851cef65ea80c3af3c8e341c701a55b4e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.9.6
|
Release files / spineforge-2.0.0-py3-none-any.whl
| Download URL | spineforge-2.0.0-py3-none-any.whl |
|---|---|
| Size | 35.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
dd6fa8c61c50e773748ec41eaa93da88a918a9b9ce8d1c1fcac2fea1028620ab
|
|
BLAKE2b-256 checksum How to use checksums |
0f5c3a3345e8c651a01c700fb82d49af766dc8f59ce11da5e8f7d6c4c084a027
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.9.6
|