Skip to main content
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 usage
  • client_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.2314rc1

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

Source distribution (sdist)

Source distribution for librefang-sdk 2026.3.2314rc1
File Size Uploaded
librefang_sdk-2026.3.2314rc1.tar.gz 7.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for librefang-sdk 2026.3.2314rc1
File Interpreter ABI Platform
librefang_sdk-2026.3.2314rc1-py3-none-any.whl Python 3 none any Details

Total release size: 15.1 kB

Release files / librefang_sdk-2026.3.2314rc1.tar.gz

Download URL librefang_sdk-2026.3.2314rc1.tar.gz
Size 7.4 kB
Tags Source
SHA-256 checksum
How to use checksums
e079e54096dd172055746cf63531490058c55408f476f83b80f249fd5d3692f2
BLAKE2b-256 checksum
How to use checksums
cd1abe759b96048067a7821a351a4a37c4c7cd5fda4889db014e3d573709d329
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.2314rc1-py3-none-any.whl

Download URL librefang_sdk-2026.3.2314rc1-py3-none-any.whl
Size 7.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
49c45ebd532e3cc819957c28d4ddee7a1e9832c972969d6a2e900ce4805e2e96
BLAKE2b-256 checksum
How to use checksums
8d170af458d92e2dc25826c5ed3f81a3582ca74384d6f8e4e0a6dc6a55282375
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.7

Release history Release notifications | RSS feed

This release

2026.3.2314rc1 This release

2 release files

0.7.0

2 release files

0.6.8

2 release files

0.6.6

2 release files

0.6.5

2 release files

0.6.4

2 release files

0.6.3

2 release files

0.6.2

2 release files

0.6.1

2 release files

0.6.0

2 release files

0.5.7

2 release files

0.5.6

2 release files

0.5.5

2 release files

0.5.4

2 release files

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