这是indexloc提供的服务,不要输入任何密码
Skip to content

feat: support yaml defined agents #8306

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

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

benverhees
Copy link
Contributor

@benverhees benverhees commented Jul 8, 2025

Summary

This PR introduces YAML-defined agents - a new feature that allows administrators to define agents in YAML configuration files. These agents are automatically synchronized to the database at startup and are read-only in the UI, preventing users from modifying them while still allowing usage in conversations and duplication for customization.

Closes: #7741

Key Features:

  • YAML Agent Configuration: Define agents with complete configurations including models, tools, instructions, and file resources directly in YAML
  • File Resource Management: Automatic processing and embedding of files specified in YAML agent definitions for file_search, execute_code, and OCR tools
  • Project Assignment: Configurable project membership for YAML agents with support for global and specific project assignments
  • Read-only UI: YAML-defined agents are clearly marked and protected from modifications in the UI
  • Startup Sync: Automatic synchronization of YAML agents to database on application startup
  • Duplication Support: Users can duplicate YAML agents to create their own customizable versions

Technical Implementation:

  • Added isYamlDefined flag to agent schema for identification
  • Enhanced file search tool to handle embedding of YAML agent files
  • Implemented comprehensive readonly mode throughout the agent UI components
  • Added validation and permission checks to prevent unauthorized modifications
  • Enhanced agent duplication to properly handle YAML agent properties

Change Type

Please delete any irrelevant options.

  • New feature (non-breaking change which adds functionality)
  • This change requires a documentation update

Testing

The feature has been tested with:

  1. YAML Agent Definition: Created test agents in YAML configuration with various tool resources and file attachments
  2. Database Sync: Verified agents are properly synchronized to database on startup
  3. UI Readonly Mode: Confirmed YAML agents display as read-only with appropriate UI indicators
  4. File Processing: Tested file embedding for file_search tool resources
  5. Duplication: Verified users can duplicate YAML agents and modify the copies
  6. Permission Checks: Validated all modification attempts are properly blocked for YAML agents
  7. Project Assignment: Tested automatic project assignment based on YAML configuration

Checklist

Please delete any irrelevant options.

  • My code adheres to this project's style guidelines
  • I have performed a self-review of my own code
  • I have commented in any complex areas of my code
  • I have made pertinent documentation changes
  • My changes do not introduce new warnings
  • I have written tests demonstrating that my changes are effective or that my feature works
  • Local unit tests pass with my changes
  • Any changes dependent on mine have been merged and published in downstream modules.
  • A pull request for updating the documentation has been submitted: Add documentation for yaml agents LibreChat-AI/librechat.ai#354

Copy link
Contributor

@github-advanced-security github-advanced-security bot left a comment

Choose a reason for hiding this comment

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

ESLint found more than 20 potential problems in the proposed changes. Check the Files changed tab for more details.

@benverhees benverhees marked this pull request as draft July 8, 2025 10:24
@benverhees
Copy link
Contributor Author

benverhees commented Jul 8, 2025

@danny-avila file search files for RAG are tested and handled correctly in this PR. The only thing I am not sure of, is how to handle OCR and Code Interpreter files, as I don't have access to test that functionality. Tools are supported, but actions are not supported yet.

@benverhees benverhees force-pushed the feat/yaml-agents branch 2 times, most recently from 337766e to 622e62f Compare July 8, 2025 13:14
@benverhees benverhees marked this pull request as ready for review July 8, 2025 13:54
@benverhees benverhees force-pushed the feat/yaml-agents branch 6 times, most recently from c2558ee to f9790cf Compare July 8, 2025 20:16
@benverhees benverhees marked this pull request as draft July 9, 2025 10:46
@benverhees benverhees marked this pull request as ready for review July 9, 2025 11:38
@benverhees benverhees changed the title Support yaml defined agents feat: support yaml defined agents Jul 9, 2025
@benverhees benverhees marked this pull request as draft July 10, 2025 11:06
@benverhees
Copy link
Contributor Author

@danny-avila documentation for this is in LibreChat-AI/librechat.ai#354

@benverhees benverhees marked this pull request as ready for review July 10, 2025 11:41
@danny-avila
Copy link
Owner

Thank you @benverhees

I will review this post-v0.7.9 release as we will be merging in a lot of changes to agent files you touched and need to prioritize merging them first, after said release.

Also this PR seems related to #8207 although this one is a lot more extensive.

@danny-avila danny-avila marked this pull request as draft July 10, 2025 13:23
@benverhees
Copy link
Contributor Author

benverhees commented Jul 10, 2025

I will review this post-v0.7.9 release as we will be merging in a lot of changes to agent files you touched and need to prioritize merging them first, after said release.

That's great! I can rebase my changes when needed, just let me know!

Also this PR seems related to #8207 although this one is a lot more extensive.

Yes, I saw that PR when I was already working on my change.

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.

[Enhancement]: Configure Agents from YAML for Use with Model Specs
2 participants