项目 / underloam/xbbg

underloam/xbbg

行业候选
语言 Rust标签 financial-dataapache-arrowblpapifinancefintechmarket-datanapi-rsnodejspandaspolarspyo3pythonquantitative-financeruststreamingtimeseries数据更新 2026-11-21 06:42:11 · 仓库 2026-11-20

一段话介绍

xbbg 是一套独立的开源 Bloomberg 客户端,以 Python 为主要接口,并提供 JavaScript/Node 与 Java 绑定;请求执行、解析和 Arrow 形态的数据搬运由共用的 Rust 引擎完成。当前 GitHub 仓库仍为 `underloam/xbbg`,未发生跳转;README 写明 `main` 已是 Rust 驱动的 v1,旧的纯 Python 线在 [`release/0.x`](https://github.com/underloam/xbbg/tree/release/0.x) 分支。它提供 BDP、BDS、BDH、日内 bar、tick、BQL 等常见请求的高层辅助,并保留更底层服务请求的出口;默认走本地 Desktop API / DAPI,也可配置 SAPI/B-PIPE、ZFP 等托管环境。安装可执行 `pip install xbbg` 或 `conda install -c conda-forge xbbg`,支持 Python 3.11 至 3.15;使用前需自行具备已授权的 Bloomberg 环境,本工具不提供数据或许可。文档在 [https://xbbg.org/](https://xbbg.org/)。许可为 Apache-2.0。本页只介绍用途与入口。说明见[项目站点](https://xbbg.org/)和[仓库 README](https://github.com/underloam/xbbg)。

本站整理,非 GitHub 官方 description。

官方 description(GitHub API 原样)
Intuitive Data Workflows
688累计星
62Fork
—峰值日增
0上榜次数
总榜
暂未入榜
日榜
暂未入榜
周榜
暂未入榜
月榜
暂未入榜

官方快照(gh_history.db,2026-11-25):总榜 未进 Top50 · 日榜 未进 Top50 · 周榜未满 7 天基线(官方不生成) · 月榜暂无官方口径;下方四卡为站内趋势聚合(周卡按上榜次数,非官方 7 日增量窗)。

行业与场景

按行业选型 →

量化研究与策略回测

适配系统:量化投研平台、行情终端 · 得分 1.4

内置行情接入、因子计算与回测框架,可作为投研团队的策略实验与绩效归因底座。

时序数据存储与设备预警

适配系统:时序数据库、设备监控系统 · 得分 1.3

面向高频时序写入与异常检测优化,可承载设备测点数据并实现阈值/模型告警。

工作流编排与流程自动化

适配系统:工作流引擎、流程自动化平台 · 得分 1.2

提供任务编排、重试与状态管理能力,可作为跨系统业务流程的调度中枢。

更多信息

以下三段按该项目自己的 GitHub README 章节摘录(可合理截断并标明);README 没有对应章节的留空,不编造。

我的用法
xbbg 支持 Python 3.11–3.15,无需以 blpapi 为 Python 依赖,只需 Bloomberg 共享运行库并需授权的 Bloomberg 环境。
特点或设计要点
xbbg 是以 Python 为主接口、附带 JS/Node 与 Java 绑定的 Bloomberg 客户端,底层由共享 Rust 引擎驱动,支持 BDP、BDH、BQL 等请求助手及 B-PIPE、ZFP 等托管环境配置。
星标走势还差一天的数据,明天就能看到曲线
每天 10:30 记一次星标,连续两天后自动生成曲线
首次发现 — · 最近在榜 2026-11-23 · 语言 Rust · 贡献者 —
rust

GitHub 项目主页介绍

来自 GitHub 仓库 README / 主页介绍正文,正文较长,已截断:保留前 20000 字符(原始 68,845 字节),完整内容见 GitHub 仓库。

<!-- markdownlint-disable MD013 MD031 MD032 MD033 MD041 MD051 -->
<div align="center">

<p>
  <a href="https://xbbg.org/python/quickstart">
    <img src="https://raw.githubusercontent.com/underloam/xbbg/main/.github/assets/readme-hero-flat.svg" alt="xbbg banner" width="100%">
  </a>
</p>

[![Python](https://xbbg.org/badges/xbbg/python.svg)](https://pypi.org/project/xbbg/)
[![TypeScript](https://xbbg.org/badges/xbbg/javascript.svg)](https://www.npmjs.com/package/@xbbg/core)<br>
[![Java](https://xbbg.org/badges/xbbg/java.svg)](java-xbbg/README.md)
[![Rust](https://xbbg.org/badges/xbbg/rust.svg)](https://crates.io/crates/xbbg_core)<br>
[![CI](https://xbbg.org/badges/xbbg/ci.svg)](https://github.com/underloam/xbbg/actions/workflows/ci-rust.yml)
[![Documentation](https://xbbg.org/badges/xbbg/docs.svg)](https://xbbg.org/)
[![Discord](https://xbbg.org/badges/xbbg/discord.svg)](https://discord.gg/P34uMwgCjC)
[![License](https://xbbg.org/badges/xbbg/license.svg)](LICENSE)

**Links:** [Documentation](https://xbbg.org/) · [Python](https://xbbg.org/python/) · [Node.js](https://xbbg.org/javascript/) · [Java](https://xbbg.org/java/) · [Quickstart](#quickstart) · [Configuration](#configuration-and-engines) · [Examples notebook](py-xbbg/examples/xbbg_jupyter_examples.ipynb) · [Contributing](CONTRIBUTING.md) · [Changelog](CHANGELOG.md)

</div>

---

<!-- xbbg:latest-release-start -->
Latest release: xbbg==1.8.1 (release: [notes](https://github.com/underloam/xbbg/releases/tag/v1.8.1))
<!-- xbbg:latest-release-end -->

> This `main` branch is the Rust-powered v1 release. For the legacy pure-Python line, use [`release/0.x`](https://github.com/underloam/xbbg/tree/release/0.x).

> **Important:** xbbg is an independent open-source project. It is not affiliated with, endorsed by, sponsored by, or approved by Bloomberg Finance L.P. or its affiliates. Bloomberg, Bloomberg Terminal, B-PIPE, BQL, and related names are trademarks or service marks of their respective owners. xbbg does not grant access to Bloomberg services, data, software, licenses, credentials, or entitlements; users must obtain and use those separately under their own Bloomberg agreements and applicable policies.

## Contents

- [What is xbbg?](#what-is-xbbg)
- [Why xbbg?](#why-xbbg)
- [Installation](#installation)
- [Quickstart](#quickstart)
- [Exchange auctions and imbalance](#exchange-auctions-and-imbalance)
- [JavaScript and Node](#javascript-and-node)
- [Java](#java)
- [Configuration and engines](#configuration-and-engines)
- [Common API surface](#common-api-surface)
- [Entitlement IDs](#entitlement-ids)
- [Delayed data](#delayed-data)
- [Output backends](#output-backends)
- [Async usage](#async-usage)
- [Subscriptions: raw, tick mode, and all fields](#subscriptions-raw-tick-mode-and-all-fields)
- [MCP server](#mcp-server)
- [Troubleshooting](#troubleshooting)
- [Development](#development)
- [Project links](#project-links)

## What is xbbg?

xbbg is a Bloomberg client with Python as the primary surface and companion JavaScript/Node and Java bindings, all backed by a shared Rust engine for request execution, response parsing, Arrow-shaped data movement, async workers, typed errors, and diagnostics.

Use xbbg when you already have Bloomberg access and want higher-level helpers for common request patterns, plus an escape hatch for lower-level Bloomberg service requests.

Core scope:

- request helpers for BDP, BDS, BDH, intraday bars, ticks, BQL, BEQS, BSRCH, BQR, BTA, YAS, and related analytics
- local Bloomberg Desktop API / DAPI by default
- configuration for managed Bloomberg environments, including B-PIPE/SAPI, ZFP leased lines, TLS, failover hosts, SOCKS5, and SDK logging
- sync and async Python APIs backed by the same engine
- output as Narwhals, native xbbg Arrow carriers, PyArrow, pandas, Polars, DuckDB, and other optional Narwhals-backed libraries
- JavaScript/Node bindings in [`js-xbbg`](js-xbbg/README.md)
- Java bindings (Java 8+, plus a Java 17+ add-on) in [`java-xbbg`](java-xbbg/README.md)

<p align="center">
  <img src="https://raw.githubusercontent.com/underloam/xbbg/main/.github/assets/readme-architecture.svg" alt="xbbg shared Rust and Arrow architecture" width="720">
</p>

## Why xbbg?

xbbg's project goal is direct: be the most complete, technically advanced, and performance-focused open-source Bloomberg client for Python workflows, while staying independent of Bloomberg and requiring users to bring their own authorized Bloomberg access.

The short version: if all you need is a tiny one-off `bdp()` wrapper, several packages can work. xbbg is built for the path where that notebook later grows into intraday data, BQL, streaming, B-PIPE/SAPI, ZFP, async services, typed errors, diagnostics, and non-pandas data pipelines.

| Capability | xbbg | raw `blpapi` | pdblp / blp | bbg-fetch | polars-bloomberg |
| --- | --- | --- | --- | --- | --- |
| BDP/BDS/BDH helpers | yes | manual SDK code | yes | yes | partial |
| Intraday bars and ticks | yes | manual SDK code | limited / no | no | partial |
| Streaming subscriptions | yes | manual SDK code | no | no | no |
| BQL, BEQS, BSRCH, BQR, YAS, BTA | broad helper coverage | manual SDK code | limited | limited | partial |
| DAPI, SAPI/B-PIPE, ZFP, TLS, failover, SOCKS5 | configurable engine support | manual SDK code | limited | limited | limited |
| Async worker pools and isolated subscription sessions | yes | application-owned | no | no | no |
| Rust request/parsing engine with Arrow-shaped output | yes | no | no | no | no |
| Output backends beyond pandas | Narwhals, native, PyArrow, pandas, Polars, DuckDB | application-owned | pandas-first | pandas-first | Polars-first |
| Typed errors, diagnostics, field cache, testing helpers | yes | application-owned | limited | limited | limited |

<p align="center">
  <img src="https://raw.githubusercontent.com/underloam/xbbg/main/.github/assets/readme-footprint.svg" alt="xbbg install footprint comparison" width="720">
</p>

## Installation

```cmd
pip install xbbg
```

Conda users can install the conda-forge build:

```cmd
conda install -c conda-forge xbbg
```

`blpapi` is **not** required as a Python dependency. xbbg only needs Bloomberg's shared runtime library
(`blpapi3_64.dll` on Windows, `libblpapi3_64.so` on macOS/Linux), which can come from Bloomberg
Terminal/DAPI, a managed Bloomberg C++ SDK install, or Bloomberg's official `blpapi` wheel. Installing
the wheel is just the easiest discovery path for many users:

```cmd
pip install blpapi --index-url=https://blpapi.bloomberg.com/repository/releases/python/simple/
```

Supported Python versions: **3.11 through 3.15**. Free-threaded CPython 3.14t/3.15t wheels are available in beta with the `pyarrow` and `pandas` extras; polars, duckdb and the LangGraph adapter are not supported there. See [docs/free-threading.md](docs/free-threading.md).

Requirements and notes:

- You need an authorized Bloomberg environment: local Terminal/DAPI, SAPI/B-PIPE, or ZFP, depending on your setup.
- If you build from source, stage the Bloomberg C++ SDK with `cargo run -p xbbg-sdk --features provision -- cpp` (works on macOS, Linux and Windows; prebuilt standalone `xbbg-sdk` binaries for `linux-amd64`, `darwin-arm64` and `windows-amd64` are attached to GitHub Releases, and installed packages also expose `xbbg-sdk cpp`, `python -m xbbg.sdk cpp`, `npx xbbg-sdk cpp`, and `xbbg-mcp sdk cpp`).
- xbbg loads the Bloomberg runtime when `xbbg._core` is first imported (the native extension itself links no Bloomberg code), using the first of these that loads. The same search order, written once in Rust, serves the Python, Node, Java and MCP packages:
  1. `xbbg.set_sdk_path(...)`: a directory holding the runtime library;
  2. `BLPAPI_LIB_DIR`: that directory, from the environment;
  3. `BLPAPI_ROOT`: the root of a Bloomberg C++ SDK (`lib`, `Linux`, `Darwin`, `bin` and versioned subdirectories are understood);
  4. `XBBG_DEV_SDK_ROOT`: an absolute SDK root for development checkouts;
  5. Bloomberg's `blpapi` Python package, found without importing it;
  6. Bloomberg Terminal/DAPI: `C:\blp\DAPI` and `C:\Program Files (x86)\Bloomberg\Blp\DAPI` on Windows, `~/blp/DAPI` and `/opt/bloomberg/DAPI` elsewhere;
  7. the operating system's library search path (`PATH` on Windows, `LD_LIBRARY_PATH` on Linux, `DYLD_LIBRARY_PATH` and `DYLD_FALLBACK_LIBRARY_PATH` on macOS);
  8. the operating system's own library search, where a system-wide install lives: the `ldconfig` cache and default library directories on Linux, `/usr/local/lib` and `/usr/lib` on macOS, and on Windows the application and system directories and those added with `os.add_dll_directory`;
  9. a Bloomberg runtime provisioned into the shared xbbg cache (`XBBG_CACHE_DIR`, else the per-user cache directory), after checking the library against the hash recorded at install time. The cache is only read when nothing before it loaded. Every language host can fill that cache before any Bloomberg runtime is installed: Python (`xbbg.provision_sdk(...)`, `xbbg.set_sdk_source(...)`, `xbbg-sdk` / `python -m xbbg.sdk`), Node (`@xbbg/core/sdk` `provisionSdk(...)`, `npx xbbg-sdk`), MCP (`xbbg-mcp sdk`), Java (`BlpapiSdk`, see [the Java runtime docs](java-xbbg/README.md#the-bloomberg-runtime)), or automatically via `XBBG_SDK_SOURCE` when no explicit path is set. One install serves all four.

  A candidate that fails to load (for example a runtime older than the one xbbg needs) is skipped and the search goes on, except a path given to `xbbg.set_sdk_path(...)`, which is used or refused on its own (`ValueError`); if nothing loads, `import xbbg._core` raises an `ImportError` that lists every place that was refused and why, naming the functions an old runtime lacks. A process loads one runtime for its lifetime, so `xbbg.set_sdk_path(...)` must run before anything else uses xbbg. `xbbg.get_sdk_info()` lists each source found (`manual`, `sdk_lib_dir`, `sdk_env`, `dev_sdk_root`, `blpapi_python`, `dapi`, `search_path`, `system`, `xbbg_cache`), the cached installs it skipped and why, and which one is `active`.
- Linux wheels are `manylinux_2_28` (x86_64): any distro with glibc ≥ 2.28 works — RHEL/Alma/Rocky 8+, Debian 10+, Ubuntu 20.04+, Amazon Linux 2023.
- Optional dataframe conversions are installed separately: `xbbg[pyarrow]`, `xbbg[pandas]`, `xbbg[polars]`, or `xbbg[duckdb]`.

Verify the install:

```python
import xbbg

print(xbbg.__version__)
print(xbbg.get_sdk_info())
```

## Quickstart

```python
from xbbg import blp

# Reference data
prices = blp.bdp(["AAPL US Equity", "MSFT US Equity"], "PX_LAST")

# Historical data
hist = blp.bdh("SPX Index", "PX_LAST", "2024-01-01", "2024-12-31")

# Intraday bars
bars = blp.bdib("TSLA US Equity", dt="2024-01-15", interval=5)
```

Common request patterns:

```python
from xbbg import blp, ovr

# Multiple fields
info = blp.bdp("NVDA US Equity", ["Security_Name", "GICS_Sector_Name", "PX_LAST"])

# Bloomberg-style overrides
vwap = blp.bdp("AAPL US Equity", "Eqy_Weighted_Avg_Px", VWAP_Dt="20240115")
adj = blp.bdp("AAPL US Equity", "CRNCY_ADJ_PX_LAST", overrides=ovr(EQY_FUND_CRNCY="EUR"))
per_sec = blp.bdp(
    ["AAPL US Equity", "MSFT US Equity"],
    "CRNCY_ADJ_PX_LAST",
    overrides=ovr(
        {
            "EQY_FUND_CRNCY": "USD",
            "AAPL US Equity": ovr(EQY_FUND_CRNCY="EUR"),
            "MSFT US Equity": ovr(EQY_FUND_CRNCY="JPY"),
        }
    ),
)

# Bulk data
holders = blp.bds("AAPL US Equity", "DVD_Hist_All", DVD_Start_Dt="20240101")

# BQL omits clientContext.appName unless an engine default or per-call value is set.
result = blp.bql("get(px_last) for('AAPL US Equity')")

# Override the engine BQL application context for this request.
# The application name below is synthetic; replace it with one authorized for your environment.
authorized_result = blp.bql(
    "get(px_last) for('AAPL US Equity')",
    app_name="example-authorized-bql-app",
)

# Field lookup
fields = blp.bflds(search_spec="vwap")

# Equity screening and constituents
screen = blp.beqs(screen="MyScreen", asof="2024-01-01")
members = blp.index_members("SPX Index", asof="2024-01-02")

# Workflow helpers
active = blp.active_futures("ESA Index", "2024-01-15")
surface = blp.vol_surface("SPX Index", start_date="2024-01-02", end_date="2024-01-05")
resolved = blp.resolve_isins(["US0378331005", "INVALIDISIN000"])
```

ETF NAV / iNAV workflows live in `xbbg.ext` and resolve Bloomberg's authoritative
`ETF_NAV_TICKER` / `ETF_INAV_TICKER` relationships instead of guessing ticker suffixes:

```python
from xbbg import ext

# Relationship discovery: QQQ US Equity -> QQQNV Index / QXV Index,
# AT1 LN Equity -> null daily NAV / AT1IN Index (independently nullable)
rel = ext.etf_nav_relationships(["QQQ US Equity", "AT1 LN Equity"])

# Daily NAV/iNAV history: mapped Index targets price with PX_LAST; AT1's
# missing daily NAV falls back to the fund's FUND_NET_ASSET_VAL — see the
# nav_source_ticker / nav_source_field columns on every row
hist = ext.etf_nav_history(
    ["QQQ US Equity", "AT1 LN Equity"],
    start_date="2026-06-01",
    end_date="2026-07-01",
)

# Real-time iNAV: validates every mapping first, then subscribes to the
# resolved iNAV topics (here QXV Index) with LAST_PRICE by default
sub = await ext.asubscribe_etf_inav("QQQ US Equity")
async for table in sub:
    print(table.to_pylist())
    break
await sub.unsubscribe()
```

For longer walkthroughs and example output shapes, use the [examples notebook](py-xbbg/examples/xbbg_jupyter_examples.ipynb) or [xbbg.org](https://xbbg.org/).

## Exchange auctions and imbalance

Bloomberg publishes auction imbalance data (buy/sell imbalance, paired shares, indicative and theoretical prices, auction state) and auction results only on the listing where the auction runs. Composite tickers such as `SPY US Equity` return none of it from reference data and only part of it in streams, and a pricing-source suffix on an equity ISIN (`/isin/<ISIN>@UP`) is silently ignored. `xbbg.ext` routes each input to its auction venue and checks Bloomberg's answer before returning data:

```python
from xbbg import ext

# SPY US Equity -> SPY UP Equity, IBM US Equity -> IBM UN Equity,
# US0378331005 (Apple's ISIN) -> AAPL UW Equity
venues = ext.resolve_venues(["SPY US Equity", "IBM US Equity", "US0378331005"])

# Default auction fields for each venue in one validated reference-data request
snap = ext.auction_snapshot(["SPY US Equity", "IBM US Equity"])

# Live: resolves every input first, then subscribes the venues;
# rows and status keep the identifiers you passed
sub = await ext.asubscribe_auction(["SPY US Equity", "IBM US Equity"])
async for table in sub:
    print(table.to_pylist())
    break
await sub.unsubscribe()

# A board you poll instead of iterating: rows=False keeps only current values
board = await ext.asubscribe_auction(["SPY US Equity", "IBM US Equity"], rows=False)
print(board.latest())  # current value of every field, one row per security
await board.unsubscribe()
```

| Input | Auction venue | Checked against |
| --- | --- | --- |
| Equity or ETF composite ticker, or its ISIN | `{TICKER} {EQY_PRIM_EXCH_SHRT} Equity` | venue `EXCH_CODE` |
| Explicit exchange ticker (`SPY UP Equity`) | unchanged | venue `EXCH_CODE` |
| Preferred (`Pfd`) ISIN | `/isin/<ISIN>@<PCS>`, from a packaged exchange table (`NEW YORK` → `SNY2`, Nasdaq → `NASP`, `NYSE AMERICAN` → `AMEX`) or `pcs_overrides={...}` | venue `PRICING_SOURCE` |

Rows that cannot be routed or validated come back as `unresolved`, `unsupported`, or `mismatch` and never carry data. `subscribe_auction`/`stream_auction` raise `BlpValidationError` before subscribing if any input fails or two inputs route to the same venue. Routing lookups are cached for 12 hours per input; the venue is still checked against Bloomberg on every call.

`ext.AUCTION` groups the fields: `IMBALANCE`, `INDICATIVE`, `STATE`, `HALTS`, `RESULTS`, `COMPOSITE`, `QUOTES`; `DEFAULT` is the first five. They use streaming names such as `THEO_PRICE` and `BID`, which reference data also accepts; live subscriptions reject static names such as `PX_THEO` and `PX_BID`.

Reading the data:

- Values are raw and venue-specific. `INDICATIVE_NEAR`/`INDICATIVE_FAR` are NYSE's continuous-book and closing-only clearing prices but Nasdaq's near/far indicative prices; `IMBALANCE_CROSS_TYPE_RT` codes differ by venue.
- `IMBALANCE_BUY` and `IMBALANCE_SELL` are prices, not quantities. `ext.imbalance_side(code)` maps `BUY`/`MBUY`/`RBUY` to `"buy"`, `SELL`/`MSEL`/`RSEL` to `"sell"`, and `NOIM`/`NIMB` to `"none"`.
- `THEO_PRICE` and `VOLUME_THEO` reset to 0 at the start of each auction call, and Bloomberg sends 0 for a price it does not have. Auction subscriptions therefore show 0 in `THEO_PRICE`, `INDICATIVE_NEAR`, `INDICATIVE_FAR`, `IMBALANCE_BUY`, `IMBALANCE_SELL`, and `REFERENCE_PRICE_RT` (`ext.AUCTION.ZERO_PRICE_FIELDS`) as missing in `latest()`; pass `zero_as_null=()` to keep the zeros. Rows always carry the raw values. Imbalance values can persist after an auction ends: use `AUCTION_TYPE_REALTIME`, `IN_AUCTION_RT`, and the `live` column of `latest()` to tell current values from leftovers.
- Time-of-day fields such as `IMBALANCE_TIMESTAMP_RT` are times without a date, in the terminal's local time zone, in snapshots and streams alike. Date fields such as `CLOSING_AUCTION_VOLUME_DATE_RT` are dates.
- Bloomberg keeps no imbalance history; record the stream to keep it (see [Recording a stream](#recording-a-stream)). Auction results do have history on the venue listing, for example `blp.bdh("IBM UN Equity", "OFFICIAL_CLOSE_AUCTION_VOLUME", ...)`; the composite returns none.
- Delayed data does not need a subscription: `blp.delay_status(...)` reports per security whether this session's data is delayed, and `bdp`/`bdh`/`bdib`/`bdtick` accept `on_delayed=` (see [Delayed data](#delayed-data)). Live subscriptions also warn when a stream is delayed (see [Subscriptions](#subscriptions-raw-tick-mode-and-all-fields)).

Node exposes `engine.resolveVenues()`, `engine.auctionSnapshot()`, `engine.subscribeAuction()`, `engine.streamAuction()`, `AuctionFields`, and `imbalanceSide()`. The LangGraph adapters add `xbbg_resolve_venues` and `xbbg_auction_snapshot`, and the MCP server adds `resolve_venues` and `auction_snapshot`.

## Python LangChain and LangGraph

[`py-xbbg-langgraph`](py-xbbg-langgraph/) provides the separate `xbbg-langgraph` distribution, imported as `xbbg_langgraph`. It exposes the same 35 tool names as the JavaScript adapter: 24 Bloomberg request/recipe/snapshot tools and 11 extension helpers, including inline Vega-Lite chart specifications. Python arguments and factory names use `snake_case`.

Install from this checkout (the new distribution has not yet been published):

```bash
pip install ./py-xbbg-langgraph
# For the agent example below:
pip install langchain langchain-openai
# For custom graphs without the LangChain agent package:
pip install "langgraph>=1.2,<2"
```

Requires Python 3.11–3.14, xbbg 1.6.0+, and `langchain-core` 1.4+. Graph workflows target LangGraph 1.2+. The adapter installs `langchain-core` and Pydantic; ordinary xbbg installs remain unchanged. Live requests still require authorized Bloomberg connectivity and SDK runtime libraries. Tool creation and schema inspection do not import the native extension or start a session.

```python
from langchain.agents import create_agent
from langchain_openai import ChatOpenAI
from xbbg_langgraph import BLOOMBERG_TOOL_INSTRUCTIONS, create_all_bloomberg_tools

tools = create_all_bloomberg_tools(
    max_securities=10,
    max_fields=25,
    max_rows=500,          # Application artifact
    max_content_rows=50,  # Model-facing preview
    disabled_tools={"xbbg_bql", "xbbg_bsrch"},
)

# Configure OPENAI_API_KEY and Bloomberg access before invoking.
agent = create_agent(
    model=ChatOpenAI(model="gpt-4.1"),
    tools=tools,
    system_prompt=BLOOMBERG_TOOL_INSTRUCTIONS,
)
result = agent.invoke({
    "messages": [{"role": "user", "cont
↑