LibreFang Python SDK
Official Python client and SDK for the LibreFang Agent OS.
Installation
pip install librefang-sdk
Public APIs
This package provides two different interfaces:
1. REST API Client
Control LibreFang remotely via its REST API.
from librefang import Client
client = Client("http://localhost:4545")
# Create an agent
agent = client.agents.spawn_agent(template="assistant")
agent_id = agent["agent_id"]
print(f"Agent created: {agent_id}")
# Send a message
reply = client.agents.send_message(agent_id, message="Hello!")
print(reply)
# Stream a response
for event in client.agents.send_message_stream(agent_id, message="Tell me a story"):
if event.get("content"):
print(event["content"], end="", flush=True)
2. Agent 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.10+
License
MIT
Metadata
Release files for librefang-sdk 2026.8.30
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.8.30.tar.gz | 551.7 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| librefang_sdk-2026.8.30-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 909.7 kB
Release files / librefang_sdk-2026.8.30.tar.gz
| Download URL | librefang_sdk-2026.8.30.tar.gz |
|---|---|
| Size | 551.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d2d09d1cfd76cd813ace40544d3ede941e66a0b817eb5ecff682c47f971f5311
|
|
BLAKE2b-256 checksum How to use checksums |
bb931f4ab37c53822629f46dbe16ce5361cf1ca287ac5a7a9b7e66cc89c2f965
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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 Aug 30, 2026.
Transparency logRelease files / librefang_sdk-2026.8.30-py3-none-any.whl
| Download URL | librefang_sdk-2026.8.30-py3-none-any.whl |
|---|---|
| Size | 358.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
e32024cba5d28cba196404f0c1e12cc21bcc00a3b0c6972961e6f444e4db0f13
|
|
BLAKE2b-256 checksum How to use checksums |
fc9a31d30b8ff13e6d05d9be889bf55a98cc822504f2110dea9414529f47e8a6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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 Aug 30, 2026.
Transparency log