Skip to main content

Build LLM workflows like normal Python while keeping a full audit trail by default.

Project description

Republic

Release Build status codecov Commit activity License

Build LLM workflows like normal Python while keeping a full audit trail by default.

Visit https://getrepublic.org for concepts, guides, and API reference.

Republic is a tape-first LLM client: messages, tool calls, tool results, errors, and usage are all recorded as structured data. You can make the workflow explicit first, then decide where intelligence should be added.

Quick Start

pip install republic
from __future__ import annotations

import os

from republic import LLM

api_key = os.getenv("LLM_API_KEY")
if not api_key:
    raise RuntimeError("Set LLM_API_KEY before running this example.")

llm = LLM(model="openrouter:openrouter/free", api_key=api_key)
result = llm.chat("Describe Republic in one sentence.", max_tokens=48)

if result.error:
    print(result.error.kind, result.error.message)
else:
    print(result.value)

Why It Feels Natural

  • Plain Python: The main flow is regular functions and branches, no extra DSL.
  • Structured Result: Core interfaces return StructuredOutput, with stable ErrorKind values.
  • Tools without magic: Supports both automatic and manual tool execution with clear debugging and auditing.
  • Tape-first memory: Use anchor/handoff to bound context windows and replay full evidence.
  • Event streaming: Subscribe to text deltas, tool calls, tool results, usage, and final state.

Development

make check
make test

See CONTRIBUTING.md for local setup, testing, and release guidance.

License

Apache 2.0


This project is derived from lightning-ai/litai and inspired by pydantic/pydantic-ai; we hope you like them too.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

republic-0.5.3.tar.gz (100.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

republic-0.5.3-py3-none-any.whl (39.9 kB view details)

Uploaded Python 3

File details

Details for the file republic-0.5.3.tar.gz.

File metadata

  • Download URL: republic-0.5.3.tar.gz
  • Upload date:
  • Size: 100.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.21 {"installer":{"name":"uv","version":"0.9.21","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for republic-0.5.3.tar.gz
Algorithm Hash digest
SHA256 31b43d41026a3d877c894c8bf06e3295929401a991f606d3d17ce1a63562c688
MD5 e047ef1cdab15d974ba8e8a0f8f70f2d
BLAKE2b-256 6a4521c3cd167dad5e3d2434c9454a298d85b49fe0f4740f21f35ee50f4da89d

See more details on using hashes here.

File details

Details for the file republic-0.5.3-py3-none-any.whl.

File metadata

  • Download URL: republic-0.5.3-py3-none-any.whl
  • Upload date:
  • Size: 39.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.21 {"installer":{"name":"uv","version":"0.9.21","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for republic-0.5.3-py3-none-any.whl
Algorithm Hash digest
SHA256 82bb6654fcfbb22ebd9267b23bc22a7d5fe7dc46fe9fe1a56e46e26f5ce8bcf9
MD5 0a60310e17d6b8e35d401388b62b46c5
BLAKE2b-256 06eb77769fbc7877b38ed98d17ec5ae174e3f0b0bdafa2f5be4ef054d49efe11

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page