Skip to main content

PostBridge core — shared tool catalog, HTTP dispatcher, and Pydantic schema generator. Depended on by postbridge-crewai, postbridge-langchain, and postbridge-llamaindex.

Project description

postbridge-core

Shared tool catalog, HTTP dispatcher, and Pydantic schema generator for PostBridge. Depended on by the framework-specific wrappers — you usually won't install this directly.

Install

pip install postbridge-core

Already installed as a dependency if you picked up postbridge-crewai, postbridge-langchain, or postbridge-llamaindex.

What's inside

Module Purpose
tools.json Canonical 8-tool catalog — the single source of truth
loader.py Load, filter, lookup catalog entries
dispatcher.py execute(tool_name, args) → live HTTP call to api.postbridge.ai
pydantic_gen.py JSON Schema → Pydantic model generator

Public API

from postbridge_core import (
    get_tools_raw,      # list[dict]  — raw catalog entries
    get_tool,           # dict        — single entry by name
    api_base_url,       # str         — https://api.postbridge.ai
    execute,            # callable    — run a tool against the live API
    build_args_model,   # callable    — JSON Schema → Pydantic model
    load_catalog,       # dict        — full catalog
)

Dispatching a tool call

from postbridge_core import execute
import os

os.environ["POSTBRIDGE_API_KEY"] = "pb_live_..."

# Path-param tool
status = execute("track_letter", {"letter_id": "abc-123"})

# Body-only tool
quote = execute("quote_letter", {
    "to_name": "Marie Dupont",
    "to_line1": "15 Rue de Rivoli",
    "to_city": "Paris",
    "to_postal_code": "75001",
    "to_country": "FR",
    "service": "fr_lettre_verte",
})

Building a Pydantic model for a tool

from postbridge_core import get_tool, build_args_model

send = get_tool("send_letter")
SendLetterArgs = build_args_model("send_letter", send["parameters"])

# SendLetterArgs is a full Pydantic v2 BaseModel:
args = SendLetterArgs(to_name="...", ...)

For users of the framework wrappers

You probably don't need this package directly. See instead:

  • postbridge-crewaiCrewAI tools
  • postbridge-langchainLangChain and LangGraph tools
  • postbridge-llamaindexLlamaIndex tools

Each of those uses postbridge-core under the hood — same catalog, same dispatcher, same validation.

Tool catalog (as of v0.1.0)

Tool Method Path
list_services GET /api/services/{country}
quote_letter POST /api/quote
send_letter POST /api/send
track_letter GET /api/track/{letter_id}
get_proof GET /api/proof/{letter_id}
get_balance GET /api/balance
negotiate_pricing POST /api/anp/offer
accept_offer POST /api/anp/accept

Full developer reference: postbridge.ai/developers.html.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

postbridge_core-0.1.0.tar.gz (9.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

postbridge_core-0.1.0-py3-none-any.whl (9.6 kB view details)

Uploaded Python 3

File details

Details for the file postbridge_core-0.1.0.tar.gz.

File metadata

  • Download URL: postbridge_core-0.1.0.tar.gz
  • Upload date:
  • Size: 9.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.9

File hashes

Hashes for postbridge_core-0.1.0.tar.gz
Algorithm Hash digest
SHA256 eea3ce86cbd2176d8250b98c0d0d270d6430c3398c8e0ffd86abfff6939162f4
MD5 c57883f64e04e7b8f736bb8c3b9a0d3f
BLAKE2b-256 d5bfda785d82b588c3b10091e827b87aa3aa6b9745cb96721f49c87055252b99

See more details on using hashes here.

File details

Details for the file postbridge_core-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for postbridge_core-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 5f4e278210785184143d5a691a0099638b3097dd0c724786153734def76d68d9
MD5 6ffd0a9a4e2262d43f43486802d7f563
BLAKE2b-256 5499995e6cf635a34a34a245975f365613a4dd19ac506795fc4210fb3ad07e70

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page