Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions examples/agents/63-deploy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
* - CONDUCTOR_AGENT_LLM_MODEL=openai/gpt-4o-mini as environment variable
*/

import { pathToFileURL } from 'url';
import { Agent, AgentRuntime, tool } from '@io-orkes/conductor-javascript/agents';
import { llmModel } from './settings';

Expand Down Expand Up @@ -91,8 +92,9 @@ async function main() {
}

// Guard: 63c-run-by-name.ts imports docAssistant from this file — only run
// when executed directly, not on import.
if (require.main === module) {
// when executed directly, not on import. (ESM equivalent of
// `require.main === module`, which does not exist in ES module scope.)
if (process.argv[1] && import.meta.url === pathToFileURL(process.argv[1]).href) {
main().catch((err) => {
console.error(err);
process.exitCode = 1;
Expand Down
6 changes: 4 additions & 2 deletions examples/agents/63d-serve-from-package.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
* - CONDUCTOR_AGENT_LLM_MODEL=openai/gpt-4o-mini as environment variable
*/

import { pathToFileURL } from 'url';
import { Agent, AgentRuntime, tool } from '@io-orkes/conductor-javascript/agents';
import { llmModel } from './settings';

Expand Down Expand Up @@ -63,8 +64,9 @@ async function main() {
}

// Guard: 63e-run-monitoring.ts imports monitoringAgent from this file — only
// run when executed directly, not on import.
if (require.main === module) {
// run when executed directly, not on import. (ESM equivalent of
// `require.main === module`, which does not exist in ES module scope.)
if (process.argv[1] && import.meta.url === pathToFileURL(process.argv[1]).href) {
main().catch((err) => {
console.error(err);
process.exitCode = 1;
Expand Down
Loading