Two-stage semantic search: embedding similarity + GPU reranking. Returns top 10 results in ~1230ms.
const results = await morph.codebaseSearch.search({ query: 'Where is user authentication handled?', repoId: 'my-project', target_directories: ['src/auth'], // or [] for entire repo explanation: 'Finding auth logic', limit: 10});// Returns: Top 10 code chunks with:// - File path + line numbers// - Function/class context // - Similarity scores (embedding + rerank)console.log(results.results[0].content);console.log(results.results[0].rerankScore);
When to use: Agent needs to find relevant codeReturns: Ranked code chunks with scores + metadataSpeed: ~1230ms (vector search + GPU reranking)
Requires git push: Code must be pushed with MorphGit first to create searchable embeddings. Embeddings are generated automatically on push (takes ~8 seconds in background).
First search after push: Wait ~10 seconds after pushing before searching to allow embedding generation to complete.
When to use: Agent builds apps and needs version controlReturns: Standard git operations (init, clone, push, pull, etc.)Bonus: Auto-embeds code for semantic search on every push
Fast push response: Git push returns in 200ms. Embedding generation happens asynchronously in the background (~3-8 seconds).
const result = await morph.browser.executeWithRecording({ task: 'Test checkout for buying a pineapple', url: 'https://3000-abc.e2b.dev', maxSteps: 20, recordVideo: true, videoWidth: 1280, videoHeight: 720});if (result.recording?.videoUrl) { console.log('📹 Video:', result.recording.videoUrl); console.log('📊 Size:', result.recording.fileSize); // Get errors with screenshots const { errors } = await morph.browser.getErrors(result.recording.id); errors.forEach(e => console.log(e.screenshotUrl));}
When to use: Agent needs to test web applicationsReturns: Test results + optional session video + console logs + error screenshotsRecording format: WebM video, 7-day presigned S3 URLs, auto-deleted after 30 days
Works with e2b.dev URLs: The browser worker can access e2b.dev preview environments and other publicly accessible URLs.
Max video length: Videos are limited to 3 minutes. For longer tests, use recordVideo: false.