Skip to main content

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 usage
  • client_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.10.16

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.10.16
File Size Uploaded
librefang_sdk-2026.10.16.tar.gz 564.5 kB Details

Built distribution (wheel)

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

Total release size: 929.2 kB

Release files / librefang_sdk-2026.10.16.tar.gz

Download URL librefang_sdk-2026.10.16.tar.gz
Size 564.5 kB
Tags Source
SHA-256 checksum
How to use checksums
11f3b7b81582bbb92cd56fc3c7608277e07309316638450aa45d75ed8583bc16
BLAKE2b-256 checksum
How to use checksums
85cb6c0bb0bb5d76c0ea8b2586a9ff146cdbead941c08fb1b5863d5c1ce96a92
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 Oct 16, 2026.

Transparency log

Release files / librefang_sdk-2026.10.16-py3-none-any.whl

Download URL librefang_sdk-2026.10.16-py3-none-any.whl
Size 364.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
bea8b6bf43f7cb94de3da3f969398daa9d4d7228f950b24e516300b0b015f8c9
BLAKE2b-256 checksum
How to use checksums
b9d729205f76f7dabc2b681295c4ec1929f16aff33bddf6545dacc76df0d1779
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 Oct 16, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

2026.10.16 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