Skip to content

feat: agent tool executor with graph operation tools - #1023

Merged
malibio merged 1 commit into
mainfrom
feature/issue-1007-agent-tools
Apr 3, 2026
Merged

malibio merged 1 commit into
mainfrom
feature/issue-1007-agent-tools

Conversation

@malibio

@malibio malibio commented Apr 3, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Implements GraphToolExecutor with 7 graph operation tools for the local agent
  • search_nodes, search_semantic, get_node, create_node, update_node, create_relationship, get_related_nodes
  • JSON schema validation, token-efficient results

Closes #1007

Co-Authored-By: Claude [email protected]

…loses #1007)

Implements GraphToolExecutor exposing 7 NodeSpace graph operations as
tools the local agent can call: search_nodes, search_semantic, get_node,
create_node, update_node, create_relationship, get_related_nodes.

Co-Authored-By: Claude <[email protected]>
@malibio
malibio merged commit e41cf1a into main Apr 3, 2026
@malibio
malibio deleted the feature/issue-1007-agent-tools branch April 3, 2026 22:55
@malibio

malibio commented Apr 3, 2026

Copy link
Copy Markdown
Collaborator Author

Post-Merge Code Review: PR #1023 (Agent tool executor with graph operation tools)

Verdict: Has issues that need follow-up.

Findings

[Improvement] update_node has a TOCTOU race on version check

File: packages/desktop-app/src-tauri/src/local_agent/tools.rs (lines ~496-559 in the diff)

The exec_update_node method fetches the node to get its current version, then calls update_node with that version. Between the fetch and the update, another operation could modify the node, causing a version conflict. This is a classic time-of-check-time-of-use (TOCTOU) issue.

For a local agent operating on a single-user desktop app, this is unlikely to cause real problems. But if the agent runs multiple tool calls concurrently (or while the user is editing), it will fail with a confusing error. Consider having the update_node service accept None for version to skip the optimistic concurrency check, or implement a retry-on-conflict loop.

Priority: Medium -- unlikely in practice for the local agent use case, but architecturally fragile.

[Improvement] get_related_nodes defaults to "mentions" silently

File: packages/desktop-app/src-tauri/src/local_agent/tools.rs (line ~592-593)

When relationship_type is omitted, it silently defaults to "mentions". The tool schema says this field is optional, but the default behavior of filtering to only mentions relationships could surprise the agent model. Consider defaulting to returning all relationship types, or making relationship_type required.

[Improvement] search_semantic accepts collection parameter but ignores it

File: packages/desktop-app/src-tauri/src/local_agent/tools.rs (line ~397-399)

The schema declares a collection parameter, but the implementation explicitly ignores it. This means the model may believe it's filtering by collection when it's not. Consider removing the parameter from the schema until it's actually supported, to avoid misleading tool-call behavior.

Notes

  • Good argument validation pattern with require_str, optional_str, optional_usize helpers.
  • Token-efficient output with truncated bodies is well-suited for 8k-context local models.
  • Proper handling of unknown tools via ToolError::UnknownTool.
  • 19 tests covering helpers, schemas, validation, and unknown tool handling.

Follow-up needed: Remove collection from schema or implement it; consider making relationship_type required or defaulting to all types.

malibio added a commit that referenced this pull request Jun 22, 2026
…loses #1007) (#1023)

Implements GraphToolExecutor exposing 7 NodeSpace graph operations as
tools the local agent can call: search_nodes, search_semantic, get_node,
create_node, update_node, create_relationship, get_related_nodes.

Co-authored-by: Michael Libio <[email protected]>
Co-authored-by: Claude <[email protected]>
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.

Agent tool executor: graph operation tools for local agent

1 participant