feat(core): add ability to have custom system prompt#73
Conversation
@trymeka/ai-provider-vercel
@trymeka/computer-provider-anchor-browser
@trymeka/computer-provider-core
@trymeka/computer-provider-e2b
@trymeka/computer-provider-scrapybara
@trymeka/core
commit: |
There was a problem hiding this comment.
Greptile Summary
This PR introduces the ability to override the default system prompt in the Meka agent framework while simultaneously standardizing type definitions across the codebase. The main feature addition is a new optional createSystemPrompt parameter in the createAgent function that allows developers to provide custom system prompts for their agents.
The implementation follows a clean pattern where the custom prompt function receives screen size information and returns a string. If no custom prompt is provided, the agent falls back to the default SYSTEM_PROMPT function, ensuring full backward compatibility. The PR includes a practical example (custom-system-prompt.ts) that demonstrates how to create an agent that prioritizes system instructions over user requests.
Alongside this feature, the PR performs important type system improvements by extracting an inline screen size type definition into a reusable ScreenSize interface. This new interface is then consistently used across all computer providers (Anchor Browser, Scrapybara, E2B) and the system prompt logic, replacing previous inline type definitions like { width: number; height: number; }. This refactoring improves code maintainability, reduces duplication, and ensures type consistency throughout the framework.
The changes integrate seamlessly with the existing codebase architecture, where computer providers supply screen dimensions that are used for context-aware prompt generation. The system prompt customization capability enables use cases like domain-specific agent behavior, custom safety constraints, or specialized operational guidelines that cannot be achieved through the standard system prompt alone.
Confidence score: 5/5
- This PR is safe to merge with minimal risk as it maintains full backward compatibility and follows established patterns
- Score reflects well-structured implementation with proper type safety, comprehensive example documentation, and no breaking changes to existing functionality
- No files require special attention as all changes are straightforward type improvements and clean feature additions
Context used:
Rule - Try to find real bugs instead of nit picking on small style issues. We are moving fast and trying to make sure things work. (link)
8 files reviewed, no comments
No description provided.