Skip to content

feat: add LlamaIndex integration#672

Open
DK09876 wants to merge 4 commits intomainfrom
feat/llamaindex-integration
Open

feat: add LlamaIndex integration#672
DK09876 wants to merge 4 commits intomainfrom
feat/llamaindex-integration

Conversation

@DK09876
Copy link
Contributor

@DK09876 DK09876 commented Mar 24, 2026

Summary

  • Add hindsight-llamaindex package: BaseToolSpec subclass + create_hindsight_tools() factory giving LlamaIndex agents persistent memory via retain/recall/reflect
  • Full test suite (34 unit tests passing)
  • Docs page at hindsight-docs/docs/sdks/integrations/llamaindex.md
  • Blog post at hindsight-docs/blog/2026-03-23-llamaindex-memory.md
  • Entry added to integrations.json

Test plan

  • uv run pytest tests/ -v — 34 passed, 3 skipped (manual)
  • uv run ruff check . && uv run ruff format --check . — clean
  • E2E test with real Hindsight instance via test_manual.py
  • Verify docs page renders correctly
  • Verify blog post renders correctly

🤖 Generated with Claude Code

DK09876 and others added 4 commits March 24, 2026 06:56
Add hindsight-llamaindex package providing persistent memory tools for
LlamaIndex agents via the native BaseToolSpec pattern. Includes retain,
recall, and reflect tools, a convenience factory, global config, full
test suite, docs page, blog post, and integrations.json entry.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Fix ReActAgent API: from_tools() → constructor, chat() → await run()
- Add create_bank step to all quickstart examples
- Add production patterns section to docs (tags, error handling, bank lifecycle)
- Add memory scoping recommendation to README
- Add when-not-to-use section to blog post
- Add LlamaIndex compatibility tests (agent acceptance, FunctionTool.call)
- Fix self-hosted auth wording in cookbook notebook

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Use await client.acreate_bank() instead of sync create_bank() to
  avoid "event loop already running" errors in notebooks and async contexts
- Wrap plain Python examples in async def main() + asyncio.run(main())
  so they are copy-paste runnable as scripts
- Add Jupyter notebook tip to docs showing top-level await pattern
- Bank lifecycle example in docs now uses async acreate_bank

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
HindsightToolSpec now provides both sync and async tool implementations
using LlamaIndex's (sync_fn, async_fn) tuple pattern in spec_functions.
Async agents (ReActAgent, etc.) use aretain/arecall/areflect natively,
avoiding the "Timeout context manager should be used inside a task"
error that occurred when sync _run_async() was called from within an
active event loop.

- Add aretain_memory, arecall_memory, areflect_on_memory async methods
- Extract shared kwargs builders (_retain_kwargs, _recall_kwargs, etc.)
- spec_functions now uses tuples: [("retain_memory", "aretain_memory"), ...]
- Tests verify tools have both sync fn and async fn set
- Notebook verified end-to-end with nbclient against local Hindsight

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@DK09876 DK09876 marked this pull request as ready for review March 25, 2026 00:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant