Skip to content

Conversation

github-actions[bot]
Copy link

Description

This PR implements the agentStart and agentMessage tools as described in issue #111. These tools provide an asynchronous approach to working with sub-agents, allowing the parent agent to:

  • Start multiple sub-agents in parallel
  • Monitor sub-agent progress
  • Provide guidance to sub-agents
  • Terminate sub-agents if needed

The implementation follows the pattern of shellStart and shellMessage tools and maintains backward compatibility with the existing subAgent tool.

Implementation Details

  1. agentStart Tool:

    • Similar parameters to the current subAgent tool
    • Returns an instance ID immediately
    • Maintains a global map of running sub-agents
    • Sub-agent execution happens asynchronously
  2. agentMessage Tool:

    • Takes an instance ID parameter to identify which sub-agent to interact with
    • Allows getting the current state/output of the sub-agent
    • Allows providing guidance to the sub-agent (limited implementation in current version)
    • Allows terminating the sub-agent
  3. Documentation:

    • Added a new documentation file explaining both approaches
    • Included examples of how to use the new tools
  4. Tests:

    • Added basic tests for the new tools

Future Improvements

  • Enhance the guidance functionality to allow more interactive control over sub-agents
  • Add more comprehensive error handling and resource management
  • Implement a timeout mechanism for sub-agents
  • Add more detailed monitoring capabilities

Checklist

  • New agentStart and agentMessage tools implemented
  • Existing subAgent tool maintained for backward compatibility
  • Documentation updated to explain both approaches
  • Tests added for the new tools
  • Example usage provided in documentation

Resolves: #111

Implements the agentStart and agentMessage tools as described in issue #111.
These tools provide an asynchronous approach to working with sub-agents,
allowing the parent agent to:

- Start multiple sub-agents in parallel
- Monitor sub-agent progress
- Provide guidance to sub-agents
- Terminate sub-agents if needed

The implementation follows the pattern of shellStart and shellMessage tools
and maintains backward compatibility with the existing subAgent tool.

Resolves: #111
@bhouston
Copy link
Member

/mycoder Can you get rid of the new index.ts file that you introduced that wasn't a root library index.ts? I find that internal index.ts file that re-export types, classes, methods, etc are an anti-pattern that make it harder to figure out where classes, methods and types are actually defined. So please just remove it and have the files that were importing this index.ts to just import directly from the files that declare the various constructs.

Copy link
Author

I've reviewed the PR and understand your request to remove the packages/agent/src/tools/interaction/index.ts file.

Based on my analysis:

  1. The index.ts file is currently re-exporting tools from several files:

    export { agentMessageTool } from './agentMessage.js';
    export { agentStartTool, agentStates } from './agentStart.js';
    export { subAgentTool } from './subAgent.js';
    export { userPromptTool } from './userPrompt.js';
  2. The good news is that in the main getTools.ts file, the tools are already being imported directly from their source files rather than through the index:

    import { agentMessageTool } from './interaction/agentMessage.js';
    import { agentStartTool } from './interaction/agentStart.js';
    import { subAgentTool } from './interaction/subAgent.js';
    import { userPromptTool } from './interaction/userPrompt.js';
  3. I didn't find any other imports from this index.ts file in the PR diff.

I'll remove the index.ts file as requested since it appears to be unnecessary and follows the anti-pattern you mentioned. If there are any other specific files or patterns you'd like me to address, please let me know.

Copy link
Author

I've created PR #206 to address your request to remove the interaction/index.ts file.

The changes are very simple - just removing the index.ts file that was re-exporting the tools. I verified that no files in the project were importing from this index file, so there should be no impact on functionality.

Please review the PR when you have a chance. If there are any other changes you'd like to see, please let me know!

refactor: remove interaction/index.ts to avoid re-export anti-pattern
@bhouston bhouston merged commit 1c44705 into main Mar 12, 2025
1 check failed
@bhouston bhouston deleted the feature/agent-start-message-tools branch March 12, 2025 02:07
Copy link
Author

🎉 This PR is included in version mycoder-agent-v1.1.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Transform subAgent tool into agentStart and agentMessage tools

1 participant