react-agent-harness 0.8.0__tar.gz → 0.9.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {react_agent_harness-0.8.0/react_agent_harness.egg-info → react_agent_harness-0.9.0}/PKG-INFO +1 -1
- {react_agent_harness-0.8.0 → react_agent_harness-0.9.0}/README.md +113 -18
- {react_agent_harness-0.8.0 → react_agent_harness-0.9.0}/harness/persistent.py +608 -63
- react_agent_harness-0.9.0/harness/persistent_completion.py +125 -0
- react_agent_harness-0.9.0/harness/persistent_controls.py +525 -0
- {react_agent_harness-0.8.0 → react_agent_harness-0.9.0}/pyproject.toml +1 -1
- {react_agent_harness-0.8.0 → react_agent_harness-0.9.0/react_agent_harness.egg-info}/PKG-INFO +1 -1
- {react_agent_harness-0.8.0 → react_agent_harness-0.9.0}/react_agent_harness.egg-info/SOURCES.txt +4 -0
- react_agent_harness-0.9.0/tests/test_persistent_agent.py +911 -0
- react_agent_harness-0.9.0/tests/test_persistent_completion.py +140 -0
- react_agent_harness-0.9.0/tests/test_persistent_controls.py +193 -0
- react_agent_harness-0.8.0/tests/test_persistent_agent.py +0 -439
- {react_agent_harness-0.8.0 → react_agent_harness-0.9.0}/LICENSE +0 -0
- {react_agent_harness-0.8.0 → react_agent_harness-0.9.0}/agents/__init__.py +0 -0
- {react_agent_harness-0.8.0 → react_agent_harness-0.9.0}/agents/base.py +0 -0
- {react_agent_harness-0.8.0 → react_agent_harness-0.9.0}/harness/__init__.py +0 -0
- {react_agent_harness-0.8.0 → react_agent_harness-0.9.0}/harness/annotation.py +0 -0
- {react_agent_harness-0.8.0 → react_agent_harness-0.9.0}/harness/checkpoint.py +0 -0
- {react_agent_harness-0.8.0 → react_agent_harness-0.9.0}/harness/cli.py +0 -0
- {react_agent_harness-0.8.0 → react_agent_harness-0.9.0}/harness/console.py +0 -0
- {react_agent_harness-0.8.0 → react_agent_harness-0.9.0}/harness/events.py +0 -0
- {react_agent_harness-0.8.0 → react_agent_harness-0.9.0}/harness/executor_bridge.py +0 -0
- {react_agent_harness-0.8.0 → react_agent_harness-0.9.0}/harness/hitl.py +0 -0
- {react_agent_harness-0.8.0 → react_agent_harness-0.9.0}/harness/llm/__init__.py +0 -0
- {react_agent_harness-0.8.0 → react_agent_harness-0.9.0}/harness/llm/_streaming.py +0 -0
- {react_agent_harness-0.8.0 → react_agent_harness-0.9.0}/harness/llm/anthropic.py +0 -0
- {react_agent_harness-0.8.0 → react_agent_harness-0.9.0}/harness/llm/auth.py +0 -0
- {react_agent_harness-0.8.0 → react_agent_harness-0.9.0}/harness/llm/claude_code.py +0 -0
- {react_agent_harness-0.8.0 → react_agent_harness-0.9.0}/harness/llm/fallback.py +0 -0
- {react_agent_harness-0.8.0 → react_agent_harness-0.9.0}/harness/llm/openai.py +0 -0
- {react_agent_harness-0.8.0 → react_agent_harness-0.9.0}/harness/llm/openai_codex.py +0 -0
- {react_agent_harness-0.8.0 → react_agent_harness-0.9.0}/harness/llm/routing.py +0 -0
- {react_agent_harness-0.8.0 → react_agent_harness-0.9.0}/harness/oauth_browser.py +0 -0
- {react_agent_harness-0.8.0 → react_agent_harness-0.9.0}/harness/otel.py +0 -0
- {react_agent_harness-0.8.0 → react_agent_harness-0.9.0}/harness/runtime.py +0 -0
- {react_agent_harness-0.8.0 → react_agent_harness-0.9.0}/harness/steering.py +0 -0
- {react_agent_harness-0.8.0 → react_agent_harness-0.9.0}/harness/streaming.py +0 -0
- {react_agent_harness-0.8.0 → react_agent_harness-0.9.0}/harness/tool_policy.py +0 -0
- {react_agent_harness-0.8.0 → react_agent_harness-0.9.0}/harness/trace.py +0 -0
- {react_agent_harness-0.8.0 → react_agent_harness-0.9.0}/harness/trace_viewer.py +0 -0
- {react_agent_harness-0.8.0 → react_agent_harness-0.9.0}/harness/utils.py +0 -0
- {react_agent_harness-0.8.0 → react_agent_harness-0.9.0}/memory/__init__.py +0 -0
- {react_agent_harness-0.8.0 → react_agent_harness-0.9.0}/memory/episodic_lance.py +0 -0
- {react_agent_harness-0.8.0 → react_agent_harness-0.9.0}/memory/manager.py +0 -0
- {react_agent_harness-0.8.0 → react_agent_harness-0.9.0}/memory/redis_store.py +0 -0
- {react_agent_harness-0.8.0 → react_agent_harness-0.9.0}/memory/stores.py +0 -0
- {react_agent_harness-0.8.0 → react_agent_harness-0.9.0}/memory/working.py +0 -0
- {react_agent_harness-0.8.0 → react_agent_harness-0.9.0}/orchestrator/__init__.py +0 -0
- {react_agent_harness-0.8.0 → react_agent_harness-0.9.0}/orchestrator/planner.py +0 -0
- {react_agent_harness-0.8.0 → react_agent_harness-0.9.0}/react_agent_harness.egg-info/dependency_links.txt +0 -0
- {react_agent_harness-0.8.0 → react_agent_harness-0.9.0}/react_agent_harness.egg-info/entry_points.txt +0 -0
- {react_agent_harness-0.8.0 → react_agent_harness-0.9.0}/react_agent_harness.egg-info/requires.txt +0 -0
- {react_agent_harness-0.8.0 → react_agent_harness-0.9.0}/react_agent_harness.egg-info/top_level.txt +0 -0
- {react_agent_harness-0.8.0 → react_agent_harness-0.9.0}/setup.cfg +0 -0
- {react_agent_harness-0.8.0 → react_agent_harness-0.9.0}/tests/test_agents_base.py +0 -0
- {react_agent_harness-0.8.0 → react_agent_harness-0.9.0}/tests/test_annotation.py +0 -0
- {react_agent_harness-0.8.0 → react_agent_harness-0.9.0}/tests/test_anthropic_llm.py +0 -0
- {react_agent_harness-0.8.0 → react_agent_harness-0.9.0}/tests/test_budget_guard.py +0 -0
- {react_agent_harness-0.8.0 → react_agent_harness-0.9.0}/tests/test_checkpoint_resume.py +0 -0
- {react_agent_harness-0.8.0 → react_agent_harness-0.9.0}/tests/test_claude_code_llm.py +0 -0
- {react_agent_harness-0.8.0 → react_agent_harness-0.9.0}/tests/test_cli.py +0 -0
- {react_agent_harness-0.8.0 → react_agent_harness-0.9.0}/tests/test_console_renderer.py +0 -0
- {react_agent_harness-0.8.0 → react_agent_harness-0.9.0}/tests/test_executor_bridge.py +0 -0
- {react_agent_harness-0.8.0 → react_agent_harness-0.9.0}/tests/test_fallback_llm.py +0 -0
- {react_agent_harness-0.8.0 → react_agent_harness-0.9.0}/tests/test_fan_in.py +0 -0
- {react_agent_harness-0.8.0 → react_agent_harness-0.9.0}/tests/test_http_fetch.py +0 -0
- {react_agent_harness-0.8.0 → react_agent_harness-0.9.0}/tests/test_llm_auth.py +0 -0
- {react_agent_harness-0.8.0 → react_agent_harness-0.9.0}/tests/test_mcp_adapter.py +0 -0
- {react_agent_harness-0.8.0 → react_agent_harness-0.9.0}/tests/test_mcp_auth.py +0 -0
- {react_agent_harness-0.8.0 → react_agent_harness-0.9.0}/tests/test_memory.py +0 -0
- {react_agent_harness-0.8.0 → react_agent_harness-0.9.0}/tests/test_memory_reconciler.py +0 -0
- {react_agent_harness-0.8.0 → react_agent_harness-0.9.0}/tests/test_memory_touchpoints.py +0 -0
- {react_agent_harness-0.8.0 → react_agent_harness-0.9.0}/tests/test_oauth_browser.py +0 -0
- {react_agent_harness-0.8.0 → react_agent_harness-0.9.0}/tests/test_openai_codex_llm.py +0 -0
- {react_agent_harness-0.8.0 → react_agent_harness-0.9.0}/tests/test_openai_llm.py +0 -0
- {react_agent_harness-0.8.0 → react_agent_harness-0.9.0}/tests/test_orchestrator.py +0 -0
- {react_agent_harness-0.8.0 → react_agent_harness-0.9.0}/tests/test_otel.py +0 -0
- {react_agent_harness-0.8.0 → react_agent_harness-0.9.0}/tests/test_parse_action_json.py +0 -0
- {react_agent_harness-0.8.0 → react_agent_harness-0.9.0}/tests/test_per_call_site_llm.py +0 -0
- {react_agent_harness-0.8.0 → react_agent_harness-0.9.0}/tests/test_redis_store.py +0 -0
- {react_agent_harness-0.8.0 → react_agent_harness-0.9.0}/tests/test_routing_llm.py +0 -0
- {react_agent_harness-0.8.0 → react_agent_harness-0.9.0}/tests/test_steering.py +0 -0
- {react_agent_harness-0.8.0 → react_agent_harness-0.9.0}/tests/test_streaming.py +0 -0
- {react_agent_harness-0.8.0 → react_agent_harness-0.9.0}/tests/test_subagent_tool.py +0 -0
- {react_agent_harness-0.8.0 → react_agent_harness-0.9.0}/tests/test_tool_policy.py +0 -0
- {react_agent_harness-0.8.0 → react_agent_harness-0.9.0}/tests/test_trace.py +0 -0
- {react_agent_harness-0.8.0 → react_agent_harness-0.9.0}/tests/test_utils.py +0 -0
- {react_agent_harness-0.8.0 → react_agent_harness-0.9.0}/tests/test_vision.py +0 -0
- {react_agent_harness-0.8.0 → react_agent_harness-0.9.0}/tests/test_working_memory.py +0 -0
- {react_agent_harness-0.8.0 → react_agent_harness-0.9.0}/tools/__init__.py +0 -0
- {react_agent_harness-0.8.0 → react_agent_harness-0.9.0}/tools/builtin/__init__.py +0 -0
- {react_agent_harness-0.8.0 → react_agent_harness-0.9.0}/tools/builtin/fetch_image.py +0 -0
- {react_agent_harness-0.8.0 → react_agent_harness-0.9.0}/tools/builtin/http_fetch.py +0 -0
- {react_agent_harness-0.8.0 → react_agent_harness-0.9.0}/tools/builtin/subagent.py +0 -0
- {react_agent_harness-0.8.0 → react_agent_harness-0.9.0}/tools/mcp/__init__.py +0 -0
- {react_agent_harness-0.8.0 → react_agent_harness-0.9.0}/tools/mcp/adapter.py +0 -0
- {react_agent_harness-0.8.0 → react_agent_harness-0.9.0}/tools/mcp/auth.py +0 -0
{react_agent_harness-0.8.0/react_agent_harness.egg-info → react_agent_harness-0.9.0}/PKG-INFO
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: react-agent-harness
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.9.0
|
|
4
4
|
Summary: Multi-agent LLM orchestration: hybrid DAG planning, two-tier memory, streaming, cost/token budgets with per-call-site breakdown
|
|
5
5
|
Requires-Python: >=3.10
|
|
6
6
|
License-File: LICENSE
|
|
@@ -643,12 +643,85 @@ Use `app.capabilities()` to inspect the already-wired coordinator,
|
|
|
643
643
|
sub-agents, and MCP tools. The demo exposes this with
|
|
644
644
|
`--show-capabilities`.
|
|
645
645
|
|
|
646
|
+
Persistent sessions also expose a small control surface for user interfaces:
|
|
647
|
+
|
|
648
|
+
```python
|
|
649
|
+
state = await app.session_state("thread-1")
|
|
650
|
+
print(state.tokens_in_total, state.tokens_out_total)
|
|
651
|
+
sessions = await app.list_sessions()
|
|
652
|
+
matches = await app.list_sessions(query="research")
|
|
653
|
+
cached = app.cached_memory_context("thread-1")
|
|
654
|
+
await app.save_to_memory("thread-1") # reconcile pending turns, keep cache warm
|
|
655
|
+
await app.force_compact("thread-1") # structural reorg (summary + trim + reconcile + evict)
|
|
656
|
+
app.forget_memory_cache("thread-1")
|
|
657
|
+
await app.clear_session("thread-1") # clear transcript only; memory retained
|
|
658
|
+
await app.delete_session("thread-1") # delete transcript only; memory retained
|
|
659
|
+
```
|
|
660
|
+
|
|
661
|
+
There is deliberately no `close()` method — the SQLite transcript is the
|
|
662
|
+
durable record, and any of `chat`/`save_to_memory`/`force_compact` on the
|
|
663
|
+
same `session_id` later will resume from it. To exit, just stop calling
|
|
664
|
+
`chat` (and let the process end).
|
|
665
|
+
|
|
666
|
+
For simple REPLs, `PersistentCommandHandler` maps slash commands to those
|
|
667
|
+
primitives and returns structured results:
|
|
668
|
+
|
|
669
|
+
```python
|
|
670
|
+
from harness.persistent_controls import PersistentCommandHandler
|
|
671
|
+
|
|
672
|
+
controls = PersistentCommandHandler(app)
|
|
673
|
+
result = await controls.handle("/sessions research", session_id=session_id)
|
|
674
|
+
if result.session_id:
|
|
675
|
+
session_id = result.session_id
|
|
676
|
+
if result.text:
|
|
677
|
+
print(result.text)
|
|
678
|
+
```
|
|
679
|
+
|
|
680
|
+
The command surface is defined once in `SLASH_COMMAND_SPECS` and exposed via
|
|
681
|
+
`slash_command_specs()`. Tab-completion in the demo binds those specs to
|
|
682
|
+
`prompt_toolkit` via `SlashCommandCompleter`:
|
|
683
|
+
|
|
684
|
+
```python
|
|
685
|
+
from prompt_toolkit import PromptSession
|
|
686
|
+
from prompt_toolkit.history import FileHistory
|
|
687
|
+
from harness.persistent_completion import SlashCommandCompleter
|
|
688
|
+
|
|
689
|
+
session = PromptSession(
|
|
690
|
+
history=FileHistory("~/.agent-harness/demo_history"),
|
|
691
|
+
completer=SlashCommandCompleter(app),
|
|
692
|
+
complete_while_typing=False, # Tab-triggered; doesn't query the store every keystroke
|
|
693
|
+
)
|
|
694
|
+
message = (await session.prompt_async("> ")).strip()
|
|
695
|
+
```
|
|
696
|
+
|
|
697
|
+
Name completion comes from the spec registry; session-id arguments call
|
|
698
|
+
`app.list_sessions(query=...)` (SQLite pushes the filter down to
|
|
699
|
+
`lower(session_id) LIKE ?` so per-keystroke cost stays bounded). Other UIs
|
|
700
|
+
(web autocomplete, fzf, IDE plugins) should consume `slash_command_specs()`
|
|
701
|
+
directly without importing the prompt_toolkit binding.
|
|
702
|
+
|
|
703
|
+
The demo uses that utility for:
|
|
704
|
+
|
|
705
|
+
- `/capabilities`, `/agents`, `/mcp` inspect wired agents and tools
|
|
706
|
+
- `/session` shows turns, context-pressure estimate, reconcile cadence, and summary
|
|
707
|
+
- `/usage` shows persisted total and last-run provider-reported token usage
|
|
708
|
+
- `/sessions [query]` lists known session ids, optionally filtered by id text
|
|
709
|
+
- `/memory` shows the cached per-session memory context
|
|
710
|
+
- `/save` flushes turns after the last reconcile checkpoint into long-term memory **without** evicting the cached prior (foreground prefix stays warm)
|
|
711
|
+
- `/compact` forces a structural reorg — summary + trim + reconcile + cache evict — used when the transcript is bloating, not for routine "save"
|
|
712
|
+
- `/forget` evicts cached memory context so the next turn refetches it
|
|
713
|
+
- `/switch <id>` resumes or creates a logical session id
|
|
714
|
+
- `/new [id]` starts a fresh session id and refuses to collide with an existing id
|
|
715
|
+
- `/clear` clears the current transcript/summary/counters; long-term memory is retained
|
|
716
|
+
- `/delete [id] confirm` deletes a transcript row; long-term memory is retained
|
|
717
|
+
- `/end` exits the demo — no auto-flush; call `/save` first if you want pending facts persisted
|
|
718
|
+
|
|
646
719
|
Each chat turn gets a fresh `WorkingMemory`. Continuity comes from the
|
|
647
720
|
SQLite session state (rolling summary + recent messages) and normal
|
|
648
721
|
`MemoryManager` recall, not from carrying old ReAct scratchpads forever.
|
|
649
722
|
|
|
650
723
|
**Prefix-cache aware.** The full prompt stays byte-identical across plain
|
|
651
|
-
chat turns within a compaction window.
|
|
724
|
+
chat turns within a compaction window. Four things make that work:
|
|
652
725
|
|
|
653
726
|
1. The accumulated session transcript is sent to the coordinator as real
|
|
654
727
|
`user`/`assistant` role messages — not folded into one inline-rendered
|
|
@@ -658,20 +731,40 @@ chat turns within a compaction window. Three things make that work:
|
|
|
658
731
|
pinned user-message prior, **not in the system prompt**. The system
|
|
659
732
|
prompt is now pure agent identity + tool list + ReAct format — purely
|
|
660
733
|
static. Memory context is fetched once per session, cached on the
|
|
661
|
-
`PersistentAgent`, and refreshed only at compaction or
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
734
|
+
`PersistentAgent`, and refreshed only at compaction or explicit
|
|
735
|
+
"remember" signals.
|
|
736
|
+
3. **Compaction triggers on context-size pressure, not turn counts.**
|
|
737
|
+
`compact_at_context_fraction=0.5` (default) reads the coordinator
|
|
738
|
+
LLM's `input_token_budget` and fires when the transcript crosses
|
|
739
|
+
~50% of it. After compaction, `retain_context_fraction=0.15`
|
|
740
|
+
keeps the newest messages that fit in ~15% of the input budget
|
|
741
|
+
verbatim and folds older messages into the rolling summary.
|
|
742
|
+
Chat-only sessions go thousands of turns between
|
|
743
|
+
compactions; browser-heavy sessions compact when budget pressure
|
|
744
|
+
actually warrants it.
|
|
745
|
+
4. **Background memory accumulation, foreground cache stability.**
|
|
746
|
+
Every `async_reconcile_every_turns` turns (default 10), a
|
|
747
|
+
non-blocking `write_run_end` samples the last N turn-pairs from the
|
|
748
|
+
durable transcript and updates long-term memory — but does **not**
|
|
749
|
+
evict the per-session memory cache. New facts are immediately
|
|
750
|
+
visible to OTHER sessions; THIS session sees them at the next
|
|
751
|
+
compaction (where the cache is already breaking for the summary
|
|
752
|
+
refresh).
|
|
669
753
|
|
|
670
754
|
OpenAI's automatic prefix cache and Anthropic's `cache_control` markers
|
|
671
|
-
both match on longest-identical prefix. Together these
|
|
672
|
-
a typical session pay one cold compaction
|
|
673
|
-
|
|
674
|
-
|
|
755
|
+
both match on longest-identical prefix. Together these four changes let
|
|
756
|
+
a typical session pay one cold compaction when the transcript actually
|
|
757
|
+
fills the context window, with warm cache hits on every turn in
|
|
758
|
+
between, while still accumulating memory in the background.
|
|
759
|
+
|
|
760
|
+
The legacy `reconcile_every_turns`, `compact_every_turns`, and
|
|
761
|
+
`compact_message_threshold` knobs have been **removed** — passing them
|
|
762
|
+
to `PersistentAgentConfig` is a clear `TypeError` rather than a silent
|
|
763
|
+
no-op so existing user code can be updated explicitly. Reconciliation
|
|
764
|
+
fires on (a) user-explicit `remember` / `prefer` / `always` / etc.
|
|
765
|
+
signals (immediate, evicts cache), (b) periodic background async path
|
|
766
|
+
(non-blocking, no eviction), or (c) compaction (with the summary LLM
|
|
767
|
+
call, evicts cache).
|
|
675
768
|
|
|
676
769
|
The demo stores local state under `~/.agent-harness` by default:
|
|
677
770
|
|
|
@@ -697,11 +790,13 @@ python examples/persistent_agent_demo.py --provider claude-code
|
|
|
697
790
|
The wrapper owns cadence:
|
|
698
791
|
|
|
699
792
|
- session transcript is written every turn without an LLM;
|
|
700
|
-
- `MemoryManager.write_run_end(...)`
|
|
701
|
-
durable
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
793
|
+
- `MemoryManager.write_run_end(...)` runs synchronously only for explicit
|
|
794
|
+
durable user signals such as "remember" / "prefer" / "always";
|
|
795
|
+
- background async reconciliation samples the durable transcript every
|
|
796
|
+
`async_reconcile_every_turns` turns without evicting the current
|
|
797
|
+
session's memory-context cache;
|
|
798
|
+
- session compaction runs under context pressure and updates the stored
|
|
799
|
+
summary while trimming older transcript messages.
|
|
705
800
|
|
|
706
801
|
For MCP, put MCP tools on the coordinator or sub-agents before wrapping.
|
|
707
802
|
`PersistentAgent` does not special-case MCP auth; it preserves the existing
|