Pre-release
This release is a pre-release and may not be stable for production use.
LibreFang Python SDK
Official Python client and SDK for the LibreFang Agent OS.
Installation
pip install librefang
Two Packages
This package provides two different interfaces:
1. REST API Client (librefang.client)
Control LibreFang remotely via its REST API.
from librefang import Client
client = Client("http://localhost:4545")
# Create an agent
agent = client.agents.create(template="assistant")
print(f"Agent created: {agent['id']}")
# Send a message
reply = client.agents.message(agent["id"], "Hello!")
print(reply)
# Stream a response
for event in client.agents.stream(agent["id"], "Tell me a story"):
if event.get("type") == "text_delta":
print(event["delta"], end="", flush=True)
2. Agent SDK (librefang.sdk)
Write Python agents that run inside LibreFang.
from librefang import Agent
agent = Agent()
@agent.on_message
def handle(message: str, context: dict) -> str:
return f"You said: {message}"
agent.run()
Or use the simple input/output functions:
from librefang import read_input, respond
data = read_input()
result = f"Echo: {data['message']}"
respond(result)
Examples
See the examples/ directory for more examples:
Client Examples
client_basic.py- Basic REST API usageclient_streaming.py- Streaming responses
SDK Examples
echo_agent.py- Simple echo agent
Requirements
- Python 3.8+
License
MIT
Metadata
Release files for librefang-sdk 2026.3.2123rc1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| librefang_sdk-2026.3.2123rc1.tar.gz | 7.3 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| librefang_sdk-2026.3.2123rc1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 15.1 kB
Release files / librefang_sdk-2026.3.2123rc1.tar.gz
| Download URL | librefang_sdk-2026.3.2123rc1.tar.gz |
|---|---|
| Size | 7.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
5ef0e1ee7355a5755d79c3cfbc8fd6c863bdc804d457d5a428e0ee1c80f10441
|
|
BLAKE2b-256 checksum How to use checksums |
d27c1dcee91bbb5cbdbfd1ac95a562b4ae596fca9a056d9b4d3ddd6d62a785c0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Release files / librefang_sdk-2026.3.2123rc1-py3-none-any.whl
| Download URL | librefang_sdk-2026.3.2123rc1-py3-none-any.whl |
|---|---|
| Size | 7.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
b9eb145d6e08523688fcfe6ce82a7d9d9d92e98c0ed7a48700fed7416891af99
|
|
BLAKE2b-256 checksum How to use checksums |
887a978fbeea96ce266a42ba097f1b49a3ab1d83b6eef70afaa28af8ba83441b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|