Affected Component
statewave-multi-agent-shared-context — core/statewave_client.py, statewave_agents/context.py, statewave_agents/agent.py
Bug Description
top_k is threaded through three layers of the public demo API and then dropped on the floor.
statewave_agents/agent.py:34 — def run(self, task: str, top_k: int = 5)
statewave_agents/context.py:102 — def before_acting(self, caller_id, task, top_k: int = 5), passes it on at line 108
core/statewave_client.py:54 — def get_context(..., top_k: int = 5) accepts it, and the self._sdk.get_context(...) call at lines 57-61 never references it
So every caller that sets top_k believes it is controlling retrieval breadth, and nothing happens.
It isn't a one-line forward, either — the SDK has no such parameter:
>>> import statewave, inspect
>>> inspect.signature(statewave.StatewaveClient.get_context)
(self, subject_id: str, task: str, *, max_tokens: int | None = None, session_id: str | None = None,
emit_receipt: bool | None = None, query_id: str | None = None, task_id: str | None = None,
caller_id: str | None = None, caller_type: str | None = None) -> ContextBundle
Retrieval breadth is bounded by max_tokens, not a top-k count.
Expected Behavior
Either drop top_k from all three signatures, or rename it to max_tokens and forward it, so the knob the demo exposes is the knob the server actually has.
Steps to Reproduce
Call agent.run(task, top_k=1) and agent.run(task, top_k=50) against a subject with many memories and compare the bundles — they are identical.
Environment
main as of 2026-09-07; statewave Python SDK as installed from PyPI.
Severity
Low — no data loss, but it is a public parameter of a reference implementation that does nothing, and people copy reference implementations.
Affected Component
statewave-multi-agent-shared-context—core/statewave_client.py,statewave_agents/context.py,statewave_agents/agent.pyBug Description
top_kis threaded through three layers of the public demo API and then dropped on the floor.statewave_agents/agent.py:34—def run(self, task: str, top_k: int = 5)statewave_agents/context.py:102—def before_acting(self, caller_id, task, top_k: int = 5), passes it on at line 108core/statewave_client.py:54—def get_context(..., top_k: int = 5)accepts it, and theself._sdk.get_context(...)call at lines 57-61 never references itSo every caller that sets
top_kbelieves it is controlling retrieval breadth, and nothing happens.It isn't a one-line forward, either — the SDK has no such parameter:
Retrieval breadth is bounded by
max_tokens, not a top-k count.Expected Behavior
Either drop
top_kfrom all three signatures, or rename it tomax_tokensand forward it, so the knob the demo exposes is the knob the server actually has.Steps to Reproduce
Call
agent.run(task, top_k=1)andagent.run(task, top_k=50)against a subject with many memories and compare the bundles — they are identical.Environment
mainas of 2026-09-07;statewavePython SDK as installed from PyPI.Severity
Low — no data loss, but it is a public parameter of a reference implementation that does nothing, and people copy reference implementations.