Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .env.example
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
SYNAPSE_ENV=staging
SYNAPSE_ENV=prod
SYNAPSE_GATEWAY=
SYNAPSE_AGENT_KEY=agt_xxx
4 changes: 2 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

All notable public SDK changes should be recorded here.

## 0.1.0 - Public Preview
## 0.1.0 - Production

- Published staging-first Python and TypeScript SDK guidance.
- Published production-first Python and TypeScript SDK guidance.
- Standardized agent runtime credentials on `SYNAPSE_AGENT_KEY`.
- Documented two invocation modes: fixed-price API invoke and token-metered LLM invoke.
- Added typed owner/provider SDK return objects.
Expand Down
6 changes: 3 additions & 3 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
# Contributing

Thanks for improving the SynapseNetwork SDK. This repository is public-facing, so every change should keep the developer and AI-agent onboarding path clear, staging-first, and safe.
Thanks for improving the SynapseNetwork SDK. This repository is public-facing, so every change should keep the developer and AI-agent onboarding path clear, prod-first, and safe.

## Before You Start

1. Read `llms.txt`.
2. Use `SYNAPSE_AGENT_KEY` for agent runtime examples.
3. Treat `staging` as the only public preview environment.
4. Use Arbitrum Sepolia and MockUSDC in staging docs; do not document local gateway setup as the public integration path.
3. Treat `prod` as the public default environment.
4. Use staging only for sandbox/E2E docs with Arbitrum Sepolia and MockUSDC; do not document local gateway setup as the public integration path.
5. Never commit private keys, seed phrases, real credentials, or production tokens.

## Development
Expand Down
60 changes: 31 additions & 29 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<img src="https://img.shields.io/badge/Go-preview-blue.svg" />
<img src="https://img.shields.io/badge/Java-17+-blue.svg" />
<img src="https://img.shields.io/badge/.NET-8.0-blue.svg" />
<img src="https://img.shields.io/badge/Status-Public%20Preview-orange.svg" />
<img src="https://img.shields.io/badge/Status-Production-green.svg" />
<img src="https://img.shields.io/badge/License-MIT-green.svg" />
</p>

Expand All @@ -28,28 +28,30 @@ SynapseNetwork lets an agent discover services, invoke them through a gateway, a
2. Create a `SynapseClient`.
3. Search, invoke, and read the receipt.

> Public Preview default: SDK examples use `staging`, backed by `https://api-staging.synapse-network.ai`.
> After production launch, replace the public examples and tests with the `prod` environment.
> Production default: SDK examples use `prod`, backed by `https://api.synapse-network.ai`.
> Staging remains available as a sandbox for gated E2E and MockUSDC testing.

## Staging Public Preview
## Production Onboarding

Today, public developer onboarding runs on staging:
Public developer onboarding now runs on production:

- Gateway: `https://api-staging.synapse-network.ai`
- App docs: [staging.synapse-network.ai/docs/sdk](https://staging.synapse-network.ai/docs/sdk)
- Chain: Arbitrum Sepolia testnet
- Asset: MockUSDC for integration testing, not production USDC
- Website: `https://www.synapse-network.ai`
- SDK docs: `https://docs.synapse-network.ai/sdks`
- Gateway API: `https://api.synapse-network.ai`
- Asset: production USDC settlement through SynapseNetwork

Recommended path:

1. Connect a wallet in the staging Gateway Dashboard.
1. Connect a wallet in the Synapse Gateway Dashboard.
2. Get or issue an Agent Key and export it as `SYNAPSE_AGENT_KEY`.
3. Set `SYNAPSE_ENV=staging`.
4. Use the free first-party `svc_synapse_echo` smoke service first, or fund staging balance with MockUSDC before paid test calls.
3. Set `SYNAPSE_ENV=prod`, or omit it because `prod` is the SDK default.
4. Use the free first-party `svc_synapse_echo` smoke service first, then run paid calls with an explicitly funded account and credential budget.
5. Run one fixed-price API invoke and one token-metered LLM invoke.
6. Read the invocation receipt and verify settlement metadata.

Developers should pass staging before any future production migration. Production docs and examples stay reserved until production DNS, contracts, gateway health, and docs deployment are verified.
### Staging Sandbox

Staging remains available for gated E2E and integration rehearsals only: `https://api-staging.synapse-network.ai` on Arbitrum Sepolia with MockUSDC test assets. Do not use staging credentials or MockUSDC examples as the public production quickstart.

## Choose Your Integration Path

Expand All @@ -72,24 +74,24 @@ Do not recompute money with floating-point math. Pass discovered prices and spen

| Surface | Link | Status |
|---|---|---|
| SDK Hub | [staging.synapse-network.ai/docs/sdk](https://staging.synapse-network.ai/docs/sdk) | Public Preview |
| Python SDK | [staging.synapse-network.ai/docs/sdk/python](https://staging.synapse-network.ai/docs/sdk/python) | Public Preview |
| TypeScript SDK | [staging.synapse-network.ai/docs/sdk/typescript](https://staging.synapse-network.ai/docs/sdk/typescript) | Public Preview |
| Production docs | Reserved until production docs are live | Reserved |
| SDK Docs | [docs.synapse-network.ai/sdks](https://docs.synapse-network.ai/sdks) | Production |
| Website | [www.synapse-network.ai](https://www.synapse-network.ai) | Production |
| Gateway API | [api.synapse-network.ai](https://api.synapse-network.ai) | Production |

## Gateway Environments

| Environment | Gateway URL | Intended use |
|---|---|---|
| `staging` | `https://api-staging.synapse-network.ai` | Public preview, test assets, integration trials |
| `prod` | `https://api.synapse-network.ai` | Default production environment |
| `staging` | `https://api-staging.synapse-network.ai` | Sandbox, gated E2E, MockUSDC integration rehearsals |

Resolution rules:

1. Explicit `gateway_url` / `gatewayUrl`
2. Explicit `environment`
3. Python only: `SYNAPSE_GATEWAY`
4. Python only: `SYNAPSE_ENV`
5. Default: `staging`
5. Default: `prod`

The SDK never probes DNS and never falls back between environments automatically. This prevents production credentials or funds from being routed to the wrong gateway.

Expand Down Expand Up @@ -117,7 +119,7 @@ All five SDKs expose the same public capability families: agent runtime, owner w

## Examples By SDK

All runnable examples default to staging and read `SYNAPSE_AGENT_KEY`.
All runnable examples default to production and read `SYNAPSE_AGENT_KEY`.
The fixed-price smoke examples first call `svc_synapse_echo`, then fall back to another free fixed-price service if echo is unavailable.

| SDK | Free fixed-price smoke | LLM smoke | Full E2E |
Expand Down Expand Up @@ -148,7 +150,7 @@ Step 2: let your agent discover and work.

```bash
pip install synapse-client
export SYNAPSE_ENV=staging
export SYNAPSE_ENV=prod
export SYNAPSE_AGENT_KEY=agt_xxx
```

Expand Down Expand Up @@ -197,7 +199,7 @@ if (!agentKey) {

const client = new SynapseClient({
credential: agentKey,
environment: "staging",
environment: "prod",
});

const services = await client.search("svc_synapse_echo", {
Expand Down Expand Up @@ -260,7 +262,7 @@ from synapse_client import SynapseAuth

auth = SynapseAuth.from_private_key(
"0xYOUR_PRIVATE_KEY",
environment="staging",
environment="prod",
)
issued = auth.issue_credential(name="agent-preview", maxCalls=100, creditLimit=5)
print(issued.credential.id, issued.token)
Expand All @@ -273,7 +275,7 @@ import { Wallet } from "ethers";
import { SynapseAuth } from "@synapse-network-ai/sdk";

const wallet = new Wallet(process.env.OWNER_PRIVATE_KEY!);
const auth = SynapseAuth.fromWallet(wallet, { environment: "staging" });
const auth = SynapseAuth.fromWallet(wallet, { environment: "prod" });
const issued = await auth.issueCredential({
name: "agent-preview",
maxCalls: 100,
Expand All @@ -291,7 +293,7 @@ Python:
```python
from synapse_client import SynapseAuth

auth = SynapseAuth.from_private_key("0xYOUR_PRIVATE_KEY", environment="staging")
auth = SynapseAuth.from_private_key("0xYOUR_PRIVATE_KEY", environment="prod")
provider = auth.provider()

secret = provider.issue_secret(name="weather-api")
Expand All @@ -312,7 +314,7 @@ import { Wallet } from "ethers";
import { SynapseAuth } from "@synapse-network-ai/sdk";

const auth = SynapseAuth.fromWallet(new Wallet(process.env.OWNER_PRIVATE_KEY!), {
environment: "staging",
environment: "prod",
});
const provider = auth.provider();

Expand All @@ -331,7 +333,7 @@ Credential handling and vulnerability reporting live in [SECURITY.md](./SECURITY

## Python Examples

The Python examples are staging-first and live under `python/examples`.
The Python examples are production-first and live under `python/examples`.

```bash
cd python
Expand All @@ -346,7 +348,7 @@ PYTHONPATH="$PWD" .venv/bin/python examples/llm_smoke.py
PYTHONPATH="$PWD" .venv/bin/python examples/e2e.py
```

Register a provider service on staging:
Register a provider service on production:

```bash
PYTHONPATH="$PWD" .venv/bin/python examples/provider_staging_onboarding.py \
Expand All @@ -366,7 +368,7 @@ PYTHONPATH="$PWD" .venv/bin/python examples/consumer_call_provider.py \
--payload-json '{"prompt":"hello"}'
```

Create a fresh staging wallet, issue an Agent Key, and invoke a free service:
Create a fresh production wallet, issue an Agent Key, and invoke a free service:

```bash
PYTHONPATH="$PWD" .venv/bin/python examples/consumer_wallet_to_invoke.py \
Expand Down
60 changes: 31 additions & 29 deletions README.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<img src="https://img.shields.io/badge/Go-preview-blue.svg" />
<img src="https://img.shields.io/badge/Java-17+-blue.svg" />
<img src="https://img.shields.io/badge/.NET-8.0-blue.svg" />
<img src="https://img.shields.io/badge/Status-Public%20Preview-orange.svg" />
<img src="https://img.shields.io/badge/Status-Production-green.svg" />
<img src="https://img.shields.io/badge/License-MIT-green.svg" />
</p>

Expand All @@ -26,28 +26,30 @@ SynapseNetwork 让 Agent 可以发现服务、通过 gateway 调用服务,并
2. 创建 `SynapseClient`。
3. 搜索服务、调用服务、读取 receipt。

> Public Preview 默认使用 `staging`,对应 `https://api-staging.synapse-network.ai`。
> 生产环境上线后,再把公开示例和测试统一切换到 `prod`
> Production 默认使用 `prod`,对应 `https://api.synapse-network.ai`。
> staging 仍保留为 sandbox / gated E2E 环境,使用 Arbitrum Sepolia 和 MockUSDC

## Staging Public Preview
## Production Onboarding

当前公开开发者接入统一走 staging
当前公开开发者接入统一走生产环境

- Gateway:`https://api-staging.synapse-network.ai`
- App docs:[staging.synapse-network.ai/docs/sdk](https://staging.synapse-network.ai/docs/sdk)
- 链:Arbitrum Sepolia 测试网
- 资产:MockUSDC,用于接入测试,不是生产 USDC
- 官网:`https://www.synapse-network.ai`
- SDK 文档:`https://docs.synapse-network.ai/sdks`
- Gateway API:`https://api.synapse-network.ai`
- 资产:SynapseNetwork 生产 USDC 结算

推荐路径:

1. 在 staging Gateway Dashboard 连接钱包。
1. 在 Synapse Gateway Dashboard 连接钱包。
2. 获取或签发 Agent Key,并设置为 `SYNAPSE_AGENT_KEY`。
3. 设置 `SYNAPSE_ENV=staging`。
4. 先调用免费服务;如需付费测试,先准备 MockUSDC 测试余额
3. 设置 `SYNAPSE_ENV=prod`,或者省略该变量,因为 SDK 默认就是 `prod`。
4. 先调用免费服务;付费调用前确认账户余额和 credential budget
5. 跑通一次 fixed-price API invoke 和一次 token-metered LLM invoke。
6. 读取 invocation receipt,确认结算元数据。

开发者应先在 staging 验证通过。Production docs 与示例会在生产 DNS、合约、gateway health 和 docs deployment 验证后再统一切换。
### Staging Sandbox

staging 只用于 sandbox、gated E2E 和集成预演:`https://api-staging.synapse-network.ai`,链是 Arbitrum Sepolia,资产是 MockUSDC。不要把 staging credential 或 MockUSDC 示例当成生产 quickstart。

## 选择你的接入路径

Expand All @@ -70,24 +72,24 @@ SynapseNetwork 让 Agent 可以发现服务、通过 gateway 调用服务,并

| 页面 | 链接 | 状态 |
|---|---|---|
| SDK Hub | [staging.synapse-network.ai/docs/sdk](https://staging.synapse-network.ai/docs/sdk) | Public Preview |
| Python SDK | [staging.synapse-network.ai/docs/sdk/python](https://staging.synapse-network.ai/docs/sdk/python) | Public Preview |
| TypeScript SDK | [staging.synapse-network.ai/docs/sdk/typescript](https://staging.synapse-network.ai/docs/sdk/typescript) | Public Preview |
| 生产文档 | 生产文档上线前预留 | Reserved |
| SDK 文档 | [docs.synapse-network.ai/sdks](https://docs.synapse-network.ai/sdks) | Production |
| 官网 | [www.synapse-network.ai](https://www.synapse-network.ai) | Production |
| Gateway API | [api.synapse-network.ai](https://api.synapse-network.ai) | Production |

## Gateway 运行环境

| 环境 | Gateway URL | 用途 |
|---|---|---|
| `staging` | `https://api-staging.synapse-network.ai` | Public preview、测试资产和接入试跑 |
| `prod` | `https://api.synapse-network.ai` | 默认生产环境 |
| `staging` | `https://api-staging.synapse-network.ai` | Sandbox、gated E2E、MockUSDC 集成预演 |

解析优先级:

1. 显式 `gateway_url` / `gatewayUrl`
2. 显式 `environment`
3. 仅 Python:`SYNAPSE_GATEWAY`
4. 仅 Python:`SYNAPSE_ENV`
5. 默认:`staging`
5. 默认:`prod`

SDK 不会自动探测 DNS,也不会在环境之间自动 fallback。这样可以避免生产凭据或资金被错误路由到其他 gateway。

Expand Down Expand Up @@ -115,7 +117,7 @@ Provider 是 owner scope 下的供给侧角色,不是第二套根账户体系

## 各 SDK 示例

所有 runnable examples 默认使用 staging,并读取 `SYNAPSE_AGENT_KEY`。
所有 runnable examples 默认使用生产环境,并读取 `SYNAPSE_AGENT_KEY`。

| SDK | 免费 fixed-price smoke | LLM smoke | 完整 E2E |
|---|---|---|---|
Expand Down Expand Up @@ -145,7 +147,7 @@ bash scripts/e2e/sdk_parity_e2e.sh --env staging --skip-install

```bash
pip install synapse-client
export SYNAPSE_ENV=staging
export SYNAPSE_ENV=prod
export SYNAPSE_AGENT_KEY=agt_xxx
```

Expand Down Expand Up @@ -194,7 +196,7 @@ if (!agentKey) {

const client = new SynapseClient({
credential: agentKey,
environment: "staging",
environment: "prod",
});

const services = await client.search("free", {
Expand Down Expand Up @@ -257,7 +259,7 @@ from synapse_client import SynapseAuth

auth = SynapseAuth.from_private_key(
"0xYOUR_PRIVATE_KEY",
environment="staging",
environment="prod",
)
issued = auth.issue_credential(name="agent-preview", maxCalls=100, creditLimit=5)
print(issued.credential.id, issued.token)
Expand All @@ -270,7 +272,7 @@ import { Wallet } from "ethers";
import { SynapseAuth } from "@synapse-network-ai/sdk";

const wallet = new Wallet(process.env.OWNER_PRIVATE_KEY!);
const auth = SynapseAuth.fromWallet(wallet, { environment: "staging" });
const auth = SynapseAuth.fromWallet(wallet, { environment: "prod" });
const issued = await auth.issueCredential({
name: "agent-preview",
maxCalls: 100,
Expand All @@ -288,7 +290,7 @@ Python:
```python
from synapse_client import SynapseAuth

auth = SynapseAuth.from_private_key("0xYOUR_PRIVATE_KEY", environment="staging")
auth = SynapseAuth.from_private_key("0xYOUR_PRIVATE_KEY", environment="prod")
provider = auth.provider()

secret = provider.issue_secret(name="weather-api")
Expand All @@ -309,7 +311,7 @@ import { Wallet } from "ethers";
import { SynapseAuth } from "@synapse-network-ai/sdk";

const auth = SynapseAuth.fromWallet(new Wallet(process.env.OWNER_PRIVATE_KEY!), {
environment: "staging",
environment: "prod",
});
const provider = auth.provider();

Expand All @@ -328,13 +330,13 @@ const status = await provider.getServiceStatus(service.serviceId);

## Python 示例

Python examples 默认面向 staging,位于 `python/examples`。
Python examples 默认面向生产环境,位于 `python/examples`。

```bash
cd /Users/cliff/workspace/agent/Synapse-Network-Sdk/python
```

在 staging 注册 provider service:
在生产环境注册 provider service:

```bash
PYTHONPATH="$PWD" .venv/bin/python examples/provider_staging_onboarding.py \
Expand All @@ -354,7 +356,7 @@ PYTHONPATH="$PWD" .venv/bin/python examples/consumer_call_provider.py \
--payload-json '{"prompt":"hello"}'
```

创建新的 staging wallet、签发 Agent Key,并调用免费服务:
创建新的生产 wallet、签发 Agent Key,并调用免费服务:

```bash
PYTHONPATH="$PWD" .venv/bin/python examples/consumer_wallet_to_invoke.py \
Expand Down
8 changes: 4 additions & 4 deletions SECURITY.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
# Security Policy

## Public Preview Boundary
## Production Boundary

The SDK defaults to the Synapse public preview gateway:
The SDK defaults to the Synapse production gateway:

```text
https://api-staging.synapse-network.ai
https://api.synapse-network.ai
```

Staging is for test assets and integration trials. Production credentials, production private keys, and live-funds workflows must only be used after the official production gateway DNS and `/health` endpoint are verified.
Production credentials, production private keys, and live-funds workflows should only target the verified production gateway. Staging remains available only for sandbox/E2E rehearsals at `https://api-staging.synapse-network.ai` with Arbitrum Sepolia and MockUSDC.

## Secrets

Expand Down
Loading
Loading