SynapseDocumentation
SDKs

Python SDK

Use Synapse from Python agents, workers, and provider tooling.

The Python SDK is in Public Preview. Public examples target staging by default.

pip install synapse-client
import os

from synapse_client import SynapseClient

agent_key = os.environ["SYNAPSE_AGENT_KEY"]

client = SynapseClient(
    api_key=agent_key,
    environment="staging",
)

services = client.search("svc_synapse_echo", limit=10)
service = services[0]

result = client.invoke(
    service.service_id,
    {
        "message": "hello from Synapse SDK smoke",
        "metadata": {"scenario": "quickstart"},
    },
    cost_usdc=str(service.price_usdc),
    idempotency_key="agent-job-001",
)

receipt = client.get_invocation(result.invocation_id)
print(receipt.invocation_id, receipt.status, receipt.charged_usdc)

Token-metered LLM calls

llm_result = client.invoke_llm(
    "svc_deepseek_chat",
    {
        "messages": [{"role": "user", "content": "Summarize this document."}],
        "max_tokens": 512,
    },
    max_cost_usdc="0.010000",
    idempotency_key="llm-job-001",
)

print(llm_result.usage, llm_result.synapse)

On this page