A flexible, multi-backend, customizable AI agent framework, entirely based on Rust.
Project description
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 |
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
No source distribution files available for this release.See tutorial on generating distribution archives.
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file ambi_python-0.1.1-cp312-cp312-win_amd64.whl.
File metadata
- Download URL: ambi_python-0.1.1-cp312-cp312-win_amd64.whl
- Upload date:
- Size: 4.2 MB
- Tags: CPython 3.12, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f0508ffd0fa8f171d849c397071650c64a178f6f67c72c501e4a57ca901a21d2
|
|
| MD5 |
62d5a76888215b99344dec9b29c5fbcb
|
|
| BLAKE2b-256 |
8154506a7d9469efdc1c30346f7755ec0a8a7a193626a6e54ee80fb232e47602
|