Skip to main content

langchain-sovereigneg

LangChain and LangGraph integration for SovereignEG, the Egyptian sovereign AI platform: 230+ local and international models behind one OpenAI-compatible API, billed in Egyptian pounds.

تكامل رسمي بين LangChain و LangGraph ومنصة SovereignEG — منصة الذكاء الاصطناعي السيادية المصرية. موديلات محلية وعالمية من خلال API واحد، والدفع بالجنيه المصري.

Install

pip install -U langchain-sovereigneg
export SOVEREIGNEG_API_KEY="your-api-key"   # https://sovereigneg.com/dashboard/keys

Chat models

from langchain_sovereigneg import ChatSovereignEG

llm = ChatSovereignEG(model="gpt-oss-20b", temperature=0)
print(llm.invoke("اشرح يعني إيه LangGraph في جملتين").content)

Use any chat model ID from the SovereignEG catalog. Streaming, async, tool calling and structured output work the same as with ChatOpenAI:

for chunk in llm.stream("Write a haiku about the Nile"):
    print(chunk.text, end="")

Embeddings

from langchain_sovereigneg import SovereignEGEmbeddings

embeddings = SovereignEGEmbeddings(model="SovereignEG/embeddinggemma-300m")
vector = embeddings.embed_query("مرحبا بالعالم")

LangGraph agent

pip install -U langchain langchain-sovereigneg
from langchain_core.tools import tool
from langchain.agents import create_agent  # runs on LangGraph
from langchain_sovereigneg import ChatSovereignEG


@tool
def egp_to_usd(amount: float, rate: float) -> float:
    """Convert Egyptian pounds to US dollars at the given rate."""
    return round(amount / rate, 2)


agent = create_agent(ChatSovereignEG(model="gpt-oss-20b"), tools=[egp_to_usd])
result = agent.invoke(
    {
        "messages": [
            {"role": "user", "content": "How much is 5000 EGP at 48.5 per dollar?"}
        ]
    }
)
print(result["messages"][-1].content)

For agents, pick a catalog model that supports function calling.

Configuration

Argument Environment variable Default
api_key SOVEREIGNEG_API_KEY none (required on the default URL)
base_url SOVEREIGNEG_API_BASE https://backend.sovereigneg.com/v1

Set base_url to point at a dedicated or private SovereignEG deployment.

Other frameworks

SovereignEG works with any OpenAI-compatible client. Guides for LlamaIndex, CrewAI, Open WebUI, OpenCode and more are at sovereigneg.com/docs/integrations.

Development

uv sync --all-groups
uv run pytest tests/unit_tests                              # offline
SOVEREIGNEG_API_KEY=... uv run pytest tests/integration_tests # live API

License

MIT

Metadata

Release files for langchain-sovereigneg 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for langchain-sovereigneg 0.1.1
File Size Uploaded Provenance Actions
langchain_sovereigneg-0.1.1.tar.gz 7.5 kB With provenance Details for langchain_sovereigneg-0.1.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for langchain-sovereigneg 0.1.1
File Interpreter ABI Platform Actions
langchain_sovereigneg-0.1.1-py3-none-any.whl Python 3 none any Details for langchain_sovereigneg-0.1.1-py3-none-any.whl

Total release size: 15.3 kB

Release files / langchain_sovereigneg-0.1.1.tar.gz

Download URL langchain_sovereigneg-0.1.1.tar.gz
Size 7.5 kB
Tags Source
SHA-256 checksum
How to use checksums
66c73ca4569f38d7944d70530a563478089e65762bfdbed49b5fab0c9df017a3
BLAKE2b-256 checksum
How to use checksums
787558ea7ace352b64a4cf39787bbbf92bb825810a0d5695d72c10ee0b7fbba9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 18, 2026.

Transparency log

Release files / langchain_sovereigneg-0.1.1-py3-none-any.whl

Download URL langchain_sovereigneg-0.1.1-py3-none-any.whl
Size 7.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
929c3dfd11dbe535efafc87a1f8dd3806863153042cf3e198c8d66b7ad516351
BLAKE2b-256 checksum
How to use checksums
f4c6c51546b2dde34377b956d7ff41c5928aef93ca7e9e4d47ab1cc14a13a68a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 18, 2026.

Transparency log

Security for langchain-sovereigneg 0.1.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for langchain_sovereigneg-0.1.1.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 18, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page