Skip to content

feat(agentos): add Hindsight long-term memory integration for AgentOS#2888

Open
benfrank241 wants to merge 4 commits into
mainfrom
integration/agentos
Open

feat(agentos): add Hindsight long-term memory integration for AgentOS#2888
benfrank241 wants to merge 4 commits into
mainfrom
integration/agentos

Conversation

@benfrank241

Copy link
Copy Markdown
Member

Summary

Adds @vectorize-io/hindsight-agentos, a first-party integration giving AgentOS agents long-term memory via Hindsight. Resolves the maintainer request in framerslab/agentos#16.

AgentOS exposes a clean AgentMemoryProvider hook (getContext before generation, observe after) that auto-wires on every agent call path. This integration takes the lightweight external-wrapper route from the issue: createHindsightMemory(options) returns an AgentMemoryProvider backed by Hindsight — no fork of AgentOS internals required.

import { agent } from "@framers/agentos";
import { createHindsightMemory } from "@vectorize-io/hindsight-agentos";
import { Hindsight } from "@vectorize-io/hindsight-client";

const memory = createHindsightMemory({
  client: new Hindsight({ apiKey: process.env.HINDSIGHT_API_KEY }),
  bank: "ada",
  recall: { budget: "high", includeEntities: true },
  retain: { tags: ["source:agentos"] },
});

const ada = agent({ name: "Ada", memoryProvider: memory });

How it works

Hook When What it does
getContext Before each model call Recalls relevant memories from Hindsight, returns a context block AgentOS injects into the system prompt
observe After each turn Retains the user turn (and optionally the agent reply) so Hindsight extracts entities and consolidates into world/experience facts + mental models server-side

Both sides fail safe — a recall failure returns no context (the agent still responds) and retains are fire-and-forget by default so they never add turn latency. bank, all recall options (budget/types/maxTokens/includeEntities/labelTypes/heading) and retain options (async/tags/metadata/includeAgentMessages) are configurable; either side can be disabled.

Meets the "Adding New Integrations" checklist

  • Tests — 18 vitest cases exercising the AgentMemoryProvider contract plus a harness that simulates AgentOS's own before/after turn wiring (recall injected into the prompt, both turns retained). The AgentMemoryProvider type is imported from the real @framers/agentos package.
  • CI jobbuild-agentos-integration (npm ci → test → build), gated on detect-changes integrations-agentos, and registered in the PR-status report.
  • Releaseagentos added to VALID_INTEGRATIONS in scripts/release-integration.sh.
  • Docs — gallery entry in integrations.json, integration page at docs-integrations/agentos.md, icon, and a row in the integrations README.

Test plan

  • npm ci && npm test — 18/18 pass
  • npm run build — ESM + DTS build clean (compiles against real @framers/agentos types)
  • tsc --noEmit clean
  • check-integrations.mjs / check-integration-seo.mjs — doc page + SEO pass
  • check-integration-lockfiles.sh — lockfile resolves from npm registry
  • test.yml YAML valid; release-integration.sh syntax OK

Adds `@vectorize-io/hindsight-agentos`, a lightweight wrapper that
implements AgentOS's `AgentMemoryProvider` interface backed by Hindsight.

- `getContext` recalls relevant memories from Hindsight before each model
  call and injects them into the system prompt.
- `observe` retains each turn after generation (fire-and-forget by
  default), letting Hindsight handle entity extraction and consolidation
  into world/experience facts and mental models server-side.

Both sides fail safe: recall failures return no context and retains never
add turn latency. Bank, recall (budget/types/maxTokens/includeEntities/
labelTypes/heading) and retain (async/tags/metadata/includeAgentMessages)
are all configurable; either side can be disabled.

Includes 18 vitest tests (provider contract + a harness that simulates
AgentOS's before/after turn wiring), a CI build job, release-script entry,
docs gallery entry + integration page, and README listing.

Resolves framerslab/agentos#16.
- Drop unused HindsightClient import in memory.ts (fails noUnusedLocals /
  ruff-style dead-code checks).
- Add agentos to the INTEGRATIONS dict in generate_changelog.py so the
  release changelog step accepts the integration.
- Remove the "View Changelog" link from the integration doc page: the
  /changelog/integrations/agentos page doesn't exist until the integration
  is released, so the link broke the docusaurus build (onBrokenLinks: throw).
  The release tooling adds the changelog + its link when a version is cut.
- Commit the generated docs-skill mirror
  (skills/hindsight-docs/references/sdks/integrations/agentos.md).
- Apply repo prettier formatting to the integration TS/README.
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