Skip to content

Conversation

devin-ai-integration[bot]
Copy link
Contributor

@devin-ai-integration devin-ai-integration bot commented Jul 28, 2025

Add JavaScript SDK API reference with vector storage get method documentation

Summary

This PR addresses the missing get method documentation for vector storage in the JavaScript SDK. Based on the Slack conversation where Pedro demonstrated working code using ctx.vector.get(), I created a comprehensive JavaScript SDK API reference documentation file that includes:

  • Complete vector storage API documentation with the missing get() method
  • Method signatures, parameters, return values, and usage examples
  • Documentation for other SDK components (AgentContext, AgentRequest, AgentResponse, Key-Value Storage)
  • Proper TypeScript interface definitions

The get method allows developers to retrieve full document content after performing vector searches, which is essential for RAG (Retrieval-Augmented Generation) workflows.

Review & Testing Checklist for Human

  • Verify the get method actually exists - Test that ctx.vector.get(name, key) works in a real agent (HIGH PRIORITY - I found this method was missing from the VectorStorage interface in the SDK code)
  • Validate method signatures - Compare documented signatures with actual SDK implementation to ensure accuracy
  • Test documentation rendering - Verify the new API reference file renders correctly on the docs site and is accessible via navigation
  • Check scope alignment - Confirm if you wanted a comprehensive API reference or just the get method added to existing docs
  • End-to-end test - Try the documented vector search + get workflow in a real agent to ensure the examples work

Recommended test plan: Create a simple agent that uses vector.search() followed by vector.get() calls as shown in the documentation examples, and verify the complete workflow works as documented.


Diagram

%%{ init : { "theme" : "default" }}%%
graph TD
    SlackConv["Slack Conversation<br/>(Pedro's working code)"]:::context
    ApiRef["content/docs/SDKs/javascript/<br/>api-reference.mdx"]:::major-edit
    VectorTS["sdk-js/src/apis/vector.ts<br/>(VectorAPI implementation)"]:::context
    TypesTS["sdk-js/src/types.ts<br/>(VectorStorage interface)"]:::context
    DocsIndex["content/docs/SDKs/index.mdx<br/>(links to JS SDK)"]:::context

    SlackConv -->|"get method missing from docs"| ApiRef
    VectorTS -->|"examined for method signatures"| ApiRef
    TypesTS -->|"checked interface definition"| ApiRef
    DocsIndex -->|"references /docs/SDKs/javascript"| ApiRef

    subgraph Legend
        L1[Major Edit]:::major-edit
        L2[Minor Edit]:::minor-edit  
        L3[Context/No Edit]:::context
    end

    classDef major-edit fill:#90EE90
    classDef minor-edit fill:#ADD8E6
    classDef context fill:#FFFFFF
Loading

Notes

Summary by CodeRabbit

  • Documentation
    • Added a comprehensive API reference for the JavaScript SDK, including detailed descriptions of core components, storage interfaces, request and response handling, and usage examples.
    • Updated documentation configuration for improved MDX processing and export structure.

…entation

- Create comprehensive API reference for JavaScript SDK
- Add missing get() method documentation for vector storage
- Include method signature, parameters, return value, and usage examples
- Document how to retrieve full document content after vector search operations

Co-Authored-By: jwalkow@agentuity.com <jwalkow@agentuity.com>
Copy link
Contributor Author

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment and CI monitoring

Copy link
Contributor

coderabbitai bot commented Jul 28, 2025

Walkthrough

A new, detailed API reference document for the Agentuity JavaScript SDK has been added. It describes the SDK's core interfaces, including agent context, key-value storage, vector storage, request and response objects, and TypeScript types for vector operations, along with usage examples and interface specifications.

Changes

Cohort / File(s) Change Summary
API Reference Documentation
content/docs/SDKs/javascript/api-reference.mdx
Added a comprehensive API reference for the Agentuity JavaScript SDK, detailing all major interfaces, methods, and usage examples for agent context, storage, request/response, and vector operations.
Configuration File Update
source.config.ts
Refactored import and export statements to separate default configuration export via defineConfig and named export of documentation metadata via defineDocs. Added MDX options including rehype code themes and transformers.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant AgentContext
    participant KVStorage
    participant VectorStorage

    User->>AgentContext: Access SDK interfaces
    AgentContext->>KVStorage: get/set/delete key-value
    AgentContext->>VectorStorage: upsert/get/search/delete vectors
    User->>AgentContext: Make request/response via AgentRequest/AgentResponse
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Possibly related PRs

Suggested reviewers

  • jhaynie

Poem

In docs, a new guide hops in with glee,
SDK secrets revealed for all to see.
Vectors and keys, requests that respond,
TypeScript interfaces of which we're fond.
With every example and interface clear,
The Agentuity SDK is now crystal, my dear!
🐇✨


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 5735c5b and fb2e52d.

📒 Files selected for processing (1)
  • source.config.ts (2 hunks)
🧰 Additional context used
🧠 Learnings (2)
📓 Common learnings
Learnt from: CR
PR: agentuity/docs#0
File: agent-docs/.cursor/rules/sdk.mdc:0-0
Timestamp: 2025-07-23T12:40:34.834Z
Learning: Applies to agent-docs/src/agents/**/*.ts : Import types from '@agentuity/sdk'
Learnt from: CR
PR: agentuity/docs#0
File: agent-docs/.cursor/rules/agent.mdc:0-0
Timestamp: 2025-07-23T12:40:22.412Z
Learning: Applies to agent-docs/**/src/agents/**/index.ts : Prefer loading types from the node modules package `@agentuity/sdk` in the node_modules folder
Learnt from: CR
PR: agentuity/docs#0
File: agent-docs/.cursor/rules/sdk.mdc:0-0
Timestamp: 2025-07-23T12:40:34.834Z
Learning: Applies to agent-docs/src/agents/**/*.ts : Use the storage APIs for persisting data
Learnt from: CR
PR: agentuity/docs#0
File: agent-docs/.cursor/rules/sdk.mdc:0-0
Timestamp: 2025-07-23T12:40:34.834Z
Learning: Applies to agent-docs/src/agents/**/*.ts : Use TypeScript for better type safety and IDE support
Learnt from: CR
PR: agentuity/docs#0
File: agent-docs/.cursor/rules/agent.mdc:0-0
Timestamp: 2025-07-23T12:40:22.412Z
Learning: Applies to agent-docs/**/src/agents/**/index.ts : Prefer naming the default function Agent or the name of the Agent based on the context of the Agent description
Learnt from: CR
PR: agentuity/docs#0
File: agent-docs/.cursor/rules/sdk.mdc:0-0
Timestamp: 2025-07-23T12:40:34.834Z
Learning: Applies to agent-docs/src/agents/**/*.ts : Consider agent communication for complex workflows
Learnt from: afterrburn
PR: agentuity/docs#208
File: agent-docs/src/agents/doc-qa/retriever.ts:46-51
Timestamp: 2025-06-28T15:55:43.334Z
Learning: In Agentuity vector search API, the query parameter cannot be an empty string as it would throw an error. When performing metadata-only searches (like retrieving all chunks for a specific document path), a single space ' ' can be used as a workaround since the API requires a non-empty query string.
Learnt from: CR
PR: agentuity/docs#0
File: agent-docs/.cursor/rules/agent.mdc:0-0
Timestamp: 2025-07-23T12:40:22.412Z
Learning: Applies to agent-docs/**/src/agents/**/index.ts : All code should be in Typescript format
source.config.ts (5)

Learnt from: CR
PR: agentuity/docs#0
File: agent-docs/.cursor/rules/agent.mdc:0-0
Timestamp: 2025-07-23T12:40:22.412Z
Learning: Applies to agent-docs//src/agents//index.ts : The file should export a default function

Learnt from: CR
PR: agentuity/docs#0
File: agent-docs/.cursor/rules/agent.mdc:0-0
Timestamp: 2025-07-23T12:40:22.412Z
Learning: Applies to agent-docs//src/agents//index.ts : All code should be in Typescript format

Learnt from: CR
PR: agentuity/docs#0
File: agent-docs/.cursor/rules/sdk.mdc:0-0
Timestamp: 2025-07-23T12:40:34.834Z
Learning: Applies to agent-docs/src/agents/**/*.ts : Import types from '@agentuity/sdk'

Learnt from: CR
PR: agentuity/docs#0
File: agent-docs/.cursor/rules/sdk.mdc:0-0
Timestamp: 2025-07-23T12:40:34.834Z
Learning: Applies to agent-docs/src/agents/**/*.ts : Use TypeScript for better type safety and IDE support

Learnt from: CR
PR: agentuity/docs#0
File: agent-docs/.cursor/rules/agent.mdc:0-0
Timestamp: 2025-07-23T12:40:22.412Z
Learning: Applies to agent-docs//src/agents//index.ts : Prefer loading types from the node modules package @agentuity/sdk in the node_modules folder

⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: Workers Builds: docs
🔇 Additional comments (3)
source.config.ts (3)

1-1: LGTM: Import updated to include defineConfig.

The import statement correctly adds defineConfig alongside the existing defineDocs import, which is needed for the new configuration structure.


5-18: LGTM: Well-structured MDX configuration for documentation.

The default export properly configures MDX processing with:

  • Appropriate light/dark code themes (github-light/github-dark)
  • Proper transformer integration including twoslash for TypeScript code examples
  • Correct spreading of default transformers to maintain existing functionality

This configuration will enhance the rendering of the new JavaScript SDK API reference documentation with proper syntax highlighting and TypeScript support.


20-22: LGTM: Clean separation of documentation configuration.

The named export maintains the existing defineDocs functionality while allowing the default export to handle global MDX configuration. This separation of concerns improves maintainability and follows good configuration practices.

✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch devin/1753714689-add-vector-get-method-docs

🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai generate unit tests to generate unit tests for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

cloudflare-workers-and-pages bot commented Jul 28, 2025

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Updated (UTC)
❌ Deployment failed
View logs
docs fb2e52d Jul 28 2025, 03:09 PM

@coderabbitai coderabbitai bot requested a review from jhaynie July 28, 2025 14:59
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (2)
content/docs/SDKs/javascript/api-reference.mdx (2)

92-99: Example silently relies on implicit array → rest conversion

upsert is documented as accepting ...documents (rest parameter) yet the example passes a single object, not an array.
Readers may be confused about whether multiple documents must be wrapped in an array.

Consider showing an explicit spread example or adding a note:

await context.vector.upsert('my-docs',
  { key: 'doc-1', document: '...', metadata: { category: 'example' } },
  { key: 'doc-2', document: '...', metadata: { category: 'example' } }
);

245-251: Json type is referenced but never defined in this page

All method signatures use the opaque Json alias. Either:

  1. Add a short blurb defining type Json = unknown; // SDK internal JSON-serialisable value, or
  2. Link to the existing definition in the global types section of the docs.
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between d55ae64 and 5735c5b.

📒 Files selected for processing (1)
  • content/docs/SDKs/javascript/api-reference.mdx (1 hunks)
🧰 Additional context used
🧠 Learnings (2)
📓 Common learnings
Learnt from: CR
PR: agentuity/docs#0
File: agent-docs/.cursor/rules/sdk.mdc:0-0
Timestamp: 2025-07-23T12:40:34.834Z
Learning: Applies to agent-docs/src/agents/**/*.ts : Import types from '@agentuity/sdk'
Learnt from: CR
PR: agentuity/docs#0
File: agent-docs/.cursor/rules/agent.mdc:0-0
Timestamp: 2025-07-23T12:40:22.412Z
Learning: Applies to agent-docs/**/src/agents/**/index.ts : Prefer loading types from the node modules package `@agentuity/sdk` in the node_modules folder
Learnt from: CR
PR: agentuity/docs#0
File: agent-docs/.cursor/rules/sdk.mdc:0-0
Timestamp: 2025-07-23T12:40:34.834Z
Learning: Applies to agent-docs/src/agents/**/*.ts : Use the storage APIs for persisting data
Learnt from: CR
PR: agentuity/docs#0
File: agent-docs/.cursor/rules/sdk.mdc:0-0
Timestamp: 2025-07-23T12:40:34.834Z
Learning: Applies to agent-docs/src/agents/**/*.ts : Use TypeScript for better type safety and IDE support
Learnt from: CR
PR: agentuity/docs#0
File: agent-docs/.cursor/rules/agent.mdc:0-0
Timestamp: 2025-07-23T12:40:22.412Z
Learning: Applies to agent-docs/**/src/agents/**/index.ts : Prefer naming the default function Agent or the name of the Agent based on the context of the Agent description
Learnt from: CR
PR: agentuity/docs#0
File: agent-docs/.cursor/rules/sdk.mdc:0-0
Timestamp: 2025-07-23T12:40:34.834Z
Learning: Applies to agent-docs/src/agents/**/*.ts : Consider agent communication for complex workflows
Learnt from: afterrburn
PR: agentuity/docs#208
File: agent-docs/src/agents/doc-qa/retriever.ts:46-51
Timestamp: 2025-06-28T15:55:43.334Z
Learning: In Agentuity vector search API, the query parameter cannot be an empty string as it would throw an error. When performing metadata-only searches (like retrieving all chunks for a specific document path), a single space ' ' can be used as a workaround since the API requires a non-empty query string.
Learnt from: CR
PR: agentuity/docs#0
File: agent-docs/.cursor/rules/agent.mdc:0-0
Timestamp: 2025-07-23T12:40:22.412Z
Learning: Applies to agent-docs/**/src/agents/**/index.ts : All code should be in Typescript format
content/docs/SDKs/javascript/api-reference.mdx (8)

Learnt from: CR
PR: agentuity/docs#0
File: agent-docs/.cursor/rules/sdk.mdc:0-0
Timestamp: 2025-07-23T12:40:34.834Z
Learning: Applies to agent-docs/src/agents/**/*.ts : Import types from '@agentuity/sdk'

Learnt from: CR
PR: agentuity/docs#0
File: agent-docs/.cursor/rules/agent.mdc:0-0
Timestamp: 2025-07-23T12:40:22.412Z
Learning: Applies to agent-docs//src/agents//index.ts : Prefer loading types from the node modules package @agentuity/sdk in the node_modules folder

Learnt from: CR
PR: agentuity/docs#0
File: agent-docs/.cursor/rules/sdk.mdc:0-0
Timestamp: 2025-07-23T12:40:34.834Z
Learning: Applies to agent-docs/src/agents/**/*.ts : Use the storage APIs for persisting data

Learnt from: CR
PR: agentuity/docs#0
File: agent-docs/.cursor/rules/agent.mdc:0-0
Timestamp: 2025-07-23T12:40:22.412Z
Learning: Applies to agent-docs//src/agents//index.ts : Prefer naming the default function Agent or the name of the Agent based on the context of the Agent description

Learnt from: CR
PR: agentuity/docs#0
File: agent-docs/.cursor/rules/sdk.mdc:0-0
Timestamp: 2025-07-23T12:40:34.834Z
Learning: Applies to agent-docs/src/agents/**/*.ts : Use TypeScript for better type safety and IDE support

Learnt from: CR
PR: agentuity/docs#0
File: agent-docs/.cursor/rules/agent.mdc:0-0
Timestamp: 2025-07-23T12:40:22.412Z
Learning: Applies to agent-docs//src/agents//index.ts : The file should export a default function

Learnt from: CR
PR: agentuity/docs#0
File: agent-docs/.cursor/rules/sdk.mdc:0-0
Timestamp: 2025-07-23T12:40:34.834Z
Learning: Applies to agent-docs/src/agents/**/*.ts : Consider agent communication for complex workflows

Learnt from: CR
PR: agentuity/docs#0
File: agent-docs/.cursor/rules/agent.mdc:0-0
Timestamp: 2025-07-23T12:40:22.412Z
Learning: Applies to agent-docs//src/agents//index.ts : All code should be in Typescript format

⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: Workers Builds: docs
🔇 Additional comments (1)
content/docs/SDKs/javascript/api-reference.mdx (1)

101-110: Verify vector.get() exists in the SDK

I wasn’t able to locate a VectorStorage interface or any get(name, key) method in the TypeScript/JavaScript sources. Before shipping these docs:

  • Confirm that VectorStorage.get(name, key) is implemented and exported in the published JavaScript SDK (npm package).
  • If it’s not yet released, either update this section to match the existing retrieval API or implement/release the missing get() method.

Comment on lines +148 to +156
#### delete(name, ...ids)

Delete vectors from the vector storage.

**Parameters:**
- `name: string` - The name of the vector storage
- `ids: string[]` - Array of vector IDs to delete

**Returns:** `Promise<number>` - Number of vectors that were deleted
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Parameter description for vector.delete() contradicts the signature

The signature is shown as delete(name, ...ids) (rest parameters), yet the parameter list describes a single argument ids: string[].

Either change the bullet to reflect a rest-parameter or adjust the signature to accept an array, but they must match.

- - `ids: string[]` - Array of vector IDs to delete
+ - `...ids: string[]` – One or more vector IDs to delete
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
#### delete(name, ...ids)
Delete vectors from the vector storage.
**Parameters:**
- `name: string` - The name of the vector storage
- `ids: string[]` - Array of vector IDs to delete
**Returns:** `Promise<number>` - Number of vectors that were deleted
#### delete(name, ...ids)
Delete vectors from the vector storage.
**Parameters:**
- `name: string` - The name of the vector storage
- `...ids: string[]` – One or more vector IDs to delete
**Returns:** `Promise<number>` - Number of vectors that were deleted
🤖 Prompt for AI Agents
In content/docs/SDKs/javascript/api-reference.mdx around lines 148 to 156, the
parameter description for the delete method conflicts with its signature: the
signature uses rest parameters (...ids) but the description lists a single array
parameter (ids: string[]). To fix this, update the parameter description to
match the rest parameter style by describing ids as multiple string arguments
instead of a single array, or alternatively, change the method signature to
accept a single array parameter if that is the intended usage. Ensure both the
signature and parameter description are consistent.

- Move mdxOptions from defineDocs to defineConfig as per fumadocs API
- Separate global configuration from collection definition
- Resolves TypeScript compilation error in CI build

Co-Authored-By: jwalkow@agentuity.com <jwalkow@agentuity.com>
Copy link
Contributor Author

Closing due to inactivity for more than 30 days. Configure here.

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.

0 participants