Skip to content

feat(providers): route graph extraction via AGENTMEMORY_GRAPH_MODEL#954

Open
shgew wants to merge 1 commit into
rohitg00:mainfrom
shgew:feat/providers-graph-model
Open

feat(providers): route graph extraction via AGENTMEMORY_GRAPH_MODEL#954
shgew wants to merge 1 commit into
rohitg00:mainfrom
shgew:feat/providers-graph-model

Conversation

@shgew

@shgew shgew commented Jun 20, 2026

Copy link
Copy Markdown

What

Add an optional AGENTMEMORY_GRAPH_MODEL env that routes mem::graph-extract through a dedicated provider whose model overrides the active provider model. When unset, the active provider's model is used (current behavior). The graph provider is a separate ResilientProvider instance, so its concurrency limiter and circuit breaker are independent of the summarize provider.

Why

A relation-native or lighter graph model often outperforms the main reasoning model on graph extraction. With one shared provider there is no way to mix them; the summarize model is forced on the extraction step too.

How

resolveGraphProviderConfig derives a graph config by overriding model on the active config. main() constructs the dedicated graph provider with the same fallback chain.

Side effect: AGENTMEMORY_LLM_CONCURRENCY no longer bottlenecks the pair; summarize and graph-extract can now issue outbound calls in parallel up to one per provider.

Complementarity with #900

Complementary to open PR #900 (AGENTMEMORY_COMPRESS_MODEL): compress and graph operate at distinct stages. Both can coexist after #900 lands - the two model overrides are independent fields on ProviderConfig.

Tests

test/graph-provider-routing.test.ts (new file, 2 cases). Targeted suite: 2/2 pass.

Compatibility

Unset env = no behavior change.

Summary by CodeRabbit

  • New Features

    • Added support for dedicated graph extraction provider routing via optional AGENTMEMORY_GRAPH_MODEL environment variable. When configured, graph extraction can use a different provider/model than other operations.
    • Graph extraction now operates with independent concurrency limiting and circuit breaker isolation.
  • Documentation

    • Updated environment configuration examples and provider documentation for graph extraction routing.

Add an optional AGENTMEMORY_GRAPH_MODEL env that routes
mem::graph-extract through a dedicated provider with its own model.
When unset, the active provider's model is used (today's behavior).
The graph provider is a separate ResilientProvider instance, so its
concurrency limiter and circuit breaker are independent of the
summarize provider.

Why: a relation-native or lighter graph model often outperforms the
main reasoning model on graph extraction. With one shared provider,
no way to mix them; the summarize model is forced on the extraction
step too.

How: resolveGraphProviderConfig derives a graph config by overriding
model on the active config. main() constructs the dedicated provider
with the same fallback chain.

Side effect: AGENTMEMORY_LLM_CONCURRENCY no longer bottlenecks the
pair; summarize and graph-extract can now issue outbound calls in
parallel up to one per provider.

Complementary to PR rohitg00#900 (AGENTMEMORY_COMPRESS_MODEL): compress and
graph operate at distinct stages. Both can coexist after rohitg00#900 lands -
the two model overrides are independent fields on ProviderConfig.

Tests: test/graph-provider-routing.test.ts (new file).

Signed-off-by: Hleb Shauchenka <me@marleb.org>
@vercel

vercel Bot commented Jun 20, 2026

Copy link
Copy Markdown

@shgew is attempting to deploy a commit to the rohitg00's projects Team on Vercel.

A member of the Team first needs to authorize it.

@coderabbitai

coderabbitai Bot commented Jun 20, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 815a00de-7bdd-442d-a01c-237504eb78c0

📥 Commits

Reviewing files that changed from the base of the PR and between f6f9e3c and e03cdeb.

📒 Files selected for processing (4)
  • .env.example
  • README.md
  • src/providers/index.ts
  • test/graph-provider-routing.test.ts

📝 Walkthrough

Walkthrough

Adds AGENTMEMORY_GRAPH_MODEL as an optional environment variable that routes mem::graph-extract to a dedicated provider model. Implements resolveGraphProviderConfig in src/providers/index.ts, tests it with Vitest, and documents the variable in .env.example and README.md.

Changes

Graph Provider Routing

Layer / File(s) Summary
resolveGraphProviderConfig implementation and tests
src/providers/index.ts, test/graph-provider-routing.test.ts
Adds resolveGraphProviderConfig(base) that clones the input ProviderConfig and overrides model with AGENTMEMORY_GRAPH_MODEL when set, falling back to base.model otherwise. Tests cover both the unset and set env var scenarios, asserting that only the model field is overridden while provider, maxTokens, and baseURL are preserved.
Environment variable docs
.env.example, README.md
Documents AGENTMEMORY_GRAPH_MODEL with commented inline description in .env.example and adds a new optional Graph extraction row to the LLM Providers table in README.md.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~5 minutes

Poem

A new env var hops into the scene 🐇
AGENTMEMORY_GRAPH_MODEL, fresh and keen,
It overrides the model when it's set,
Leaves everything else without a fret.
A dedicated lane for graph extract—
Neatly documented, cleanly tracked! ✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 33.33% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title directly describes the main feature: routing graph extraction via the new AGENTMEMORY_GRAPH_MODEL environment variable, which aligns with the core objective of the changeset.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

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