@@ -288,28 +288,28 @@ export class DevboxOps {
288288 *
289289 * @example
290290 * ```typescript
291- * const sdk = new RunloopSDK();
292- * const blueprint = await sdk .blueprint.create({
291+ * const runloop = new RunloopSDK();
292+ * const blueprint = await runloop .blueprint.create({
293293 * name: 'my-blueprint',
294294 * dockerfile: `FROM ubuntu:22.04
295295 * RUN apt-get update`,
296296 * });
297- * const devbox = await sdk .devbox.createFromBlueprintId(blueprint.id, { name: 'my-devbox' });
297+ * const devbox = await runloop .devbox.createFromBlueprintId(blueprint.id, { name: 'my-devbox' });
298298 * ```
299299 *
300300 * To use a local directory as a build context, use an object.
301301 *
302302 * @example
303303 * ```typescript
304- * const sdk = new RunloopSDK();
305- * const obj = await sdk .storageObject.uploadFromDir(
304+ * const runloop = new RunloopSDK();
305+ * const obj = await runloop .storageObject.uploadFromDir(
306306 * './',
307307 * {
308308 * name: 'build-context',
309309 * ttl_ms: 3600000, // 1 hour
310310 * }
311311 * );
312- * const blueprint = await sdk .blueprint.create({
312+ * const blueprint = await runloop .blueprint.create({
313313 * name: 'my-blueprint-with-context',
314314 * dockerfile: `FROM ubuntu:22.04
315315 * COPY . .`,
@@ -381,7 +381,7 @@ export class BlueprintOps {
381381 *
382382 * @example
383383 * ```typescript
384- * const sdk = new RunloopSDK();
384+ * const runloop = new RunloopSDK();
385385 * const snapshot = await devbox.snapshotDisk({ name: 'backup' });
386386 * ...
387387 * const devbox = await snapshot.createDevbox();
@@ -429,9 +429,9 @@ export class SnapshotOps {
429429 *
430430 * @example
431431 * ```typescript
432- * const sdk = new RunloopSDK();
433- * const storageObject = await sdk .storageObject.uploadFromFile("./my-file.txt", "my-file.txt");
434- * const objects = await sdk .storageObject.list();
432+ * const runloop = new RunloopSDK();
433+ * const storageObject = await runloop .storageObject.uploadFromFile("./my-file.txt", "my-file.txt");
434+ * const objects = await runloop .storageObject.list();
435435 * ```
436436 */
437437export class StorageObjectOps {
@@ -644,8 +644,8 @@ export class StorageObjectOps {
644644 *
645645 * @example
646646 * ```typescript
647- * const sdk = new RunloopSDK();
648- * const agent = await sdk .agent.create({
647+ * const runloop = new RunloopSDK();
648+ * const agent = await runloop .agent.create({
649649 * name: 'my-npm-agent',
650650 * source: {
651651 * type: 'npm',
@@ -667,6 +667,61 @@ export class AgentOps {
667667 /**
668668 * Create a new agent.
669669 *
670+ * @example
671+ * Create an agent from an NPM package:
672+ * ```typescript
673+ * const runloop = new RunloopSDK();
674+ * const agent = await runloop.agent.create({
675+ * name: 'my-agent',
676+ * source: {
677+ * type: 'npm',
678+ * npm: {
679+ * package_name: '@my -org/agent',
680+ * npm_version: '1.0.0'
681+ * }
682+ * }
683+ * });
684+ * console.log(`Created agent: ${agent.id}`);
685+ * ```
686+ *
687+ * @example
688+ * Create an agent from a Git repository:
689+ * ```typescript
690+ * const runloop = new RunloopSDK();
691+ * const agent = await runloop.agent.create({
692+ * name: 'my-git-agent',
693+ * source: {
694+ * type: 'git',
695+ * git: {
696+ * repository: 'https://github.com/my-org/agent-repo',
697+ * ref: 'main'
698+ * }
699+ * }
700+ * });
701+ * ```
702+ *
703+ * @example
704+ * Create an agent from a storage object:
705+ * ```typescript
706+ * const runloop = new RunloopSDK();
707+ * // First, upload your agent code as a storage object
708+ * const storageObject = await runloop.storageObject.uploadFromDir(
709+ * './my-agent',
710+ * { name: 'agent-package' }
711+ * );
712+ *
713+ * // Then create an agent from it
714+ * const agent = await runloop.agent.create({
715+ * name: 'my-object-agent',
716+ * source: {
717+ * type: 'object',
718+ * object: {
719+ * object_id: storageObject.id
720+ * }
721+ * }
722+ * });
723+ * ```
724+ *
670725 * @param {AgentCreateParams } params - Parameters for creating the agent.
671726 * @param {Core.RequestOptions } [options] - Request options.
672727 * @returns {Promise<Agent> } An {@link Agent} instance.
@@ -678,6 +733,39 @@ export class AgentOps {
678733 /**
679734 * Create an agent from an NPM package.
680735 *
736+ * @example
737+ * Basic usage:
738+ * ```typescript
739+ * const runloop = new RunloopSDK();
740+ * const agent = await runloop.agent.createFromNpm({
741+ * name: 'my-npm-agent',
742+ * package_name: '@my -org/agent'
743+ * });
744+ * ```
745+ *
746+ * @example
747+ * With version and setup commands:
748+ * ```typescript
749+ * const runloop = new RunloopSDK();
750+ * const agent = await runloop.agent.createFromNpm({
751+ * name: 'my-npm-agent',
752+ * package_name: '@my -org/agent',
753+ * npm_version: '^1.2.0',
754+ * agent_setup: ['npm run build', 'chmod +x ./run.sh']
755+ * });
756+ * ```
757+ *
758+ * @example
759+ * Using a private registry:
760+ * ```typescript
761+ * const runloop = new RunloopSDK();
762+ * const agent = await runloop.agent.createFromNpm({
763+ * name: 'private-agent',
764+ * package_name: '@my -org/private-agent',
765+ * registry_url: 'https://npm.mycompany.com'
766+ * });
767+ * ```
768+ *
681769 * @param {object } params - Parameters for creating the agent.
682770 * @param {string } params.package_name - NPM package name.
683771 * @param {string } [params.npm_version] - NPM version constraint.
@@ -714,6 +802,39 @@ export class AgentOps {
714802 /**
715803 * Create an agent from a Pip package.
716804 *
805+ * @example
806+ * Basic usage:
807+ * ```typescript
808+ * const runloop = new RunloopSDK();
809+ * const agent = await runloop.agent.createFromPip({
810+ * name: 'my-python-agent',
811+ * package_name: 'my-agent-package'
812+ * });
813+ * ```
814+ *
815+ * @example
816+ * With version constraint:
817+ * ```typescript
818+ * const runloop = new RunloopSDK();
819+ * const agent = await runloop.agent.createFromPip({
820+ * name: 'my-python-agent',
821+ * package_name: 'my-agent-package',
822+ * pip_version: '>=1.0.0,<2.0.0'
823+ * });
824+ * ```
825+ *
826+ * @example
827+ * Using a private PyPI registry:
828+ * ```typescript
829+ * const runloop = new RunloopSDK();
830+ * const agent = await runloop.agent.createFromPip({
831+ * name: 'private-python-agent',
832+ * package_name: 'my-private-agent',
833+ * registry_url: 'https://pypi.mycompany.com/simple',
834+ * agent_setup: ['python setup.py install']
835+ * });
836+ * ```
837+ *
717838 * @param {object } params - Parameters for creating the agent.
718839 * @param {string } params.package_name - Pip package name.
719840 * @param {string } [params.pip_version] - Pip version constraint.
@@ -750,6 +871,42 @@ export class AgentOps {
750871 /**
751872 * Create an agent from a Git repository.
752873 *
874+ * @example
875+ * Basic usage with public repository:
876+ * ```typescript
877+ * const runloop = new RunloopSDK();
878+ * const agent = await runloop.agent.createFromGit({
879+ * name: 'my-git-agent',
880+ * repository: 'https://github.com/my-org/agent-repo'
881+ * });
882+ * ```
883+ *
884+ * @example
885+ * With specific branch and setup commands:
886+ * ```typescript
887+ * const runloop = new RunloopSDK();
888+ * const agent = await runloop.agent.createFromGit({
889+ * name: 'my-git-agent',
890+ * repository: 'https://github.com/my-org/agent-repo',
891+ * ref: 'develop',
892+ * agent_setup: [
893+ * 'npm install',
894+ * 'npm run build'
895+ * ]
896+ * });
897+ * ```
898+ *
899+ * @example
900+ * Using a specific commit:
901+ * ```typescript
902+ * const runloop = new RunloopSDK();
903+ * const agent = await runloop.agent.createFromGit({
904+ * name: 'my-git-agent',
905+ * repository: 'https://github.com/my-org/agent-repo',
906+ * ref: 'a1b2c3d4e5f6'
907+ * });
908+ * ```
909+ *
753910 * @param {object } params - Parameters for creating the agent.
754911 * @param {string } params.repository - Git repository URL.
755912 * @param {string } [params.ref] - Optional Git ref (branch/tag/commit), defaults to main/HEAD.
@@ -783,6 +940,74 @@ export class AgentOps {
783940 /**
784941 * Create an agent from a storage object.
785942 *
943+ * @example
944+ * Upload agent code and create agent:
945+ * ```typescript
946+ * const runloop = new RunloopSDK();
947+ *
948+ * // Upload agent directory as a storage object
949+ * const storageObject = await runloop.storageObject.uploadFromDir(
950+ * './my-agent-code',
951+ * { name: 'agent-package' }
952+ * );
953+ *
954+ * // Create agent from the storage object
955+ * const agent = await runloop.agent.createFromObject({
956+ * name: 'my-object-agent',
957+ * object_id: storageObject.id
958+ * });
959+ * ```
960+ *
961+ * @example
962+ * With setup commands:
963+ * ```typescript
964+ * const runloop = new RunloopSDK();
965+ *
966+ * const storageObject = await runloop.storageObject.uploadFromDir(
967+ * './my-agent-code',
968+ * { name: 'agent-package' }
969+ * );
970+ *
971+ * const agent = await runloop.agent.createFromObject({
972+ * name: 'my-object-agent',
973+ * object_id: storageObject.id,
974+ * agent_setup: [
975+ * 'chmod +x setup.sh',
976+ * './setup.sh',
977+ * 'pip install -r requirements.txt'
978+ * ]
979+ * });
980+ * ```
981+ *
982+ * @example
983+ * Complete workflow: storage object → agent → devbox:
984+ * ```typescript
985+ * const runloop = new RunloopSDK();
986+ *
987+ * // 1. Upload agent code
988+ * const storageObject = await runloop.storageObject.uploadFromDir(
989+ * './my-agent',
990+ * { name: 'agent-v1' }
991+ * );
992+ *
993+ * // 2. Create agent from storage object
994+ * const agent = await runloop.agent.createFromObject({
995+ * name: 'my-agent',
996+ * object_id: storageObject.id
997+ * });
998+ *
999+ * // 3. Create devbox with agent mounted
1000+ * const devbox = await runloop.devbox.create({
1001+ * name: 'devbox-with-agent',
1002+ * mounts: [{
1003+ * type: 'agent_mount',
1004+ * agent_id: agent.id,
1005+ * agent_name: null,
1006+ * agent_path: '/home/user/agent'
1007+ * }]
1008+ * });
1009+ * ```
1010+ *
7861011 * @param {object } params - Parameters for creating the agent.
7871012 * @param {string } params.object_id - Storage object ID.
7881013 * @param {string[] } [params.agent_setup] - Setup commands to run after unpacking.
@@ -813,6 +1038,16 @@ export class AgentOps {
8131038 /**
8141039 * Get an agent object by its ID.
8151040 *
1041+ * @example
1042+ * ```typescript
1043+ * const runloop = new RunloopSDK();
1044+ * const agent = runloop.agent.fromId('agt_1234567890');
1045+ *
1046+ * // Get agent information
1047+ * const info = await agent.getInfo();
1048+ * console.log(`Agent name: ${info.name}`);
1049+ * ```
1050+ *
8161051 * @param {string } id - The ID of the agent.
8171052 * @returns {Agent } An {@link Agent} instance.
8181053 */
@@ -823,6 +1058,28 @@ export class AgentOps {
8231058 /**
8241059 * List all agents with optional filters.
8251060 *
1061+ * @example
1062+ * List all agents:
1063+ * ```typescript
1064+ * const runloop = new RunloopSDK();
1065+ * const agents = await runloop.agent.list();
1066+ *
1067+ * for (const agent of agents) {
1068+ * const info = await agent.getInfo();
1069+ * console.log(`${info.name}: ${info.source?.type}`);
1070+ * }
1071+ * ```
1072+ *
1073+ * @example
1074+ * List with filters:
1075+ * ```typescript
1076+ * const runloop = new RunloopSDK();
1077+ * const agents = await runloop.agent.list({
1078+ * name: 'my-agent',
1079+ * limit: 10
1080+ * });
1081+ * ```
1082+ *
8261083 * @param {AgentListParams } [params] - Optional filter parameters.
8271084 * @param {Core.RequestOptions } [options] - Request options.
8281085 * @returns {Promise<Agent[]> } An array of {@link Agent} instances.
@@ -838,8 +1095,8 @@ export class AgentOps {
8381095 * @example
8391096 * ```typescript
8401097 * import { RunloopSDK } from '@runloop/api-client';
841- * const sdk = new RunloopSDK();
842- * const devbox = await sdk .devbox.create({ name: 'my-devbox' });
1098+ * const runloop = new RunloopSDK();
1099+ * const devbox = await runloop .devbox.create({ name: 'my-devbox' });
8431100 * ```
8441101 */
8451102export default Runloop ;
0 commit comments