Skip to content

feat(gds-games): parameterizable reactive_decision_agent() — include_outcome and include_feedback flags #16

@rororowyourboat

Description

@rororowyourboat

Summary

reactive_decision_agent() in ogs/dsl/library.py hard-codes a full 5-game loop (Context Builder → History → Policy → Reactive Decision → Outcome) with 3 contravariant feedback flows. This makes it unusable for multi-agent patterns where:

  • The Outcome game lives in a shared Decision Router (not per-agent)
  • Feedback flows span across agents and must be wired at the pattern level, not inside each agent

As a result, every multi-agent use case must re-implement the 4-game open-loop chain from scratch as a client-side factory — duplicating ~85 lines of composition logic that belongs upstream.

Proposed API

from typing import Literal, overload

@overload
def reactive_decision_agent(
    name: str = "Reactive Decision Agent",
    include_outcome: Literal[True] = True,
    include_feedback: Literal[True] = True,
) -> FeedbackLoop: ...

@overload
def reactive_decision_agent(
    name: str = "Reactive Decision Agent",
    include_outcome: bool = ...,
    include_feedback: bool = ...,
) -> FeedbackLoop | SequentialComposition: ...

def reactive_decision_agent(
    name: str = "Reactive Decision Agent",
    include_outcome: bool = True,
    include_feedback: bool = True,
) -> FeedbackLoop | SequentialComposition:
    ...

Behaviour matrix

include_outcome include_feedback Returns Games
True (default) True (default) FeedbackLoop CB → Hist → Pol → RD → Out + 3 feedback flows (current behaviour, unchanged)
False True FeedbackLoop CB → Hist → Pol → RD + empty or partial feedback
True False SequentialComposition CB → Hist → Pol → RD → Out (no feedback wrap)
False False SequentialComposition CB → Hist → Pol → RD (open loop, no Outcome, no feedback)

The False / False case is the open-loop agent chain needed by multi-agent patterns.

Files affected

  • packages/gds-games/ogs/dsl/library.py — modify reactive_decision_agent()
  • packages/gds-games/ogs/dsl/__init__.py — no export changes needed (already exported)

Motivation

Multi-agent patterns (bilateral negotiation, N-party agreement) all follow the structure:

(open_loop_agent("Agent 1") | open_loop_agent("Agent 2")) >> router

where router contains the Outcome game and feedback is wired at the pattern level for all agents simultaneously. With this change, open_loop_agent(prefix) becomes reactive_decision_agent(name=prefix, include_outcome=False, include_feedback=False) — no client-side reimplementation needed.

Effort estimate

Low — additive change to an existing function, backward-compatible (default behaviour unchanged).

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions