[P1] Expand rlm_chain with messages, structured output, retries, streaming, and middleware #13

Closed
opened 2026-08-12 01:19:13 +00:00 by lost-rob0t · 0 comments
lost-rob0t commented 2026-08-12 01:19:13 +00:00 (Migrated from github.com)

Goal

Build the reusable Prolog-native model/tool abstraction layer needed by agents and RLMs without cloning LangChain's Python object model.

Scope

  • normalize message roles/content and multimodal metadata where feasible;
  • expose provider capabilities and model routing hooks;
  • add prompt templates/binding;
  • add structured-output schemas and validation;
  • add retry/backoff policy;
  • add streaming event protocol;
  • add middleware/hooks around request, model response, tool call, and completion;
  • expose tracing and usage/cost metadata consistently;
  • keep the API idiomatic Prolog terms/predicates.

Acceptance criteria

  • one provider request can stream normalized events;
  • structured output is validated before downstream use;
  • retry policy is bounded and observable in trace events;
  • middleware can inspect/transform a request without provider-specific branching;
  • agent/RLM code depends on canonical rlm_chain interfaces rather than direct provider details.

Dependencies

Research

See RLM-RESEARCH-007-langchain-langgraph-port.org.

## Goal Build the reusable Prolog-native model/tool abstraction layer needed by agents and RLMs without cloning LangChain's Python object model. ## Scope - normalize message roles/content and multimodal metadata where feasible; - expose provider capabilities and model routing hooks; - add prompt templates/binding; - add structured-output schemas and validation; - add retry/backoff policy; - add streaming event protocol; - add middleware/hooks around request, model response, tool call, and completion; - expose tracing and usage/cost metadata consistently; - keep the API idiomatic Prolog terms/predicates. ## Acceptance criteria - one provider request can stream normalized events; - structured output is validated before downstream use; - retry policy is bounded and observable in trace events; - middleware can inspect/transform a request without provider-specific branching; - agent/RLM code depends on canonical `rlm_chain` interfaces rather than direct provider details. ## Dependencies - #5 - #10 - parent #3 ## Research See `RLM-RESEARCH-007-langchain-langgraph-port.org`.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
nsaspy/prolog-rlm#13
No description provided.