Skip to content

docs(bnbagent-sdk): fix non-existent server module, install extras, and 404 example links - #882

Open
Ang-dot wants to merge 4 commits into
bnb-chain:mainfrom
Ang-dot:docs/fix-bnbagent-sdk-server-references
Open

docs(bnbagent-sdk): fix non-existent server module, install extras, and 404 example links#882
Ang-dot wants to merge 4 commits into
bnb-chain:mainfrom
Ang-dot:docs/fix-bnbagent-sdk-server-references

Conversation

@Ang-dot

@Ang-dot Ang-dot commented Aug 23, 2026

Copy link
Copy Markdown
Contributor

📋 Merge order

One of four related docs PRs. Recommended sequence:

# PR Depends on
1 #885 — Studio Node path + nav order
2 #884 — TypeScript SDK quickstart rebased on #885; fast-forwards after it
3 #886 — Studio architecture independent
4 #887 — remaining Studio pages independent

#882 (SDK server-module fixes) is independent of all four.


Summary

The BNB Agent SDK docs reference a bnbagent.erc8183.server module and a server install extra that do not exist in the published package. A developer following the quickstart hits ModuleNotFoundError on the first server example.

Verification is source-level against bnb-chain/bnbagent-sdk main @ 1f5476b and the published bnbagent 0.4.3 wheel on PyPI. (Note: the repo's v0.5.1 tag is the TypeScript package @bnbagent/sdk; the Python tag for the same tree is bnbagent-v0.4.3.)

Root cause

Two upstream commits, not five unrelated errors:

  • 0523197 — "drop the built-in REST server (Remove 404 link #44)", 2026-07-01, first shipped in bnbagent-v0.4.0. Deleted the REST server package and the entire plugin/module system, and renamed two example scripts.
  • 010703a — monorepo restructure, 2026-08-06. Moved examples/python/examples/.

Confirmed on PyPI: the server extra is present in 0.3.0 and absent from 0.4.0 onward.

What was wrong

# Claim in docs Reality in the shipped package
1 pip install "bnbagent[server,ipfs]" and bnbagent[server] No server extra. python/pyproject.toml defines only ipfs, dev, examples. pip emits WARNING: bnbagent 0.4.3 does not provide the extra 'server' and continues, so FastAPI/Uvicorn never get installed.
2 from bnbagent.erc8183.server import create_erc8183_app No such module. create_erc8183_app() lives in python/examples/agent-server/src/erc8183_server.py:254. That example's own README states it is "example code, not SDK API".
3 architecture.md documents a bnbagent/erc8183/server/ package with routes.py That package does not exist. job_ops.py is real, but sits at bnbagent/erc8183/job_ops.py.
4 architecture.md lists module.py / ERC8183Module Neither exists in the package.
5 Example links to tree/main/examples/... All 404 — the real path is tree/main/python/examples/....

Beyond the five: the rest of the class

The five claims above are symptoms of 0523197. Sweeping the docs for everything that commit deleted or moved turned up more of the same defect:

# Defect Location
6 The Tier 1 import block was copy-pasteable and raised ImportErrorBNBAgent and BNBAgentConfig are not in upstream __all__; main.py was deleted by 0523197 and BNBAgentConfig was renamed to AgentConfig in core/. This is the PR's own headline failure mode, 14 lines above the import it originally fixed. architecture.md
7 The whole plugin/module system was still documented — the main.py / core/module.py / core/registry.py / erc8004/module.py table rows, the "Module System" section (which instructed readers to register plugins under a [project.entry-points."bnbagent.modules"] group absent from pyproject.toml), the ModuleInfo.dependencies invariant, the "Custom Module" extension point, and the facade box in the architecture diagram. architecture.md
8 Two more 404 links — it was eight, not six. These use blob/main/examples/ rather than tree/main/examples/, and the files were renamed as well as moved, so a python/ prefix alone does not fix them: python/examples/security/e2e.py and python/examples/x402/buyer_demo.py (both 200). bnbagent-sdk/security.md
9 The quickstart block still deadlocked after the import was fixed. state.startup is assigned at erc8183_server.py:470 as lambda: _spawn(_funded_poll_loop()) — a sync lambda returning the infinite poll loop's Task. Awaiting it means the lifespan never reaches yield and uvicorn never serves. Reproduced under Python 3.11. Pre-existing, and mirrored upstream at service_mount.py:156. quickstart.md
10 Stale "module system" prose that names no symbol, so a symbol grep misses it. architecture.md, index.md, bnbchain-studio/architecture.md
11 The dependencies table advertised a Server (optional) extra, contradicting the "no server extra" note added by this PR. architecture.md

Changes

  • index.md — replaced the phantom server extra with the real examples extra (which carries FastAPI/Uvicorn/python-dotenv/ddgs/aiosqlite); added a note that no server extra exists; retitled the doc-table rows that referred to a module system.
  • quickstart.md — added an admonition explaining create_erc8183_app is reference example code to copy; corrected both imports to from erc8183_server import ...; dropped the await on erc8183_app.state.startup() with a comment on why.
  • architecture.md — removed the deleted plugin/module system in full (table rows, "Module System" section, invariant, extension point, diagram facade, prose); fixed the Tier 1 import block; corrected the config-flow diagram to ERC8183Config; rewrote the dependencies table to the three real extras with their actual contents.
  • bnbagent-sdk/security.md — repointed the two remaining 404 links to their renamed paths.
  • bnbchain-studio/architecture.md — "protocol module system" → "protocol subpackage layout".
  • bnbchain-studio/security.mdbag budget enable opts into wallet-funded renewal and is off by default; corrected "included at no cost", which no shipped artifact supports (the managed-model hook never spends from the wallet, but it draws down the prepaid Pieverse Account Balance; it is $0 only on the default auto/free model); noted that an interactive bag init prompts [Y/n] and treats bare Enter as yes; corrected the fallback from "manual bag llm allocate" to allocate-only mode. Verified against npm @bnbagent/studio-cli 0.0.12 — the package bnbchain-studio/index.md:27 tells users to install. The GitHub repo 404s, but the CLI is published.

Verification

The original check here grepped docs/ for the three strings this PR removes, so it could only ever return clean. Replaced with checks derived from the root-cause commits:

# every symbol the two drift commits deleted or moved
grep -rnE 'BNBAgentModule|ModuleRegistry|ModuleInfo|ERC8004Module|ERC8183Module|create_module|bnbagent\.modules|BNBAgentConfig|\bBNBAgent\b|main\.py|registry\.py' docs/developer-kit/bnbagent-sdk/

# the vocabulary, not just the identifiers — deleted concepts leave prose behind
grep -rniE 'module system|plugin module|plugin system|plugin architecture' docs/

# both link forms, not just tree/
grep -rnoE 'bnbagent-sdk/(blob|tree)/main/examples[^)]*' docs/

All three return no matches on this branch. Every bnbagent-sdk example link in the doc set was status-checked; all resolve.

Known issue, tracked separately

docs/developer-kit/bnbchain-studio/*.md contains 15 links to github.com/bnb-chain/bnbagent-studio, which returns 404 — including one in bnbchain-studio/security.md, a file this PR edits. Counted at this head: demo.md 6, architecture.md 2, deployment.md 2, troubleshooting.md 2, index.md 1, cli-reference.md 1, security.md 1. Out of scope here; follow-up PR to come. Note the bag CLI itself is public on npm, so if that repo is staying private those links may want to point at the package rather than be removed.

docs/llms.txt:217 also still reads "Module system and data flows". That file is generated (chore(llms): sync llms index), so it needs a sync re-run rather than a hand-edit — folding into the same follow-up.

Limits

Verification is source-level and against published package metadata. The ModuleNotFoundError and the await deadlock were reproduced from the code and a stdlib repro, not by installing bnbagent and running the quickstart end to end.

Note on the SDK's own README

python/README.md in the SDK repo already says pip install "bnbagent[ipfs]" correctly — the drift was only in these docs.

…le paths

The SDK docs referenced a `bnbagent.erc8183.server` module and a `server`
install extra that do not exist in the published package. Following the
quickstart produced a ModuleNotFoundError.

Verified against bnbagent-sdk @ v0.5.1:

- No `server` extra. `pyproject.toml` defines only `ipfs`, `dev`, and
  `examples`; `examples` is the group that carries FastAPI/Uvicorn/dotenv.
  Replaced `bnbagent[server,ipfs]` with `bnbagent[ipfs,examples]`.
- No `bnbagent/erc8183/server/` package. `create_erc8183_app()` lives in
  python/examples/agent-server/src/erc8183_server.py, which that example's
  own README states is "example code, not SDK API". Reframed the quickstart
  and architecture sections accordingly and corrected the imports.
- `bnbagent/erc8183/module.py` / `ERC8183Module` do not exist; replaced that
  architecture table row with the real `job_ops.py` entry.
- Example links were missing the `python/` path prefix and 404'd.

Also clarifies `bag budget enable` in the Studio security page: it enables
wallet-funded renewal (off by default) and is separate from the managed-model
auto-renew hook, which is included at no cost.
@hashdit-bot

hashdit-bot Bot commented Aug 23, 2026

Copy link
Copy Markdown

Pull Request Review

This documentation-only PR corrects the Python/web3 BNB Agent SDK installation and server guidance by replacing the nonexistent server extra and module with the real examples extra and reference-example imports. It also fixes example repository links and clarifies that wallet-funded LLM credit renewal is opt-in, mainnet-only, and distinct from the managed-model renewal hook.

Sensitive Content

No sensitive content detected.

Security Issues

No serious security issues detected.


Generated by Hashdit Bot. This tool can absolutely NOT replace manual audits.

The five claims in bnb-chain#882 were all symptoms of one upstream commit
(0523197, "drop the built-in REST server", shipped in bnbagent-v0.4.0).
That commit deleted more than the server package, and the docs only
caught up on the instances that had been clicked. This sweeps the rest.

architecture.md
- Tier 1 import block raised ImportError: BNBAgent and BNBAgentConfig are
  not in upstream __all__ (main.py deleted; BNBAgentConfig renamed to
  AgentConfig in core/). Same failure mode bnb-chain#882 was opened to fix, 14
  lines above the import it already corrected.
- Removed the deleted plugin/module system: main.py, core/module.py,
  core/registry.py and erc8004/module.py table rows; the "Module System"
  section, which told readers to register plugins under a
  [project.entry-points."bnbagent.modules"] group absent from
  pyproject.toml; the ModuleInfo.dependencies invariant; the "Custom
  Module" extension point; the facade box in the diagram.
- Config-flow diagram: BNBAgentConfig -> ERC8183Config, which inherits
  wallet_provider from AgentConfig.
- Dependencies table advertised a "Server (optional)" extra,
  contradicting the no-server-extra note this PR adds to index.md.
  Rewritten to the three real extras with contents from PyPI 0.4.3.
- Redrew the architecture diagram; the connectors no longer met the boxes.

bnbagent-sdk/security.md
- Two more 404 example links; it was eight, not six. Both were renamed as
  well as moved, so the python/ prefix alone would not have fixed them:
  python/examples/security/e2e.py, python/examples/x402/buyer_demo.py.

quickstart.md
- Dropped the await on erc8183_app.state.startup(). state.startup is a
  sync lambda returning the infinite poll loop's Task, so awaiting it
  meant the lifespan never reached yield and uvicorn never served.
  Pre-existing, mirrored upstream at service_mount.py:156.

index.md, bnbchain-studio/architecture.md
- Stale "module system" prose. Names no symbol, so an identifier grep
  misses it; found by sweeping the vocabulary instead.

bnbchain-studio/security.md
- "included at no cost" is unsupported by any shipped artifact. The
  managed-model hook never spends from the wallet but does draw down the
  prepaid Pieverse Account Balance; it is $0 only on the default
  auto/free model. Verified against npm @bnbagent/studio-cli 0.0.12, the
  package index.md:27 tells users to install (the GitHub repo 404s, the
  CLI is published).
- Noted that an interactive bag init prompts [Y/n] and treats bare Enter
  as yes, so the most common first run opts in.
- Fallback is automatic allocate-only mode, not "manual bag llm allocate".

Outstanding, tracked separately: 15 dead links to bnb-chain/bnbagent-studio
across the studio doc set, and docs/llms.txt:217, which is generated and
needs a sync re-run rather than a hand-edit.
@hashdit-bot

hashdit-bot Bot commented Aug 23, 2026

Copy link
Copy Markdown

Pull Request Review

This documentation-only PR aligns the BNB Agent SDK guides with the current Python package by removing references to the deleted plugin/server APIs, documenting the example-based FastAPI integration, and correcting installation extras and imports. It also repairs moved/renamed example links, fixes the mounted-app startup guidance, and clarifies BNB Agent Studio wallet-funded auto-top-up behavior.

Sensitive Content

No sensitive content detected.

Security Issues

No serious security issues detected.


Generated by Hashdit Bot. This tool can absolutely NOT replace manual audits.

… entry

llms.txt:217 still described the SDK architecture page as "Module system and
data flows". The module/plugin system was removed upstream in 0523197 and this
PR strips the last of it from the page itself, so the index line pointed at a
section that no longer exists.

Retargeted to the page's actual headings (Code Map, Public API, Invariants,
Data Flows). Single-line correction, not a full index re-sync.
@hashdit-bot

hashdit-bot Bot commented Aug 23, 2026

Copy link
Copy Markdown

Pull Request Review

This documentation-only PR aligns the BNB Agent SDK guides with the current Python package by removing references to the deleted plugin/server APIs, replacing the nonexistent server extra with examples, and correcting imports and example links. It also fixes the mounted FastAPI lifespan example so the background polling task is started without being awaited, and clarifies BNB Agent Studio’s wallet-funded auto-top-up behavior.

Sensitive Content

No sensitive content detected.

Security Issues

No serious security issues detected.


Generated by Hashdit Bot. This tool can absolutely NOT replace manual audits.

…-server-references

# Conflicts:
#	docs/developer-kit/bnbagent-sdk/architecture.md
#	docs/developer-kit/bnbagent-sdk/index.md
#	docs/developer-kit/bnbchain-studio/architecture.md
#	docs/llms.txt
@hashdit-bot

hashdit-bot Bot commented Aug 26, 2026

Copy link
Copy Markdown

Pull Request Review

This documentation-only PR aligns the BNB Agent SDK guides with the current published Python package by removing references to the deleted plugin/server modules, replacing the nonexistent server extra with examples, correcting imports, and repairing moved or renamed example links. It also updates architecture terminology, fixes the mounted FastAPI startup example, and clarifies BNB Agent Studio wallet-funded auto-top-up behavior.

Sensitive Content

No sensitive content detected.

Security Issues

No serious security issues detected.


Generated by Hashdit Bot. This tool can absolutely NOT replace manual audits.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants