Skip to main content

LangChain helpers for acty payloads

Project description

acty-langchain

acty-langchain provides LangChain-specific helpers for the Acty ecosystem: message serialization, repair hints for malformed JSON outputs, and runnable executor utilities that integrate with acty.

Install

Runtime helpers only:

pip install acty-langchain

If you want to run LangChain runnables through ActyEngine:

pip install acty acty-langchain

For local development:

pip install -e .[dev]

Message Payload Helpers

from langchain_core.messages import HumanMessage
from acty_langchain import messages_to_acty_payload, messages_from_acty_payload

payload = messages_to_acty_payload(
    [HumanMessage(content="hello")],
    payload={"exec_id": "chat"},
)

roundtrip = messages_from_acty_payload(payload)

These helpers convert LangChain messages into JSON-safe payload structures that can be stored, retried, or cached inside Acty workflows.

Runnable Payload Shape

The runnable executor accepts payloads shaped like:

{
    "runnable": my_chain,
    "input": {"question": "hi"},
}

Resolver-based execution can also use:

{
    "exec_id": "qa",
    "input": {"question": "hi"},
}

Runnable Execution

from acty import ActyEngine, EngineConfig
from acty_langchain import LangChainRunnableExecutor, runnable_retry_factory

engine = ActyEngine(
    executor=LangChainRunnableExecutor(),
    config=EngineConfig(
        attempt_retry_policy=runnable_retry_factory(),
    ),
)

JSON Repair Helpers

acty-langchain also includes repair utilities for invalid JSON responses:

from acty_langchain import DefaultPromptedJsonRepairer

repairer = DefaultPromptedJsonRepairer(
    system_instruction="Return only valid JSON.",
    repair_request="Please repair the assistant output above.",
)

Development

  • tests live under tests/
  • the package depends on acty-core at runtime
  • tests also install acty so runnable executor integration can be exercised

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

acty_langchain-0.1.0.tar.gz (14.7 kB view details)

Uploaded Source

Built Distribution

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

acty_langchain-0.1.0-py3-none-any.whl (12.4 kB view details)

Uploaded Python 3

File details

Details for the file acty_langchain-0.1.0.tar.gz.

File metadata

  • Download URL: acty_langchain-0.1.0.tar.gz
  • Upload date:
  • Size: 14.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.7

File hashes

Hashes for acty_langchain-0.1.0.tar.gz
Algorithm Hash digest
SHA256 ec18fee3fddc2482e3c59ea940e0f725074fe8be525128dafe936d33e1337a12
MD5 8875b5da5fa37a4ddfb0609d20b49958
BLAKE2b-256 207f7069bccb6ec81e5e65e74409c2d81a2914134b80b8b265b11b8583f4dd1d

See more details on using hashes here.

File details

Details for the file acty_langchain-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: acty_langchain-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 12.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.7

File hashes

Hashes for acty_langchain-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 11690240faea35816108b31c4de547fc00fee2ad840c3ed54d94e751e876cda0
MD5 9e81a5a35e8174309447f27c025b7a50
BLAKE2b-256 7ee767992863aa6bff6c2bb9a7727797a76272a687d5987a1d3a5dc7a96a4192

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