-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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
feat: Direct Client API - Add Delete Agent functionality #2267
Merged
wtfsayo
merged 8 commits into
elizaOS:develop
from
jason51553262:direct-client_agent-crud
Jan 14, 2025
Merged
feat: Direct Client API - Add Delete Agent functionality #2267
wtfsayo
merged 8 commits into
elizaOS:develop
from
jason51553262:direct-client_agent-crud
Jan 14, 2025
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.
Hi @jseparovic! Welcome to the elizaOS community. Thanks for submitting your first pull request; your efforts are helping us accelerate towards AGI. We'll review it shortly. You are now an elizaOS contributor!
jason51553262
changed the title
Improvement: Direct Client API - Add Create and Delete Agent functionality
Improvement: Direct Client API - Add Delete Agent functionality
Jan 14, 2025
…REVENT_UNHANDLED_EXIT support
…vic/eliza into direct-client_agent-crud
lgtm |
wtfsayo
approved these changes
Jan 14, 2025
odilitime
changed the title
Improvement: Direct Client API - Add Delete Agent functionality
feat: Direct Client API - Add Delete Agent functionality
Jan 16, 2025
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.
Risks
Low
Background
For my use case, I'm building a web app that can start and stop agents with characters configured in a UI. For this application it's not practical to restart the Eliza Docker Service each time a new agent is added or removed as this will offline existing active agents.
The existing Direct Client API has a POST /agents/:agentId/set endpoint which can be used to either create or update an agent with a character JSON passed into the request body. It makes sense to also implement Delete.
What does this PR do?
Adds the following APIs to Direct Client:
I've also added support for an environment variable PREVENT_UNHANDLED_EXIT which when set, will handle both uncaughtException and unhandledRejection and send the exception to console.error instead of allowing the process to terminate.
What kind of change is this?
Improvements (to existing Direct Client API functionality)
Why are we doing this? Any context or related work?
So that an integrated application can start and stop agents without requiring a restart of Eliza
Documentation changes needed?
My changes require a change to the project documentation.
Testing
Where should a reviewer start?
Only one change in api.ts
Detailed testing steps
Execute the follow REST calls in Postman:
(Create and Update)
POST http://localhost:3000/agents/:agentId/set { character }
(Delete)
DELETE http://localhost:3000/agents/:agentId
In the character file use a client with a required secret such as telegram and TELEGRAM_BOT_TOKEN.
Test with a valid TELEGRAM_BOT_TOKEN and also test without the TELEGRAM_BOT_TOKEN at all.
In the current build, when you POST /agents/:agentId/set with a telegram client but a missing TELEGRAM_BOT_TOKEN, a validation error will be thrown and the system will exit as the existing code that calls startAgent is not catching this error. Fixing in this PR.