feat: add runAgent functionality to execute agent commands and update…#6
Open
ducheharsh wants to merge 1 commit into
Open
feat: add runAgent functionality to execute agent commands and update…#6ducheharsh wants to merge 1 commit into
ducheharsh wants to merge 1 commit into
Conversation
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request introduces support for tracking and updating user credit balances when interacting with agents, as well as a new endpoint for running agents. The main changes include schema updates for user credits, a new API route and controller method for running agents, and logic to decrement user credits based on agent usage.
User credit management:
creditBalanceandcreditBalanceLastUpdatedfields to theusertable and Prisma schema, with defaults set for new users. [1] [2]Agent execution and credit deduction:
runAgentmethod inAgentServiceto execute an agent, calculate credit usage based on agent costs and token usage, and update the user's credit balance accordingly.runAgentmethod toAgentControllerand exposed a new POST endpoint/agents/:id/runinagent.route.tsfor running agents. [1] [2]Agent CRUD improvements:
idanduserId. [1] [2]Type consistency and validation: