Refactor on tools/action/observation... I think it...
# proj-sdk
c
Refactor on tools/action/observation... I think it has reached a point where it introduces more complexity for the end user to fix one hacky deserialization issue in our action execution system... See this end user example for adding custom tools @wide-doctor-37830 if you are around, maybe we can hop in office hour to discuss a bit more? (cc @wooden-umbrella-84098 will you be in OH too?) https://github.com/All-Hands-AI/agent-sdk/pull/319
w
I have 10m right now
then will take a ~15m call and have another 15m before customer call
👍 1
w
I can hop on in the gap, just ping me @chilly-france-44439
c
i'm in
> Meeting assets for Office Hours are ready! > > Meeting summary > Quick recap > The team discussed challenges with MCP tools and predefined schemas, particularly focusing on how to modify action attributes and handle security risk analysis. They explored different approaches to managing security risk information and tool calls in their system, including moving away from dynamic subclasses toward a more flexible JSON-based schema approach. The discussion concluded with agreement on adopting a middle-ground design that would allow for on-the-fly validation while maintaining simplicity in the external-facing API. > Next steps > • Xingyao to implement the MCP2 action approach instead of dynamically creating action subclasses for MCP tools. > • Xingyao to modify the tool conversion process to handle security risk fields at the OpenAI tool conversion level rather than in the base action class. > • Xingyao to ensure the action schema sent to clients doesn't include security information to keep it cleaner. > • Calvin to help with refactoring if needed when Xingyao implements the new approach. > Summary > MCP Tools and Schema Challenges > The team discussed challenges with MCP tools and predefined schemas, particularly around adding attributes to existing actions and handling security risk analysis. Xingyao explained that their current architecture requires creating subclasses to modify action schemas, which presents issues when changes aren't available on both server and client sides. Calvin suggested an alternative approach of modifying field descriptions in the base class rather than creating new subclasses, though this remains untested. The discussion also covered the complexity of implementing security risk analysis, which currently forces all actions to include a security risk argument, though this adds only about 20% more token consumption and may not work well with open source models that are overfit to existing tool schemas. > Security Risk Analysis System Refactoring > Calvin and Xingyao discussed modifying how security risk information is handled in their system. They agreed to move security risk analysis out of the base class and instead inject it dynamically when converting actions to tool calls. This approach would allow for cleaner action schemas sent to clients and potentially make it easier to add new tools and security features in the future. Xingyao raised a concern about how to handle security risk attributes when processing tool calls and actions in the history, but they determined that storing security information as an optional field on action events should address this issue. > Tool Calls and Action Wrapping > Xingyao and Calvin discussed the relationship between tool calls and actions in their system. They clarified that actions serve as a wrapper around tool calls, providing benefits like easier conversion to MCB schema and better handling for the front-end. Calvin suggested using a simpler approach for MCP tool calls by having a static MCP action that carries the payload without creating dynamic subclasses. Xingyao explained the current complexity in converting MCP tool input schemas to action schemas and acknowledged that this approach may cause issues on servers and clients. > MCP Action Design Strategy Discussion > Xingyao and Calvin discussed the design approach for MCP actions in their SDK, debating between maintaining strict structure with Pydantic classes versus using unstructured JSON data. They agreed to move toward a middle ground where they would store MCP tool's JSON schema directly in the action definition rather than creating dynamic Pydantic classes, allowing for on-the-fly validation while avoiding the complexity of persistent type information. Juan advised keeping the external-facing API simple for future refactoring, noting that major changes could be made relatively easily in future versions due to the SDK's modular design. Mainly as reference for robert 🙂 I think we figured a path forward that shouldn't change things a lot, and i think this is aligned with what you've suggested in the meeting