Method signature
Parameters
VibeKitStreamCallbacks Interface
Return value
CodexResponse (for Codex Agent)
ClaudeResponse (for Claude Agent)
Agent-specific behavior
Codex Agent
- Streaming Support: Full streaming support with real-time updates
- Sandbox Environment: Executes code in isolated E2B sandbox
- Mode Support: Both “ask” and “code” modes fully supported
Claude Agent
- Streaming Support: Limited - provides start/end notifications only
- Execution: Direct API calls without sandbox environment
- Mode Support: Both modes supported with fallback behavior
Examples
Basic Code Generation
With Streaming Callbacks
With Conversation History and Branch
Error handling
The method throws errors in the following cases:- Agent not initialized: When the configured agent type doesn’t match the initialized agent
- Agent-specific errors:
- Codex: Sandbox creation/execution failures, API errors
- Claude: API authentication issues, rate limits
- Configuration errors: Missing required API keys or invalid setup
Migration to executeCommand
ThegenerateCode method has been deprecated in favor of the more flexible executeCommand method. Here’s how to migrate your code:
Basic Migration
Before (generateCode):With Branch Support
Before (generateCode):Event Handling Migration
Before (generateCode with callbacks):Agent-Specific Commands
For different agents, use these command patterns: Claude:Benefits of executeCommand
- More Control: Direct access to agent CLI commands
- Branch Support: Automatic git branch switching
- Better Events: Use standard
stdout/stderrevents instead of custom callbacks - Flexibility: Execute any shell command in the sandbox environment
- Consistency: Single method for all command execution needs
Notes
- Required Mode: The
modeparameter is now required and must be specified - Object Parameters: All parameters are now passed as a destructured object for better API consistency
- Branch Support: The optional
branchparameter allows for version control or environment context - Streaming Differences: Codex provides real-time streaming, while Claude only provides start/end notifications
- Environment Support: Daytona environment is not yet supported and will throw an error
- Conversation Context: History is preserved across calls to maintain conversation context

