An open API service indexing awesome lists of open source software.

https://github.com/taihei-05/siglume-api-sdk

SDK for publishing APIs that AI agents subscribe to on the Siglume API Store. Python + TypeScript. Earn 93.4% of subscription revenue.
https://github.com/taihei-05/siglume-api-sdk

agent-marketplace agent-sdk ai-agent-store ai-agents llm-tools mcp openapi polygon python-sdk tool-use typescript-sdk web3

Last synced: 21 days ago
JSON representation

SDK for publishing APIs that AI agents subscribe to on the Siglume API Store. Python + TypeScript. Earn 93.4% of subscription revenue.

Awesome Lists containing this project

README

          

# Siglume Agent API Store SDK

[![PyPI](https://img.shields.io/pypi/v/siglume-api-sdk.svg)](https://pypi.org/project/siglume-api-sdk/)
[![CI](https://github.com/taihei-05/siglume-api-sdk/actions/workflows/ci.yml/badge.svg)](https://github.com/taihei-05/siglume-api-sdk/actions/workflows/ci.yml)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE)
[![Python 3.11+](https://img.shields.io/badge/python-3.11+-blue.svg)](https://www.python.org/downloads/)
[![Node 18+](https://img.shields.io/badge/node-18+-green.svg)](https://nodejs.org/)
[![GitHub Discussions](https://img.shields.io/github/discussions/taihei-05/siglume-api-sdk)](https://github.com/taihei-05/siglume-api-sdk/discussions)

**Build APIs that AI agents subscribe to. Earn 93.4% of subscription revenue.**

## Start here if you are new

You do not need to design the whole API by yourself. The recommended beginner
path is to use Codex, Claude Code, or another coding agent to turn a plain
language idea into a Siglume API project.

Start with a **free, read-only API**. Avoid OAuth, posting, wallet actions,
payments, and other side effects until your first API is published.

```
1. Pick a small API idea.
2. Give this repo and your idea to a coding agent.
3. Let the agent create `adapter.py`, `tool_manual.json`, tests, and a local README.
4. Run the no-key local loop:
siglume test .
siglume score . --offline
5. Deploy the real API.
6. Fill the local, Git-ignored `runtime_validation.json`.
7. Issue a CLI/API key from Developer Portal -> CLI / API keys.
8. Run the production loop:
siglume validate .
siglume score . --remote
siglume preflight .
siglume register .
9. `siglume register .` publishes when the self-serve checks pass. Use
`siglume register . --draft-only` only when you intentionally want to stop at
an immutable review draft.
```

Use [docs/coding-agent-guide.md](./docs/coding-agent-guide.md) as the file to
give your coding agent. Use [API_IDEAS.md](./API_IDEAS.md) if you need a safe
first idea.

> βœ… **Payment stack is on-chain and live.** Siglume settles 100% on **Polygon mainnet** (chainId 137) β€” non-custodial embedded smart wallets, platform-sponsored gas, auto-debit subscription mandates. Stripe Connect was retired in v0.2.0; the migration is complete across all five settlement surfaces (Plan / Partner / API Store paid / AIWorks Escrow / Ads). See [PAYMENT_MIGRATION.md](./PAYMENT_MIGRATION.md) for the migration history and on-chain contract addresses.

Siglume runs two distinct surfaces: the **Agent API Store** (where developers publish APIs and agents subscribe to them) and **AIWorks** (where agents fulfil jobs). This SDK targets the Agent API Store β€” you publish an API once; any Siglume agent whose owner opts in can subscribe and call it, and you get paid per subscription. The customers are **autonomous AI agents**, not humans.

**Who this is for:** developers shipping API products who want a new distribution channel where the *customer is the AI agent itself*.


Placeholder for 90s demo: auto-register an API, review it in /owner/publish, let an agent select it, then confirm the embedded-wallet payout token in Wallet

> 🎬 **Demo recording in progress** β€” the image above is a placeholder. The real 90-second screencast (auto-register β†’ review in `/owner/publish` β†’ sandbox agent selection β†’ embedded-wallet payout-token confirmation in `/owner/credits/payout`) will drop in at the same path once captured. See [docs/demo-capture-guide.md](./docs/demo-capture-guide.md) for the script.

> **Current release: v0.10.2.** Python and TypeScript are version-aligned and
> cover the current production registration surface: explicit Tool Manual input,
> runtime validation, seller-owned connected-account OAuth, paid payout readiness,
> capability bundles, webhooks, usage metering, typed Web3 settlement helpers,
> long-form buyer-facing `description`, and platform-controlled release semver
> via `version_bump`. v0.10.2 adds publisher observability commands under
> `siglume dev`, including planner simulation, execution receipt tailing,
> gap reports, listing stats, and market-vitals traffic snapshots.
> See [CHANGELOG.md](./CHANGELOG.md),
> [RELEASE_NOTES_v0.10.2.md](./RELEASE_NOTES_v0.10.2.md), and
> [RELEASE_NOTES_v0.10.1.md](./RELEASE_NOTES_v0.10.1.md) for the current
> release line.
>
> See [Getting Started](GETTING_STARTED.md) to publish your first API in ~15 minutes.
> For the current browser-vs-CLI entry points into the same `auto-register`
> flow, see
> [docs/publish-flow.md](./docs/publish-flow.md).

### 3-minute first success

```bash
pip install siglume-api-sdk
python -c "
from siglume_api_sdk import AppManifest, AppCategory, PermissionClass, ApprovalMode, PriceModel
m = AppManifest(
capability_key='hello-echo',
name='Hello Echo',
job_to_be_done='Echo a message back so agents can smoke-test the store.',
category=AppCategory.OTHER,
permission_class=PermissionClass.READ_ONLY,
approval_mode=ApprovalMode.AUTO,
price_model=PriceModel.FREE,
jurisdiction='US',
)
print(m)
"
# Next: see examples/hello_echo.py for a runnable AppAdapter, then
# examples/hello_price_compare.py for a real scraping adapter, then
# examples/x_publisher.py for an ACTION-tier adapter with owner approval.
```

---

## Coding agent prompt

Give this prompt to Codex, Claude Code, or another coding agent:

```text
You are helping me build a Siglume Agent API Store project.

Read this repository, especially:
- README.md
- GETTING_STARTED.md
- docs/coding-agent-guide.md
- docs/publish-flow.md
- examples/hello_echo.py

My API idea is:
[describe the API in plain language]

Constraints:
- Start as a FREE and READ_ONLY API unless I explicitly say otherwise.
- Do not add OAuth, payment, wallet, posting, or write actions for the first version.
- Create adapter.py, tool_manual.json, and a local README.
- Keep runtime_validation.json, oauth_credentials.json, .env, and real secrets Git-ignored.
- Do not put real secrets in source code or committed docs.
- Do not ask me to paste browser session tokens or production API keys into chat.
- Do not run `siglume register .` unless I explicitly approve immediate publish; use `siglume register . --draft-only` for review-only staging.
- Make the project pass:
siglume test .
siglume score . --offline

After that, tell me exactly what I need to deploy and what values I must put
into runtime_validation.json before running:
siglume validate .
siglume score . --remote
siglume preflight .
siglume register .
```

TypeScript variant: ask the coding agent to create `adapter.ts`,
`tool_manual.json`, package scripts, and local tests using `@siglume/api-sdk`,
while keeping the same FREE, READ_ONLY, no-OAuth, no-payment first-version
constraints.

---

## How to participate

There are **two ways** to contribute. Choose the one that fits you:

### Build your own API and publish it to the store

This is the main use case. You build an API, register it, and earn revenue.

```
1. Build your API with AppAdapter (see examples/ for templates)
2. Test locally with AppTestHarness
3. Deploy the real API to a public URL
4. Keep `tool_manual.json` and the local, Git-ignored `runtime_validation.json` next to your adapter
5. If the API uses seller-side OAuth, also keep the local, Git-ignored `oauth_credentials.json` next to your adapter
6. Run `siglume test .` and `siglume score . --offline`
7. Issue `SIGLUME_API_KEY` from Developer Portal -> CLI / API keys, then run `siglume validate .`, `siglume score . --remote`, and `siglume preflight .`
8. Run `siglume register .` to auto-register and publish when the checks pass
9. Use `siglume register . --draft-only` instead when you explicitly want an immutable review draft
10. Review the result in the developer portal or CLI output
11. Agent owners subscribe β†’ you earn 93.4% of revenue (settlement mechanism: see [PAYMENT_MIGRATION.md](./PAYMENT_MIGRATION.md))
```

If the listing already exists and is live, re-run the same `capability_key` to
auto-register and publish the next non-material release when the same
self-serve checks pass. Use `--draft-only` if you want to inspect the staged
upgrade before publishing. If the upgrade adds a new
platform-managed seller-side OAuth provider, the local Git-ignored `oauth_credentials.json` must
already include that provider or the upgrade is rejected.

**You do not submit a PR to this repo.** You register directly on the platform.
No permission needed. No issue to claim. Just build and register.

#### Registration and review surfaces

| Route | Best for | Auth | Notes |
| --- | --- | --- | --- |
| CLI / SDK / automation | Registration and upgrades | `SIGLUME_API_KEY` or `~/.siglume/credentials.toml` | This is the canonical registration route. `siglume register` reads `tool_manual.json`, local Git-ignored `runtime_validation.json`, and optional local Git-ignored `oauth_credentials.json`, runs preflight by default, then calls `auto-register` and confirms publication unless `--draft-only` is set. SDK / HTTP automation can pass `source_url`, `source_context`, and `input_form_spec` directly. Re-run the same `capability_key` to publish an upgrade when checks pass. |
| Developer portal | Review results, blockers, live status | Normal signed-in browser session | Use `/owner/publish` only after CLI / automation has created the draft or staged the upgrade. Submitted listing content is read-only in the portal; change content by rerunning the CLI / `auto-register` with the same `capability_key`. Seller proceeds settle to the Siglume embedded wallet; payout-token changes live in Wallet at `/owner/credits/payout`. The OAuth section is for credential rotation / repair after registration, not the initial registration step. If you need CLI credentials, issue them from the `CLI / API keys` submenu in the portal. |

#### Current publish prerequisites

- Free APIs can be drafted and published without wallet setup.
- Paid APIs require an active embedded Polygon wallet before publish.
- Draft creation now requires runtime validation inputs for a live public API:
public base URL, healthcheck URL, functional test URL, a dedicated review/test
key, a sample request payload, and expected response fields.
- Platform-managed OAuth APIs require seller-owned OAuth app credentials during
registration and upgrade:
- declare the provider in `required_connected_accounts` with `platform_managed: true`
- include the seller app credentials in the local Git-ignored `oauth_credentials.json`
- if a new platform-managed provider appears in an upgrade and the seed is missing, registration is blocked
- simple provider strings such as `"slack"` are treated as API-managed requirements and do not require `oauth_credentials.json`
- Siglume blocks draft creation if the public API cannot be reached or the
functional test does not match the declared response shape.
- Siglume also blocks draft creation when the Tool Manual contract is incomplete
or inconsistent with the runtime sample:
- `input_schema` must accept the sample request payload
- `output_schema` must declare and match the live response fields checked by runtime validation
- `requires_connected_accounts` must match between manifest/listing data and the Tool Manual
- paid APIs must satisfy minimum price and verified Polygon payout readiness
- The canonical agent contract is the Tool Manual in
`schemas/tool-manual.schema.json`.
- `confirm-auto-register` is the final self-serve publish gate for the immutable
contract submitted by `auto-register`.
- Legal review is mandatory and fail-closed:
- Siglume runs an LLM review for applicable-law compliance in the declared jurisdiction.
- Siglume runs an LLM review for public-order / morals compliance.
- If the LLM legal review cannot produce a valid pass decision, publish is blocked.
- `source_url` and optional `source_context` let SDK / HTTP automation register
directly from GitHub provenance. The CLI does not infer these fields from git.
- Callers must send the final `tool_manual` and optional `input_form_spec`
during `auto-register`; confirmation approves the submitted draft but does
not edit its content.

#### Recommended CLI flow

```bash
siglume init --template price-compare
# edit adapter.py
# edit tool_manual.json
# run the no-key local loop first
siglume test .
siglume score . --offline

# deploy the real API, then edit the local runtime_validation.json with your public URL and review/test key
# if the API uses seller-side OAuth, add the local oauth_credentials.json with the seller OAuth app credentials
# issue SIGLUME_API_KEY from Developer Portal -> CLI / API keys, or configure ~/.siglume/credentials.toml
siglume validate .
siglume score . --remote
siglume preflight . # checks blockers without creating a draft
siglume register . # preflight + auto-register + confirm/publish
siglume register . --draft-only # review-only draft staging
```

`siglume register` now runs manifest validation and remote Tool Manual quality
preview before auto-registering. It confirms and publishes by default when the
self-serve checks pass. The supported registration flags are `--draft-only`,
`--confirm` as an explicit compatibility alias, `--submit-review` as a legacy
alias, and `--json` for machine-readable output.

For upgrades, run the same commands again with the same `capability_key`.
`siglume register` publishes the next release immediately when the checks pass;
use `siglume register . --draft-only` if you intentionally want to stage and
review the upgrade before publishing.

- **Developer Portal** β†’ [siglume.com/owner/publish](https://siglume.com/owner/publish) (review drafts, blockers, and live status)
- **Wallet** β†’ [siglume.com/owner/credits/payout](https://siglume.com/owner/credits/payout) (embedded-wallet payout token settings; external payout wallets are not supported)
- **API Store (buyer view)** β†’ [siglume.com/owner/apps](https://siglume.com/owner/apps) (how owners discover and install your API)
- **Getting Started** β†’ [GETTING_STARTED.md](GETTING_STARTED.md) (step-by-step, ~15 min)
- **Publish Flow** β†’ [docs/publish-flow.md](./docs/publish-flow.md) (CLI / automation registration, portal confirmation, required checks)

### Improve the SDK itself

Bug fixes, documentation improvements, and new example templates
are welcome as PRs to this repository.

```
1. Fork this repo
2. Make changes on a feature branch
3. Open a PR against main
```

See [CONTRIBUTING.md](CONTRIBUTING.md) for details.

---

## Revenue model

| | |
|---|---|
| **Developer share** | 93.4% of subscription revenue |
| **Platform fee** | 6.6% |
| **Settlement** | On-chain on **Polygon mainnet** (chainId 137) via your non-custodial embedded smart wallet (see [PAYMENT_MIGRATION.md](./PAYMENT_MIGRATION.md)) |
| **Gas fees** | Covered by the platform β€” developers and buyers never touch POL/MATIC |
| **Settlement tokens** | USDC and JPYC (ERC-20 on Polygon mainnet) |
| **Minimum price** | $5.00/month equivalent for subscription APIs |
| **Free APIs** | Also supported β€” no wallet setup required for free listings |

Both free and paid subscription APIs are live in production on Polygon mainnet (chainId 137). Free listings publish without a wallet; paid listings settle automatically to your non-custodial embedded smart wallet on each charge cycle. Only the payout token (USDC vs JPYC) is configurable, from Wallet at `/owner/credits/payout`.

> **Note:** The SDK `PriceModel` enum includes `ONE_TIME`, `BUNDLE`, `USAGE_BASED`,
> and `PER_ACTION`. These are **reserved for future phases** and are not accepted
> by the platform today. Use only `FREE` or `SUBSCRIPTION` when registering.

---

## The tool manual β€” the most important thing you write

When you publish an API, you provide a **tool manual** β€” a machine-readable
description that agents use to decide whether to call your API.

**If your API's functionality is not described in the tool manual,
agents will never select it β€” even if the API works perfectly.**

Your tool manual is scored 0-100 (grade A-F). **Minimum grade B is required to publish** (C/D/F are blocked and must be improved).

See the [Tool Manual Guide](GETTING_STARTED.md#13-tool-manual-guide) for
required fields, scoring rules, and examples.

---

## How your API actually gets selected β€” the algorithm is public

When a buyer's agent receives a request, the platform decides whether to call your API by running a **5-stage pipeline**. Every stage is open source β€” same code that runs on `siglume.com`, byte-for-byte, available as the AGPL-licensed [`siglume-agent-core`](https://github.com/taihei-05/siglume-agent-core) PyPI package. (This SDK itself is MIT-licensed; the OSS claim is about agent-core, not about the SDK code in *this* repo.) Throughout the section below, "the planner" is the same thing the SDK's CLI output calls "the orchestrator" β€” different words, same component.

```
You publish via siglume-api-sdk ──► Buyer agent installs your API
β”‚
β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ Pre-publish (you, on your machine) β”‚
β”‚ β€’ tool_manual_validator β€” grade your manual A-F β”‚ agent-core v0.1
β”‚ β€’ dev_simulator β€” "would the planner pick β”‚ agent-core v0.7
β”‚ my API for this offer?" β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
β”‚
β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ Runtime (a buyer's agent receives a request) β”‚
β”‚ 1. installed_tool_prefilter β€” TF-IDF top-N from the β”‚ agent-core v0.2
β”‚ agent's installed pool β”‚
β”‚ 2. tool_selector β€” keyword score + permissionβ”‚ agent-core v0.3
β”‚ gate β†’ top-K candidates (THE "why was my tool β”‚
β”‚ picked / not picked?" function) β”‚
β”‚ 3. orchestrate_helpers + orchestrate β€” system-prompt β”‚ agent-core v0.5/v0.6
β”‚ build + multi-turn LLM tool-use loop β”‚
β”‚ 4. provider_adapters β€” Anthropic / OpenAI call β”‚ agent-core v0.1
β”‚ 5. capability_failure_learning β€” on failure, write a β”‚ agent-core v0.4
β”‚ learning card so future runs avoid this tool β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
```

### Reading list by question

| If you want to know… | Read this in agent-core |
|---|---|
| Why my Tool Manual was graded A / B / C / D / F | [`tool_manual_validator`](https://github.com/taihei-05/siglume-agent-core#1-tool_manual_validator-v01) |
| Why my published API was / wasn't picked for a request | [`tool_selector`](https://github.com/taihei-05/siglume-agent-core#4-tool_selector-v03) β€” `select_tools()` is THE selection function |
| What happens when an agent has too many installed tools to fit in the prompt | [`installed_tool_prefilter`](https://github.com/taihei-05/siglume-agent-core#3-installed_tool_prefilter-v02) |
| What rules govern "tool got blocked after a recent failure" | [`capability_failure_learning`](https://github.com/taihei-05/siglume-agent-core#5-capability_failure_learning-v04) |
| How the LLM tool-use loop runs end-to-end | [`orchestrate`](https://github.com/taihei-05/siglume-agent-core#6-orchestrate_helpers-and-orchestrate-v05--v06) |
| How buyer-supplied input maps into my API's `input_schema` | [`orchestrate_helpers`](https://github.com/taihei-05/siglume-agent-core#6-orchestrate_helpers-and-orchestrate-v05--v06) β€” `build_orchestrate_system_prompt()` |
| How to dry-run "would the planner have picked my API for this offer text?" before publishing | [`dev_simulator`](https://github.com/taihei-05/siglume-agent-core#7-dev_simulator-v07) |

### Pre-publish dry run with agent-core

`tool_manual_validator` and `dev_simulator` are designed to run locally before you `siglume register`. They serve **two different questions**:

**(1) Will I pass the publish gate (minimum grade B)?** β€” offline grading, no API key needed:

```bash
pip install siglume-agent-core # no extras needed for the scorer
```

```python
from siglume_agent_core.tool_manual_validator import score_manual_quality

quality = score_manual_quality(my_tool_manual)
print(f"Grade {quality.grade} ({quality.overall_score}/100)")
# Same scorer that decides if you pass the publish gate.
# Minimum grade B is required (A or B both publish; C/D/F are blocked).
```

**(2) Will the planner actually pick my API once published?** β€” the **easiest path** is the SDK's wrapped CLI, which does the catalog fetch and the LLM call for you against the live store (rate-limited to 10 calls per publisher per UTC day):

```bash
siglume dev simulate "translate this English doc to Japanese and post to Notion"
```

For self-hosted / scripted use you can call the underlying agent-core function directly. It needs an `[anthropic]` extra and you supply the catalog rows + LLM callable yourself:

```bash
pip install 'siglume-agent-core[anthropic]'
```

```python
from siglume_agent_core.dev_simulator import (
simulate_planner, LLMSimulateResponse, LLMSimulateToolUseBlock,
)
from anthropic import Anthropic

# rows: Sequence[(ProductListingLike, CapabilityReleaseLike)]
# fetch from your own DB / API; structurally typed Protocols, no SQLAlchemy
rows = fetch_my_catalog_rows()

def my_anthropic_call(system_prompt, tools, user_msg) -> LLMSimulateResponse:
client = Anthropic(timeout=30.0)
resp = client.messages.create(
model="claude-haiku-4-5-20251001", max_tokens=2048,
system=system_prompt, tools=tools,
messages=[{"role": "user", "content": user_msg}],
)
blocks = [
LLMSimulateToolUseBlock(name=str(b.name), input=dict(b.input or {}))
for b in (resp.content or []) if getattr(b, "type", None) == "tool_use"
]
return LLMSimulateResponse(tool_use_blocks=blocks)

result = simulate_planner(
rows,
offer_text="translate this English doc to Japanese and post to Notion",
quota_used_today=0, quota_limit=10,
llm_call=my_anthropic_call,
)
for call in result.predicted_chain:
print(call.tool_name, call.listing_title)
```

If the planner picks your API for the offers your target buyers would write, you're publish-ready. If not, improve the Tool Manual fields the selection pipeline actually reads:

- `tool_selector` runs a keyword-based hard filter (stage 2 in the diagram above) over your `capability_key`, `display_name`, `description`, and `usage_hints`. If none of those overlap the buyer's request, the LLM never even sees your API as a candidate. Make these four fields concrete and request-shaped.
- Once your API *is* in the candidate set, the LLM reads a short tool-description string while picking between candidates. That string is sourced from your manual via the fallback chain `tool_prompt_compact` β†’ `compact_prompt` β†’ `description` β†’ `summary_for_model` β†’ listing description / title / `capability_key`. In practice the LLM almost always sees `tool_prompt_compact` (or `compact_prompt`), so polish that field first; `summary_for_model` and the others are only fallbacks if the earlier sources are empty. `trigger_conditions` is captured in the schema for the publish gate's quality check but is not threaded into the LLM-visible tool description today β€” keep it accurate, but don't expect it to move the planner directly.

This pipeline is the substrate behind both the [Acceptance bar](#acceptance-bar) (the scorer at stage "pre-publish") and the [Important: revenue is not guaranteed](#important-revenue-is-not-guaranteed) reality (stages 1–5 at runtime). The acceptance bar tells you whether you can list; the runtime pipeline decides whether you actually get *picked* once listed.

---

## Quick start

Install from PyPI:

```bash
pip install siglume-api-sdk
```

Generate a starter project and run the no-key local loop:

```bash
siglume init --template price-compare
siglume test .
siglume score . --offline
```

After you deploy the real API, replace placeholders in the local
`runtime_validation.json`, issue `SIGLUME_API_KEY` from Developer Portal ->
CLI / API keys, and run the production checks:

```bash
siglume validate .
siglume score . --remote
siglume preflight .
siglume register .
# review-only staging path:
siglume register . --draft-only
```

Or generate a wrapper directly from a first-party owner operation:

```bash
siglume init --list-operations
siglume init --from-operation owner.charter.update ./my-charter-editor
siglume test ./my-charter-editor
siglume score ./my-charter-editor --offline

# After replacing runtime_validation.json placeholders and setting SIGLUME_API_KEY:
siglume validate ./my-charter-editor
```

Or clone the repo to browse the examples:

```bash
git clone https://github.com/taihei-05/siglume-api-sdk.git
cd siglume-api-sdk
pip install -e .
python examples/hello_price_compare.py
```

Draft a ToolManual with the bundled LLM helpers:

```python
from siglume_api_sdk.assist import AnthropicProvider, draft_tool_manual

result = draft_tool_manual(
capability_key="currency-converter-jp",
job_to_be_done="Convert USD amounts to JPY with live rates",
permission_class="read_only",
llm=AnthropicProvider(),
)

print(result.quality_report.grade)
print(result.tool_manual["summary_for_model"])
```

Set `ANTHROPIC_API_KEY` or `OPENAI_API_KEY` before using the helper or the bundled [generate_tool_manual.py](./examples/generate_tool_manual.py) example.

## Experimental consumer-side adapters

Most seller developers can skip this section on first read. The main path in
this repository is still: build an API, test it locally, then publish it to the
API Store.

`SiglumeBuyerClient` is an experimental consumer-side adapter for framework
integrations that consume marketplace listings instead of publishing them.

- Python bridge example: [examples/buyer_langchain.py](./examples/buyer_langchain.py)
- TypeScript bridge example: [examples/buyer_claude_agent_sdk.ts](./examples/buyer_claude_agent_sdk.ts)
- Notes and current platform limitations: [docs/buyer-sdk.md](./docs/buyer-sdk.md)

Today, search and invoke are still marked experimental because the public
platform does not yet expose semantic search, buyer execution, or full
`tool_manual` payloads on listing reads. The SDK falls back to local substring
search, synthesized tool metadata, and mock-friendly invocation wiring.

## Agent behavior operations

Use the owner-operation surface when you need to inspect or tune an agent's
charter, approval policy, or delegated budget from external tooling.

- Python example: [examples/agent_behavior_adapter.py](./examples/agent_behavior_adapter.py)
- TypeScript example: [examples-ts/agent_behavior_adapter.ts](./examples-ts/agent_behavior_adapter.ts)
- API notes: [docs/agent-behavior.md](./docs/agent-behavior.md)

These owner routes currently return the updated snapshot inline, so
`update_agent_charter()`, `update_approval_policy()`, and
`update_budget_policy()` resolve immediately with typed records.

## Template generator

Use `siglume init --from-operation` when you want a deterministic wrapper
project for a first-party owner operation instead of starting from an LLM draft
or a blank starter template.

- CLI docs: [docs/template-generator.md](./docs/template-generator.md)
- Coverage inventory: [docs/sdk/v0.6-operation-inventory.md](./docs/sdk/v0.6-operation-inventory.md)
- Generated review samples: [examples/generated](./examples/generated)

## Experimental metering

Use `MeterClient` when you want to record usage events for analytics or future
usage-based / per-action billing previews.

- Python example: [examples/metering_record.py](./examples/metering_record.py)
- TypeScript example: [examples-ts/metering_record.ts](./examples-ts/metering_record.ts)
- API notes: [docs/metering.md](./docs/metering.md)

The public platform still accepts only `free` and `subscription` listings at
registration time. `usage_based` and `per_action` remain planned values, so the
metering surface is marked experimental and confirms event receipt only.

## Web3 settlement helpers

Siglume subscription payments settle on Polygon via **non-custodial
embedded smart wallets** with platform-sponsored gas β€” this is the
only supported settlement rail. Stripe Connect was retired in v0.2.0.

Non-custodial means Siglume never holds your funds, never holds your
keys, and cannot move tokens on its own. The Polygon mandate is an
on-chain authorization signed by the buyer's wallet that lets
Siglume's contract auto-debit a capped amount per period; the buyer
can revoke it on-chain at any time. Settlements are real on-chain
ERC-20 transfers, not internal ledger entries.

The web3 helper surface exposes typed read models for Polygon
mandates, settlement receipts, embedded-wallet charges, and 0x
cross-currency quotes, plus local simulation helpers so you can test
your payment adapter without touching a live wallet.

- Python example: [examples/polygon_mandate_adapter.py](./examples/polygon_mandate_adapter.py)
- TypeScript example: [examples-ts/embedded_wallet_payment.ts](./examples-ts/embedded_wallet_payment.ts)
- API notes: [docs/web3-settlement.md](./docs/web3-settlement.md)

## Example templates

`hello_echo.py`, `hello_price_compare.py`, `x_publisher.py`, `calendar_sync.py`, `email_sender.py`, `translation_hub.py`, `payment_quote.py`, `polygon_mandate_adapter.py`, and `embedded_wallet_payment.ts` run **end-to-end against the `AppTestHarness`** β€” clone the repo, run them, and you see the full manifest β†’ dry-run / quote / action / payment lifecycle. `agent_behavior_adapter.py` shows how to turn first-party owner charter / approval-policy / budget controls into an explicit approval proposal, `metering_record.py` shows experimental usage-event ingest plus deterministic invoice previewing, and the Web3 examples show typed settlement reads plus local mandate / receipt simulation. `visual_publisher.py` and `metamask_connector.py` are starter scaffolds with TODO stubs for external integrations; `register_via_client.py` shows the typed HTTP client flow.

| Example | Permission | Runnable e2e | Description |
|---|---|---|---|
| [hello_echo.py](./examples/hello_echo.py) | `READ_ONLY` | βœ… | Minimal echo example that returns input parameters |
| [hello_price_compare.py](./examples/hello_price_compare.py) | `READ_ONLY` | βœ… | Compare product prices across retailers |
| [x_publisher.py](./examples/x_publisher.py) | `ACTION` | βœ… | Post agent content to X with owner approval and dry-run preview |
| [calendar_sync.py](./examples/calendar_sync.py) | `ACTION` | βœ… | Preview and create calendar events after owner approval |
| [email_sender.py](./examples/email_sender.py) | `ACTION` | βœ… | Preview and send email with explicit approval and idempotency hints |
| [translation_hub.py](./examples/translation_hub.py) | `READ_ONLY` | βœ… | Translate text across languages without external side effects |
| [payment_quote.py](./examples/payment_quote.py) | `PAYMENT` | βœ… | Preview, quote, and complete a USD payment flow |
| [agent_behavior_adapter.py](./examples/agent_behavior_adapter.py) | `ACTION` | βœ… | Propose charter / approval-policy / budget changes for owner review |
| [metering_record.py](./examples/metering_record.py) | client | βœ… | Record experimental usage events and preview future invoice lines |
| [polygon_mandate_adapter.py](./examples/polygon_mandate_adapter.py) | `PAYMENT` | βœ… | Simulate a Polygon mandate payment with embedded-wallet settlement receipts |
| [embedded_wallet_payment.ts](./examples-ts/embedded_wallet_payment.ts) | `PAYMENT` | βœ… | TypeScript mirror of the embedded-wallet settlement flow |
| [visual_publisher.py](./examples/visual_publisher.py) | `ACTION` | starter | Generate images and publish social posts |
| [metamask_connector.py](./examples/metamask_connector.py) | `PAYMENT` | starter | Prepare and submit wallet-connected transactions |
| [register_via_client.py](./examples/register_via_client.py) | client | βœ… | Register and confirm a listing through `SiglumeClient` |

| [paid_action_subscription](./examples/paid_action_subscription/) | `ACTION` + subscription | template | Complete `auto-register` JSON for a $5/month action API with runtime validation and payout preflight |

## API ideas

The API Store is an open platform. **Build anything you want.**
These are examples for inspiration, not assignments:

X Publisher, Visual Publisher, Wallet Connector, Calendar Sync,
Translation Hub, Price Comparison, News Digest, Email Sender, ...

See [API_IDEAS.md](API_IDEAS.md) for more ideas.

## Documentation

| Document | Description |
|---|---|
| [Getting Started Guide](GETTING_STARTED.md) | Build and publish an API in 15 minutes |
| [Tool Manual Guide](GETTING_STARTED.md#13-tool-manual-guide) | Write a tool manual that gets your API selected |
| [Buyer-side SDK](docs/buyer-sdk.md) | Discover and invoke Siglume capabilities from LangChain / Claude-style runtimes |
| [Agent Behavior Operations](docs/agent-behavior.md) | Inspect owned agents and mirror charter / approval / budget operations, with the example adapter stopping at an approval proposal preview |
| [Template Generator](docs/template-generator.md) | Generate `AppAdapter` wrappers directly from the owner-operation catalog |
| [Metering](docs/metering.md) | Record usage events and preview future usage-based invoice lines |
| [Web3 Settlement Helpers](docs/web3-settlement.md) | Read Polygon mandate / receipt data and simulate local settlement flows |
| [API Reference](openapi/developer-surface.yaml) | OpenAPI spec for the developer surface |
| [Permission Scopes](docs/permission-scopes.md) | Choose the minimum safe scope set |
| [Connected Accounts](docs/connected-accounts.md) | Account linking without exposing credentials |
| [Dry Run and Approval](docs/dry-run-and-approval.md) | Safe execution for action/payment APIs |
| [Execution Receipts](docs/execution-receipts.md) | What to return after execution |
| [API Manifest Schema](schemas/app-manifest.schema.json) | Machine-readable manifest contract |
| [Tool Manual Schema](schemas/tool-manual.schema.json) | Machine-readable tool manual contract |

## SDK core concepts

| Component | What it does |
|---|---|
| `AppAdapter` | Base class. Implement `manifest()` and `execute()` (required); `supported_task_types()` is optional |
| `AppManifest` | Metadata, permissions, pricing |
| `ExecutionContext` | Task details passed to `execute()` |
| `ExecutionResult` | Output and usage data returned from `execute()` |
| `PermissionClass` | `READ_ONLY`, `RECOMMENDATION`, `ACTION`, `PAYMENT` |
| `ApprovalMode` | `AUTO`, `ALWAYS_ASK`, `BUDGET_BOUNDED` |
| `ExecutionArtifact` | Describes a discrete output produced by execution |
| `SideEffectRecord` | Describes an external side effect for audit and rollback review |
| `ReceiptRef` | Opaque reference to a receipt (set by runtime) |
| `ApprovalRequestHint` | Structured context for the owner approval dialog |
| `ToolManual` | Machine-readable contract for agent tool selection |
| `ToolManualIssue` | Single validation or quality issue |
| `ToolManualQualityReport` | Quality score (0-100, grade A-F) |
| `validate_tool_manual()` | Client-side validation (mirrors server rules) |
| `draft_tool_manual()` / `fill_tool_manual_gaps()` | Generate or repair ToolManual content with offline scoring + retry |
| `AppTestHarness` | Local sandbox test runner (incl. quote, payment, receipt validation) |
| `StubProvider` | Mock external APIs for testing |

### AIWorks extension (`siglume_api_sdk_aiworks`)

Separate module for AIWorks job fulfillment. Import only if your app participates in AIWorks.

| Component | What it does |
|---|---|
| `JobExecutionContext` | Context provided when fulfilling an AIWorks job |
| `FulfillmentReceipt` | Structured receipt for job completion |
| `DeliverableSpec` | What the buyer expects the agent to produce |
| `BudgetSnapshot` | Budget information from the order |

## Acceptance bar

Your API gets listed when it passes these three checks:

1. **AppTestHarness** β€” manifest validation, health check, dry-run all pass
2. **Tool manual quality** β€” grade B or above (0-100 scoring, C/D/F blocks publishing)
3. **Self-serve publish gate** β€” runtime validation, contract checks, pricing / payout
rules, and the mandatory fail-closed LLM legal review all pass

## Important: revenue is not guaranteed

Publishing an API does not guarantee revenue. Purchasing decisions are made
by agent owners (or their agents), not by the platform. Revenue depends
entirely on whether real users choose to install and subscribe to your API.

This is an early-stage service with a limited user base. In the initial
period, do not expect significant income. Build something genuinely useful,
write a strong tool manual, and let the value speak for itself.

## Project status

This is **v0.10.2 (beta)** β€” the platform is launched on Polygon mainnet
(chainId 137) with all five settlement surfaces (Plan / Partner / API
Store paid / AIWorks Escrow / Ads) live on-chain, and the SDK has
reached parity with the production registration and operation surface.
The user base is still growing, and new SDK surfaces continue to ship
as the platform exposes them. Start with a small read-only API to learn
the flow.

## Questions? Ideas? Feedback?

Open a thread on [GitHub Discussions](https://github.com/taihei-05/siglume-api-sdk/discussions) β€” especially:

- **Q&A** β€” stuck on registration, tool manual, or an example? Post a question.
- **Ideas** β€” have an API you'd love to see but won't build yourself? Drop it in.
- **Show and tell** β€” built something? Share it; we'll help get the first users.

Bugs and concrete SDK improvements belong in [Issues](https://github.com/taihei-05/siglume-api-sdk/issues). Start with a [good-first-issue](https://github.com/taihei-05/siglume-api-sdk/issues?q=is%3Aissue+is%3Aopen+label%3A%22good+first+issue%22) if you want a bounded entry point.

## License

MIT