-
Notifications
You must be signed in to change notification settings - Fork 31
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Playground #56
base: main
Are you sure you want to change the base?
Playground #56
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR implements an Agent playground based on the mastra playground, refactoring tool setup and integrating new toolsets for DB operations and playbook management. Key changes include:
- Adding and refining toolset type definitions and a merge function for combining tools.
- Introducing new toolset implementations (DBSQLTools, DBClusterTools, common and playbook toolsets) with associated functions and evaluations.
- Updating imports and refactoring several modules to align with the new playground integration.
Reviewed Changes
Copilot reviewed 12 out of 13 changed files in this pull request and generated 1 comment.
Show a summary per file
File | Description |
---|---|
apps/dbagent/src/lib/ai/tools/types.ts | Added toolset type definitions and mergeToolsets function. |
apps/dbagent/src/lib/ai/tools/db.ts | Implemented DBSQLTools class with various DB tool functions. |
apps/dbagent/src/lib/ai/tools/common.ts | Added common tool (getCurrentTime) and toolset. |
apps/dbagent/src/lib/ai/tools/cluster.ts | Added DBClusterTools class with tools for cluster-related operations. |
apps/dbagent/src/lib/ai/tools/playbook.ts | Introduced playbook toolset for managing and retrieving playbooks. |
apps/dbagent/src/lib/ai/tools/index.ts | Updated exports to include new toolset modules. |
apps/dbagent/playground/index.ts | Integrated toolsets into a playground environment with agent configurations. |
apps/dbagent/src/lib/targetdb/db.ts | Adjusted the PostgreSQL client import for module compatibility. |
apps/dbagent/src/lib/tools/dbinfo.ts | Modified getPerformanceAndVacuumSettings to accept a connection string instead of an object. |
apps/dbagent/src/lib/ai/aidba.ts | Refactored the getTools function to merge toolsets from various sources. |
Files not reviewed (1)
- apps/dbagent/package.json: Language not supported
Provide an Agent playground based on mastra playground. To run the playground use `pnpm run playground`. No mastra libraries are used by the main project. The change refactors tool setup, so that we can setup and reuse tools from the playground.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR refactors the tool setup and DB access in the Agent playground, shifting from NextAuth-based queryDb calls to a unified DBAccess instance pattern. It also updates various API endpoints and pages to consistently use the new DB access functions, and introduces playground-specific tools and agents based on the mastra playground.
Reviewed Changes
Copilot reviewed 56 out of 57 changed files in this pull request and generated no comments.
Show a summary per file
File | Description |
---|---|
apps/dbagent/src/components/connections/actions.ts | Updated connection actions to use getUserSessionDBAccess and new connection methods. |
apps/dbagent/src/components/collect/actions.ts | Refactored table, extension, and performance data collection to use withTargetDbConnection and DBAccess. |
apps/dbagent/src/components/chats/actions.ts | Modified chat actions to pass the DBAccess instance to schedule-run functions. |
apps/dbagent/src/components/aws-integration/actions.ts | Updated AWS integration actions to utilize DBAccess in integration methods. |
apps/dbagent/src/app/api/chat/route.ts | Refactored chat API endpoint to retrieve the DBAccess instance and added a tool cleanup callback. |
apps/dbagent/src/app/(main)/projects/page.tsx | Changed project listing to use the new getProjectsList action. |
apps/dbagent/src/app/(main)/projects/actions.ts | Introduced new project action functions that wrap DB operations with getUserSessionDBAccess. |
Multiple projects and monitoring pages | Updated to get project connections and schedules using the new DB access functions. |
apps/dbagent/server.ts | Altered server startup to support asynchronous preparation. |
apps/dbagent/playground/tools/index.ts and default/index.ts | Introduced new playground tools and agents, refactoring dependency usage based on the updated DB access model. |
Files not reviewed (1)
- apps/dbagent/package.json: Language not supported
Provide an Agent playground based on mastra playground. To run the playground use
pnpm run playground
.No mastra libraries are used by the main project. The change refactors tool setup, so that we can setup and reuse tools from the playground.
The agents are setup with a few evaluators already provided by mastra. Unfortunately the evalers interfaces only allow us to compare input and output per request/response. Some evaluators in mastra can evaluate the response based on user input chat context, but these can not be registered with the agent.
The use of NextAuth in queryDb did cause some problems to me when starting the playground. I chose to remove queryDb in favor of passing a DBAccess instance. With that change we decide in advance the context (current session user, other user, admin) queries shall be executed with. The DBAccess method uses a connection pool limiting the number of concurrent connections requests in case the agent want to call tools in parallel.