LibreChat/api/server/controllers/agents
Danny Avila cfd5c793a9
🧑‍🏫 fix: Multi-Agent Instructions Handling (#11484)
* 🧑‍🏫 fix: Multi-Agent Instructions Handling

* Refactored AgentClient to streamline the process of building messages by applying shared run context and agent-specific instructions.
* Introduced new utility functions in context.ts for extracting MCP server names, fetching MCP instructions, and building combined agent instructions.
* Updated the Agent type to make instructions optional, allowing for more flexible agent configurations.
* Improved the handling of context application to agents, ensuring that all relevant information is correctly integrated before execution.

* chore: Update EphemeralAgent Type in Context

* Enhanced the context.ts file by importing the TEphemeralAgent type from librechat-data-provider.
* Updated the applyContextToAgent function to use TEphemeralAgent for the ephemeralAgent parameter, improving type safety and clarity in agent context handling.

* ci: Update Agent Instructions in Tests for Clarity

* Revised test assertions in AgentClient to clarify the source of agent instructions, ensuring they are explicitly referenced as coming from agent configuration rather than build options.
* Updated comments in tests to enhance understanding of the expected behavior regarding base agent instructions and their handling in various scenarios.

* ci: Unit Tests for Agent Context Utilities

* Introduced comprehensive unit tests for agent context utilities, including functions for extracting MCP servers, fetching MCP instructions, and building agent instructions.
* Enhanced test coverage to ensure correct behavior across various scenarios, including handling of empty tools, mixed tool types, and error cases.
* Improved type definitions for AgentWithTools to clarify the structure and requirements for agent context operations.
2026-01-22 19:36:06 -05:00
..
__tests__ 🏁 fix: Message Race Condition if Cancelled Early (#11462) 2026-01-21 13:57:12 -05:00
callbacks.js 🏞️ fix: Gemini Image Filenames and Add Tool Cache Safety (#11306) 2026-01-12 09:01:23 -05:00
client.js 🧑‍🏫 fix: Multi-Agent Instructions Handling (#11484) 2026-01-22 19:36:06 -05:00
client.test.js 🧑‍🏫 fix: Multi-Agent Instructions Handling (#11484) 2026-01-22 19:36:06 -05:00
errors.js 🛜 refactor: Streamline App Config Usage (#9234) 2025-08-26 12:10:18 -04:00
recordCollectedUsage.spec.js 🪙 refactor: Collected Usage & Anthropic Prompt Caching (#11319) 2026-01-12 23:02:08 -05:00
request.js 🏁 fix: Message Race Condition if Cancelled Early (#11462) 2026-01-21 13:57:12 -05:00
v1.js 🌅 fix: Agent Avatar S3 URL Refresh Pagination and Persistence (#11323) 2026-01-13 13:01:11 -05:00
v1.spec.js 🌅 fix: Agent Avatar S3 URL Refresh Pagination and Persistence (#11323) 2026-01-13 13:01:11 -05:00