Python Bindings for Ambi
A Python native extension for the Ambi AI Agent framework.
Installation
From PyPI (recommended)
pip install ambi-python
Build from source
Requires maturin and a Rust toolchain.
# Install maturin
pip install maturin
# Build and install locally
cd bindings/python
maturin develop --release
Then import as:
from ambi import Agent, AgentState, Pipeline, LLMEngineConfig
Build & Publish
cd bindings/python
# Build wheel
maturin build --release
# Publish to PyPI
maturin publish --username __token__ --password pypi-xxxxx
The built .whl files will be in target/wheels/.
Examples
Run any example from the bindings/python directory:
cd bindings/python
# Basic cloud-based chat
OPENAI_API_KEY=sk-... python examples/chat-cloud.py
# Streaming output
OPENAI_API_KEY=sk-... python examples/chat-stream.py
# Tool calling
OPENAI_API_KEY=sk-... python examples/custom-tool.py
# Custom chat template
OPENAI_API_KEY=sk-... python examples/custom-template.py
# Custom Python LLM engine
python examples/custom-engine.py
# Memory eviction
OPENAI_API_KEY=sk-... python examples/memory-eviction.py
API Reference
| Python | JS equivalent | Description |
|---|---|---|
Agent.make(config) |
Agent.make(config) |
Create an async agent |
agent.preamble("...") |
agent.preamble("...") |
Set system prompt |
agent.template("chatml") |
agent.template(Chatml) |
Set template type |
agent.custom_template(...) |
agent.customTemplate(...) |
Custom template |
agent.add_tool(...) |
agent.tool(...) |
Register a tool |
agent.with_standard_formatting() |
agent.withStandardFormatting() |
Enable standard formatting |
agent.with_eviction_strategy(...) |
agent.withEvictionStrategy(...) |
Set eviction strategy |
agent.count_tokens(...) |
agent.countTokens(...) |
Count tokens |
AgentState("id") |
new AgentState("id") |
Create session state |
LLMEngineConfig.openai(...) |
LLMEngineConfig.openai(...) |
OpenAI engine |
LLMEngineConfig.custom(...) |
LLMEngineConfig.custom(...) |
Custom engine |
Pipeline.chat_runner(n) |
Pipeline.chatRunner(n) |
Chat runner |
Pipeline.custom(...) |
Pipeline.custom(...) |
Custom pipeline |
runner.chat(...) |
runner.chat(...) |
Sync chat |
runner.chat_stream(...) |
runner.chatStream(...) |
Streaming chat |
resolve_request(id, result) |
resolveRequest(id, result) |
Resolve async callback |
resolve_pipeline_request(...) |
resolvePipelineRequest(...) |
Resolve pipeline callback |
Metadata
Release files for ambi-python 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| ambi_python-0.1.1-cp312-cp312-win_amd64.whl | CPython 3.12 | CPython 3.12 | Windows x86-64 | Details for ambi_python-0.1.1-cp312-cp312-win_amd64.whl |
Release files / ambi_python-0.1.1-cp312-cp312-win_amd64.whl
| Download URL | ambi_python-0.1.1-cp312-cp312-win_amd64.whl |
|---|---|
| Size | 4.2 MB |
| Tags | CPython 3.12 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
f0508ffd0fa8f171d849c397071650c64a178f6f67c72c501e4a57ca901a21d2
|
|
BLAKE2b-256 checksum How to use checksums |
8154506a7d9469efdc1c30346f7755ec0a8a7a193626a6e54ee80fb232e47602
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.0
|
Security for ambi-python 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.
No provenance found
None of the files in this release were uploaded with provenance metadata.
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.