Skip to content

Latest commit

 

History

History
79 lines (66 loc) · 2.74 KB

File metadata and controls

79 lines (66 loc) · 2.74 KB

BLPAPI-A2A

An A2A agent providing financial data from Bloomberg blpapi.

Leverages BLPAPI-MCP as the data provider.

Note: A Bloomberg Terminal must be running (BBComm must be accessible) for data access.

Installation

Using UV

uv add git+https://github.com/djsamseng/blpapi-a2a

Run the A2A Agent without a model

uv run blpapi-a2a

Examples

Run with ollama

OLLAMA_CONTEXT_LENGTH=8192 ollama serve
  • Pull down the model llama3.2:1b
    • or replace with a model that fits on your GPU that has the tools tag
    • Consider qwq for an RTX 3090 24GB GPU
ollama pull llama3.2:1b
  • Run the agent. Replace host and port with the value of OLLAMA_HOST printed from running ollama serve from above
uv run blpapi-a2a --ollama-host http://127.0.0.1:11434 --ollama-model llama3.2:1b
uv run blpapi-a2a --ollama-host http://127.0.0.1:11434 --ollama-model qwq
  • Run the test client to interact with the A2A server
uv run google-a2a-cli --agent http://127.0.0.1:8000
  • With qwq as the LLM you will see the agent call blpapi-mcp bdp correctly
=========  starting a new task ========

What do you want to send to the agent? (:q or quit to exit): What is the price of IBM?

{"role":"agent","parts":[{"type":"text","text":"<think>\nOkay, the user asked for the price of IBM, and I tried using the bdp function. But there was an error: ClosedResourceError() ... typically indicates a disconnected Bloomberg session or invalid API context. Please ensure:\n\n1. Bloomberg Terminal/desktop is running\n2. Python/blpapi session is active\n3. Proper Bloomberg API authentication"}]}
  • Note: The test client may time out while the ollama server loads a large model. Rerun the test client after the ollama server finishes loading the model weights into memory.

Development

Requirements

  1. Install UV
curl -LsSf https://astral.sh/uv/install.sh | sh
  1. Clone this repository
git clone https://github.com/djsamseng/blpapi-a2a
  1. Setup the venv
uv venv
source .venv/bin/activate
  1. Run the A2A agent
uv run blpapi-a2a

Trademark Note

This project not affiliated with Bloomberg Finance L.P. The use of the name Bloomberg is only descriptive as towards what this package is used with.