@salesforce/plugin-agent 1.36.1 → 1.38.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (34) hide show
  1. package/README.md +294 -19
  2. package/lib/agentSessionScanner.d.ts +12 -0
  3. package/lib/agentSessionScanner.js +56 -0
  4. package/lib/agentSessionScanner.js.map +1 -0
  5. package/lib/commands/agent/test/run-eval.d.ts +1 -5
  6. package/lib/commands/agent/test/run-eval.js +54 -149
  7. package/lib/commands/agent/test/run-eval.js.map +1 -1
  8. package/lib/commands/agent/trace/delete.d.ts +21 -0
  9. package/lib/commands/agent/trace/delete.js +118 -0
  10. package/lib/commands/agent/trace/delete.js.map +1 -0
  11. package/lib/commands/agent/trace/list.d.ts +22 -0
  12. package/lib/commands/agent/trace/list.js +101 -0
  13. package/lib/commands/agent/trace/list.js.map +1 -0
  14. package/lib/commands/agent/trace/read.d.ts +75 -0
  15. package/lib/commands/agent/trace/read.js +308 -0
  16. package/lib/commands/agent/trace/read.js.map +1 -0
  17. package/messages/agent.test.run-eval.md +0 -4
  18. package/messages/agent.trace.delete.md +87 -0
  19. package/messages/agent.trace.list.md +87 -0
  20. package/messages/agent.trace.read.md +171 -0
  21. package/oclif.manifest.json +801 -525
  22. package/package.json +4 -4
  23. package/schemas/agent-trace-delete.json +28 -0
  24. package/schemas/agent-trace-list.json +34 -0
  25. package/schemas/agent-trace-read.json +466 -0
  26. package/lib/evalFormatter.d.ts +0 -30
  27. package/lib/evalFormatter.js +0 -263
  28. package/lib/evalFormatter.js.map +0 -1
  29. package/lib/evalNormalizer.d.ts +0 -57
  30. package/lib/evalNormalizer.js +0 -431
  31. package/lib/evalNormalizer.js.map +0 -1
  32. package/lib/yamlSpecTranslator.d.ts +0 -20
  33. package/lib/yamlSpecTranslator.js +0 -227
  34. package/lib/yamlSpecTranslator.js.map +0 -1
@@ -409,16 +409,14 @@
409
409
  "preview:agent"
410
410
  ]
411
411
  },
412
- "agent:generate:agent-spec": {
412
+ "agent:preview:end": {
413
413
  "aliases": [],
414
414
  "args": {},
415
- "description": "An agent spec is a YAML-formatted file that contains basic information about the agent, such as its role, company description, and an AI-generated list of topics based on this information. Topics define the range of jobs your agent can handle.\n\nUse flags, such as --role and --company-description, to provide details about your company and the role that the agent plays in your company. If you prefer, you can also be prompted for the basic information; use --full-interview to be prompted for all required and optional properties. Upon command execution, the large language model (LLM) associated with your org uses the provided information to generate a list of topics for the agent. Because the LLM uses the company and role information to generate the topics, we recommend that you provide accurate, complete, and specific details so the LLM generates the best and most relevant topics. Once generated, you can edit the spec file; for example, you can remove topics that don't apply or change a topic's description.\n\nYou can also iterate the spec generation process by using the --spec flag to pass an existing agent spec file to this command, and then using the --role, --company-description, etc, flags to refine your agent properties. Iteratively improving the description of your agent allows the LLM to generate progressively better topics.\n\nYou can also specify other agent properties, such as a custom prompt template, how to ground the prompt template to add context to the agent's prompts, the tone of the prompts, and the username of a user in the org to assign to the agent.\n\nWhen your agent spec is ready, generate an authoring bundle from it by passing the spec file to the --spec flag of the \"agent generate authoring-bundle\" CLI command. An authoring bundle is a metadata type that contains an Agent Script file, which is the blueprint for an agent. (While not recommended, you can also use the agent spec file to immediately create an agent with the \"agent create\" command. We don't recommend this workflow because these types of agents don't use Agent Script, and are thus less flexible and more difficult to maintain.)",
415
+ "description": "You must have previously started a programmatic agent preview session with the \"agent preview start\" command to then use this command to end it. This command also displays the local directory where the session trace files are stored.\n\nThe original \"agent preview start\" command outputs a session ID which you then use with the --session-id flag of this command to end the session. You don't have to specify the --session-id flag if an agent has only one active preview session. You must also use either the --authoring-bundle or --api-name flag to specify the API name of the authoring bundle or the published agent, respecitvely. To find either API name, navigate to your package directory in your DX project. The API name of an authoring bundle is the same as its directory name under the \"aiAuthoringBundles\" metadata directory. Similarly, the published agent's API name is the same as its directory name under the \"Bots\" metadata directory.",
416
416
  "examples": [
417
- "Generate an agent spec in the default location and use flags to specify the agent properties, such as its role and your company details; use your default org:\n<%= config.bin %> <%= command.id %> --type customer --role \"Field customer complaints and manage employee schedules.\" --company-name \"Coral Cloud Resorts\" --company-description \"Provide customers with exceptional destination activities, unforgettable experiences, and reservation services.\"",
418
- "Generate an agent spec by being prompted for the required agent properties and generate a maxiumum of 5 topics; write the generated file to the \"specs/resortManagerSpec.yaml\" file and use the org with alias \"my-org\":\n<%= config.bin %> <%= command.id %> --max-topics 5 --output-file specs/resortManagerAgent.yaml --target-org my-org",
419
- "Be prompted for all required and optional agent properties; use your default org:\n<%= config.bin %> <%= command.id %> --full-interview",
420
- "Specify an existing agent spec file called \"specs/resortManagerAgent.yaml\", and then overwrite it with a new version that contains newly AI-generated topics based on the updated role information passed in with the --role flag:\n<%= config.bin %> <%= command.id %> --spec specs/resortManagerAgent.yaml --output-file specs/resortManagerAgent.yaml --role \"Field customer complaints, manage employee schedules, and ensure all resort operations are running smoothly\"",
421
- "Specify that the conversational tone of the agent is formal and to attach the \"resortmanager@myorg.com\" username to it; be prompted for the required properties and use your default org:\n<%= config.bin %> <%= command.id %> --tone formal --agent-user resortmanager@myorg.com"
417
+ "End a preview session of a published agent by specifying its session ID and API name ; use the default org:\n<%= config.bin %> <%= command.id %> --session-id <SESSION_ID> --api-name My_Published_Agent",
418
+ "Similar to previous example, but don't specify a session ID; you get an error if the published agent has more than one active session. Use the org with alias \"my-dev-org\":\n<%= config.bin %> <%= command.id %> --api-name My_Published_Agent --target-org my-dev-org",
419
+ "End a preview session of an agent using its authoring bundle API name; you get an error if the agent has more than one active session.\n<%= config.bin %> <%= command.id %> --authoring-bundle My_Local_Agent"
422
420
  ],
423
421
  "flags": {
424
422
  "json": {
@@ -453,164 +451,96 @@
453
451
  "multiple": false,
454
452
  "type": "option"
455
453
  },
456
- "type": {
457
- "name": "type",
458
- "summary": "Type of agent to create. Internal types are copilots used internally by your company and customer types are the agents you create for your customers.",
459
- "hasDynamicHelp": false,
460
- "multiple": false,
461
- "options": [
462
- "customer",
463
- "internal"
464
- ],
465
- "type": "option"
466
- },
467
- "role": {
468
- "name": "role",
469
- "summary": "Role of the agent.",
470
- "hasDynamicHelp": false,
471
- "multiple": false,
472
- "type": "option"
473
- },
474
- "company-name": {
475
- "name": "company-name",
476
- "summary": "Name of your company.",
477
- "hasDynamicHelp": false,
478
- "multiple": false,
479
- "type": "option"
480
- },
481
- "company-description": {
482
- "name": "company-description",
483
- "summary": "Description of your company.",
484
- "hasDynamicHelp": false,
485
- "multiple": false,
486
- "type": "option"
487
- },
488
- "company-website": {
489
- "name": "company-website",
490
- "summary": "Website URL of your company.",
491
- "hasDynamicHelp": false,
492
- "multiple": false,
493
- "type": "option"
494
- },
495
- "max-topics": {
496
- "name": "max-topics",
497
- "summary": "Maximum number of topics to generate in the agent spec; default is 5.",
498
- "hasDynamicHelp": false,
499
- "multiple": false,
500
- "type": "option"
501
- },
502
- "agent-user": {
503
- "name": "agent-user",
504
- "summary": "Username of a user in your org to assign to your agent; determines what your agent can access and do.",
505
- "hasDynamicHelp": false,
506
- "multiple": false,
507
- "type": "option"
508
- },
509
- "enrich-logs": {
510
- "name": "enrich-logs",
511
- "summary": "Adds agent conversation data to event logs so you can view all agent session activity in one place.",
512
- "hasDynamicHelp": false,
513
- "multiple": false,
514
- "options": [
515
- "true",
516
- "false"
517
- ],
518
- "type": "option"
519
- },
520
- "tone": {
521
- "name": "tone",
522
- "summary": "Conversational style of the agent, such as how it expresses your brand personality in its messages through word choice, punctuation, and sentence structure.",
523
- "hasDynamicHelp": false,
524
- "multiple": false,
525
- "options": [
526
- "formal",
527
- "casual",
528
- "neutral"
529
- ],
530
- "type": "option"
531
- },
532
- "spec": {
533
- "name": "spec",
534
- "summary": "Agent spec file, in YAML format, to use as input to the command.",
535
- "hasDynamicHelp": false,
536
- "multiple": false,
537
- "type": "option"
538
- },
539
- "output-file": {
540
- "name": "output-file",
541
- "summary": "Path for the generated YAML agent spec file; can be an absolute or relative path.",
542
- "default": "specs/agentSpec.yaml",
454
+ "session-id": {
455
+ "name": "session-id",
456
+ "required": false,
457
+ "summary": "Session ID outputted by \"agent preview start\". Not required when the agent has exactly one active session. Run \"agent preview sessions\" to see the list of all sessions.",
543
458
  "hasDynamicHelp": false,
544
459
  "multiple": false,
545
460
  "type": "option"
546
461
  },
547
- "full-interview": {
548
- "name": "full-interview",
549
- "summary": "Prompt for both required and optional flags.",
550
- "allowNo": false,
551
- "type": "boolean"
552
- },
553
- "prompt-template": {
554
- "name": "prompt-template",
555
- "summary": "API name of a customized prompt template to use instead of the default prompt template.",
462
+ "api-name": {
463
+ "char": "n",
464
+ "name": "api-name",
465
+ "summary": "API name of the activated published agent you want to preview.",
556
466
  "hasDynamicHelp": false,
557
467
  "multiple": false,
558
468
  "type": "option"
559
469
  },
560
- "grounding-context": {
561
- "dependsOn": [
562
- "prompt-template"
563
- ],
564
- "name": "grounding-context",
565
- "summary": "Context information and personalization that's added to your prompts when using a custom prompt template.",
470
+ "authoring-bundle": {
471
+ "name": "authoring-bundle",
472
+ "summary": "API name of the authoring bundle metadata component that contains the agent's Agent Script file.",
566
473
  "hasDynamicHelp": false,
567
474
  "multiple": false,
568
475
  "type": "option"
569
- },
570
- "force-overwrite": {
571
- "name": "force-overwrite",
572
- "summary": "Don't prompt the user to confirm that an existing spec file will be overwritten.",
573
- "allowNo": false,
574
- "type": "boolean"
575
476
  }
576
477
  },
577
478
  "hasDynamicHelp": true,
578
479
  "hiddenAliases": [],
579
- "id": "agent:generate:agent-spec",
480
+ "id": "agent:preview:end",
580
481
  "pluginAlias": "@salesforce/plugin-agent",
581
482
  "pluginName": "@salesforce/plugin-agent",
582
483
  "pluginType": "core",
583
484
  "strict": true,
584
- "summary": "Generate an agent spec, which is a YAML file that captures what an agent can do.",
485
+ "summary": "End an existing programmatic agent preview session and get trace location.",
585
486
  "enableJsonFlag": true,
586
487
  "requiresProject": true,
488
+ "envVariablesSection": {
489
+ "header": "ENVIRONMENT VARIABLES",
490
+ "body": [
491
+ {
492
+ "name": "SF_TARGET_ORG",
493
+ "description": "Username or alias of your default org. Overrides the target-org configuration variable."
494
+ }
495
+ ]
496
+ },
497
+ "errorCodes": {
498
+ "header": "ERROR CODES",
499
+ "body": [
500
+ {
501
+ "name": "Succeeded (0)",
502
+ "description": "Preview session ended successfully and traces saved."
503
+ },
504
+ {
505
+ "name": "NotFound (2)",
506
+ "description": "Agent not found, or no preview session exists for this agent."
507
+ },
508
+ {
509
+ "name": "PreviewEndFailed (4)",
510
+ "description": "Failed to end the preview session."
511
+ },
512
+ {
513
+ "name": "SessionAmbiguous (5)",
514
+ "description": "Multiple preview sessions found; specify --session-id to choose one."
515
+ }
516
+ ]
517
+ },
587
518
  "isESM": true,
588
519
  "relativePath": [
589
520
  "lib",
590
521
  "commands",
591
522
  "agent",
592
- "generate",
593
- "agent-spec.js"
523
+ "preview",
524
+ "end.js"
594
525
  ],
595
526
  "aliasPermutations": [],
596
527
  "permutations": [
597
- "agent:generate:agent-spec",
598
- "generate:agent:agent-spec",
599
- "generate:agent-spec:agent",
600
- "agent:agent-spec:generate",
601
- "agent-spec:agent:generate",
602
- "agent-spec:generate:agent"
528
+ "agent:preview:end",
529
+ "preview:agent:end",
530
+ "preview:end:agent",
531
+ "agent:end:preview",
532
+ "end:agent:preview",
533
+ "end:preview:agent"
603
534
  ]
604
535
  },
605
- "agent:generate:authoring-bundle": {
536
+ "agent:preview:send": {
606
537
  "aliases": [],
607
538
  "args": {},
608
- "description": "Authoring bundles are metadata components that contain an agent's Agent Script file. The Agent Script file is the agent's blueprint; it fully describes what the agent can do using the Agent Script language.\n\nUse this command to generate a new authoring bundle based on an agent spec YAML file, which you create with the \"agent generate agent-spec\" command. The agent spec YAML file is a high-level description of the agent; it describes its essence rather than exactly what it can do. The resulting Agent Script file is customized to reflect what's in the agent spec file. You can also create an authoring bundle without an agent spec file by specifying the \"--no-spec\" flag; in this case, the resulting Agent Script file is just the default boilerplate.\n\nThe metadata type for authoring bundles is aiAuthoringBundle, which consist of a standard \"<bundle-api-name>.bundle-meta.xml\" metadata file and the Agent Script file (with extension \".agent\"). When you run this command, the new authoring bundle is generated in the force-app/main/default/aiAuthoringBundles/<bundle-api-name> directory. Use the --output-dir flag to generate them elsewhere.\n\nAfter you generate the initial authoring bundle, code the Agent Script file so your agent behaves exactly as you want. The Agent Script file generated by this command is just a first draft of your agent! Interactively test the agent by conversing with it using the \"agent preview\" command. Then publish the agent to your org with the \"agent publish authoring-bundle\" command.\n\nThis command requires an org because it uses it to access an LLM for generating the Agent Script file.",
539
+ "description": "You must have previously started a programmatic agent preview session with the \"agent preview start\" command to then use this command to send the agent a message (utterance). This command then displays the agent's response.\n\nThe original \"agent preview start\" command outputs a session ID which you then use with the --session-id flag of this command to send a message. You don't have to specify the --session-id flag if an agent has only one active preview session. You must also use either the --authoring-bundle or --api-name flag to specify the API name of the authoring bundle or the published agent, respecitvely. To find either API name, navigate to your package directory in your DX project. The API name of an authoring bundle is the same as its directory name under the \"aiAuthoringBundles\" metadata directory. Similarly, the published agent's API name is the same as its directory name under the \"Bots\" metadata directory.",
609
540
  "examples": [
610
- "Generate an authoring bundle by being prompted for all required values, such as the agent spec YAML file, the bundle name, and the API name; use your default org:\n<%= config.bin %> <%= command.id %>",
611
- "Generate an authoring bundle without using an agent spec file; give the bundle the label \"My Authoring Bundle\" and use your default org:\n<%= config.bin %> <%= command.id %> --no-spec --name \"My Authoring Bundle\"",
612
- "Generate an authoring bundle from the \"specs/agentSpec.yaml\" agent spec YAML file and give it the label \"My Authoring Bundle\"; use your default org:\n<%= config.bin %> <%= command.id %> --spec specs/agentSpec.yaml --name \"My Authoring Bundle\"",
613
- "Similar to previous example, but generate the authoring bundle files in the \"other-package-dir/main/default\" package directory; use the org with alias \"my-dev-org\":\n<%= config.bin %> <%= command.id %> --spec specs/agentSpec.yaml --name \"My Authoring Bundle\" --output-dir other-package-dir/main/default --target-org my-dev-org"
541
+ "Send a message to an activated published agent using its API name and session ID; use the default org:\n<%= config.bin %> <%= command.id %> --utterance \"What can you help me with?\" --api-name My_Published_Agent --session-id <SESSION_ID>",
542
+ "Similar to previous example, but don't specify a session ID; you get an error if the agent has more than one active session. Use the org with alias \"my-dev-org\":\n<%= config.bin %> <%= command.id %> --utterance \"What can you help me with?\" --api-name My_Published_Agent --target-org my-dev-org",
543
+ "Send a message to an agent using its authoring bundle API name; you get an error if the agent has more than one active session:\n<%= config.bin %> <%= command.id %> --utterance \"what can you help me with?\" --authoring-bundle My_Local_Agent"
614
544
  ],
615
545
  "flags": {
616
546
  "json": {
@@ -638,13 +568,6 @@
638
568
  "multiple": false,
639
569
  "type": "option"
640
570
  },
641
- "api-name": {
642
- "name": "api-name",
643
- "summary": "API name of the new authoring bundle; if not specified, the API name is derived from the authoring bundle name (label); the API name can't exist in the org.",
644
- "hasDynamicHelp": false,
645
- "multiple": false,
646
- "type": "option"
647
- },
648
571
  "api-version": {
649
572
  "description": "Override the api version used for api requests made by this command",
650
573
  "name": "api-version",
@@ -652,77 +575,103 @@
652
575
  "multiple": false,
653
576
  "type": "option"
654
577
  },
655
- "spec": {
656
- "char": "f",
657
- "name": "spec",
658
- "summary": "Path to the agent spec YAML file. If you don't specify the flag, the command provides a list that you can choose from. Use the --no-spec flag to skip using an agent spec entirely.",
578
+ "session-id": {
579
+ "name": "session-id",
580
+ "required": false,
581
+ "summary": "Session ID outputted by \"agent preview start\". Not required when the agent has exactly one active session. Run \"agent preview sessions\" to see list of all sessions.",
659
582
  "hasDynamicHelp": false,
660
583
  "multiple": false,
661
584
  "type": "option"
662
585
  },
663
- "no-spec": {
664
- "name": "no-spec",
665
- "summary": "Skip prompting for an agent spec and use the default Agent Script boilerplate in the generated authoring bundle.",
666
- "allowNo": false,
667
- "type": "boolean"
668
- },
669
- "output-dir": {
670
- "char": "d",
671
- "name": "output-dir",
672
- "summary": "Directory where the authoring bundle files are generated.",
586
+ "utterance": {
587
+ "char": "u",
588
+ "name": "utterance",
589
+ "required": true,
590
+ "summary": "Utterance to send to the agent, enclosed in double quotes.",
673
591
  "hasDynamicHelp": false,
674
592
  "multiple": false,
675
593
  "type": "option"
676
594
  },
677
- "name": {
595
+ "api-name": {
678
596
  "char": "n",
679
- "name": "name",
680
- "summary": "Name (label) of the authoring bundle; if not specified, you're prompted for the name.",
597
+ "name": "api-name",
598
+ "summary": "API name of the activated published agent you want to preview.",
681
599
  "hasDynamicHelp": false,
682
600
  "multiple": false,
683
601
  "type": "option"
684
602
  },
685
- "force-overwrite": {
686
- "name": "force-overwrite",
687
- "summary": "Overwrite the existing authoring bundle if one with the same API name already exists locally.",
688
- "allowNo": false,
689
- "type": "boolean"
603
+ "authoring-bundle": {
604
+ "name": "authoring-bundle",
605
+ "summary": "API name of the authoring bundle metadata component that contains the agent's Agent Script file.",
606
+ "hasDynamicHelp": false,
607
+ "multiple": false,
608
+ "type": "option"
690
609
  }
691
610
  },
692
611
  "hasDynamicHelp": true,
693
612
  "hiddenAliases": [],
694
- "id": "agent:generate:authoring-bundle",
613
+ "id": "agent:preview:send",
695
614
  "pluginAlias": "@salesforce/plugin-agent",
696
615
  "pluginName": "@salesforce/plugin-agent",
697
616
  "pluginType": "core",
698
617
  "strict": true,
699
- "summary": "Generate an authoring bundle from an existing agent spec YAML file.",
618
+ "summary": "Send a message to an existing agent preview session.",
700
619
  "enableJsonFlag": true,
701
620
  "requiresProject": true,
702
- "isESM": true,
703
- "relativePath": [
704
- "lib",
705
- "commands",
706
- "agent",
707
- "generate",
708
- "authoring-bundle.js"
709
- ],
710
- "aliasPermutations": [],
711
- "permutations": [
712
- "agent:generate:authoring-bundle",
713
- "generate:agent:authoring-bundle",
714
- "generate:authoring-bundle:agent",
715
- "agent:authoring-bundle:generate",
716
- "authoring-bundle:agent:generate",
717
- "authoring-bundle:generate:agent"
621
+ "envVariablesSection": {
622
+ "header": "ENVIRONMENT VARIABLES",
623
+ "body": [
624
+ {
625
+ "name": "SF_TARGET_ORG",
626
+ "description": "Username or alias of your default org. Overrides the target-org configuration variable."
627
+ }
628
+ ]
629
+ },
630
+ "errorCodes": {
631
+ "header": "ERROR CODES",
632
+ "body": [
633
+ {
634
+ "name": "Succeeded (0)",
635
+ "description": "Message sent successfully and agent response received."
636
+ },
637
+ {
638
+ "name": "NotFound (2)",
639
+ "description": "Agent not found, or no preview session exists for this agent."
640
+ },
641
+ {
642
+ "name": "PreviewSendFailed (4)",
643
+ "description": "Failed to send message or receive response from the preview session."
644
+ },
645
+ {
646
+ "name": "SessionAmbiguous (5)",
647
+ "description": "Multiple preview sessions found; specify --session-id to choose one."
648
+ }
649
+ ]
650
+ },
651
+ "isESM": true,
652
+ "relativePath": [
653
+ "lib",
654
+ "commands",
655
+ "agent",
656
+ "preview",
657
+ "send.js"
658
+ ],
659
+ "aliasPermutations": [],
660
+ "permutations": [
661
+ "agent:preview:send",
662
+ "preview:agent:send",
663
+ "preview:send:agent",
664
+ "agent:send:preview",
665
+ "send:agent:preview",
666
+ "send:preview:agent"
718
667
  ]
719
668
  },
720
- "agent:generate:template": {
669
+ "agent:preview:sessions": {
721
670
  "aliases": [],
722
671
  "args": {},
723
- "description": "WARNING: This command doesn't work for agents that were created from an Agent Script file. In other words, you can't currently package an agent template for agents that use Agent Script.\n\nAt a high-level, agents are defined by the Bot, BotVersion, and GenAiPlannerBundle metadata types. The GenAiPlannerBundle type in turn defines the agent's topics and actions. This command uses the metadata files for these three types, located in your local DX project, to generate a BotTemplate metadata file for a specific agent (Bot). You then use the BotTemplate metadata file, along with the GenAiPlannerBundle metadata file that references the BotTemplate, to package the template in a managed package that you can share between orgs or on AppExchange.\n\nUse the --agent-file flag to specify the relative or full pathname of the Bot metadata file, such as force-app/main/default/bots/My_Awesome_Agent/My_Awesome_Agent.bot-meta.xml. A single Bot can have multiple BotVersions, so use the --agent-version flag to specify the version. The corresponding BotVersion metadata file must exist locally. For example, if you specify \"--agent-version 4\", then the file force-app/main/default/bots/My_Awesome_Agent/v4.botVersion-meta.xml must exist.\n\nThe new BotTemplate metadata file is generated in the \"botTemplates\" directory in the output directory specified with the --output-dir flag, and has the name <Agent_API_name>\\_v<Version>\\_Template.botTemplate-meta.xml, such as my-package/botTemplates/My_Awesome_Agent_v4_Template.botTemplate-meta.xml. The command displays the full pathname of the generated files when it completes.\n\nSee \"Develop and Package Agent Templates Using Scratch Orgs\" (https://developer.salesforce.com/docs/atlas.en-us.pkg2_dev.meta/pkg2_dev/dev2gp_package_agent_templates.htm) for details about the complete process, which includes using a scratch org to create and test the agent, retrieving the agent metadata to your DX project, running this command to create the agent template, and then packaging the template.",
672
+ "description": "This command lists the agent preview sessions that were started with the \"agent preview start\" command and are still in the local cache. Use this command to discover specific session IDs that you can pass to the \"agent preview send\" or \"agent preview end\" commands with the --session-id flag.\n\nProgrammatic agent preview sessions can be started for both published activated agents and by using an agent's local authoring bundle, which contains its Agent Script file. In this command's output table, the Agent column contains either the API name of the authoring bundle or the published agent, whichever was used when starting the session. In the table, if the same API name has multiple rows with different session IDs, then it means that you previously started multiple preview sessions with the associated agent.",
724
673
  "examples": [
725
- "Generate an agent template from the My_Awesome_Agent Bot metadata file in your DX project and save the BotTemplate and GenAiPlannerBundle to the specified directory; use version 1 of the agent. The agent that the template is based on is in the org with alias \"my-scratch-org\":\n<%= config.bin %> <%= command.id %> --agent-file force-app/main/default/bots/My_Awesome_Agent/My_Awesome_Agent.bot-meta.xml --agent-version 1 --output-dir my-package --source-org my-scratch-org"
674
+ "List all cached agent preview sessions:\n<%= config.bin %> <%= command.id %>"
726
675
  ],
727
676
  "flags": {
728
677
  "json": {
@@ -739,88 +688,62 @@
739
688
  "hasDynamicHelp": false,
740
689
  "multiple": false,
741
690
  "type": "option"
742
- },
743
- "api-version": {
744
- "description": "Override the api version used for api requests made by this command",
745
- "name": "api-version",
746
- "hasDynamicHelp": false,
747
- "multiple": false,
748
- "type": "option"
749
- },
750
- "source-org": {
751
- "char": "s",
752
- "name": "source-org",
753
- "noCacheDefault": true,
754
- "required": true,
755
- "summary": "Username or alias of the namespaced scratch org that contains the agent which this template is based on.",
756
- "hasDynamicHelp": true,
757
- "multiple": false,
758
- "type": "option"
759
- },
760
- "agent-version": {
761
- "name": "agent-version",
762
- "required": true,
763
- "summary": "Version of the agent (BotVersion).",
764
- "hasDynamicHelp": false,
765
- "multiple": false,
766
- "type": "option"
767
- },
768
- "agent-file": {
769
- "char": "f",
770
- "name": "agent-file",
771
- "required": true,
772
- "summary": "Path to an agent (Bot) metadata file.",
773
- "hasDynamicHelp": false,
774
- "multiple": false,
775
- "type": "option"
776
- },
777
- "output-dir": {
778
- "char": "r",
779
- "name": "output-dir",
780
- "summary": "Directory where the generated BotTemplate and GenAiPlannerBundle files are saved.",
781
- "hasDynamicHelp": false,
782
- "multiple": false,
783
- "type": "option"
784
691
  }
785
692
  },
786
- "hasDynamicHelp": true,
693
+ "hasDynamicHelp": false,
787
694
  "hiddenAliases": [],
788
- "id": "agent:generate:template",
695
+ "id": "agent:preview:sessions",
789
696
  "pluginAlias": "@salesforce/plugin-agent",
790
697
  "pluginName": "@salesforce/plugin-agent",
791
698
  "pluginType": "core",
792
699
  "strict": true,
793
- "summary": "Generate an agent template from an existing agent in your DX project so you can then package the template in a second-generation managed package.",
700
+ "summary": "List all known programmatic agent preview sessions.",
794
701
  "enableJsonFlag": true,
795
702
  "requiresProject": true,
703
+ "errorCodes": {
704
+ "header": "ERROR CODES",
705
+ "body": [
706
+ {
707
+ "name": "Succeeded (0)",
708
+ "description": "Sessions listed successfully (or empty list if no active sessions)."
709
+ }
710
+ ]
711
+ },
796
712
  "isESM": true,
797
713
  "relativePath": [
798
714
  "lib",
799
715
  "commands",
800
716
  "agent",
801
- "generate",
802
- "template.js"
717
+ "preview",
718
+ "sessions.js"
803
719
  ],
804
720
  "aliasPermutations": [],
805
721
  "permutations": [
806
- "agent:generate:template",
807
- "generate:agent:template",
808
- "generate:template:agent",
809
- "agent:template:generate",
810
- "template:agent:generate",
811
- "template:generate:agent"
722
+ "agent:preview:sessions",
723
+ "preview:agent:sessions",
724
+ "preview:sessions:agent",
725
+ "agent:sessions:preview",
726
+ "sessions:agent:preview",
727
+ "sessions:preview:agent"
812
728
  ]
813
729
  },
814
- "agent:generate:test-spec": {
730
+ "agent:preview:start": {
815
731
  "aliases": [],
816
732
  "args": {},
817
- "description": "The first step when using Salesforce CLI to create an agent test in your org is to use this interactive command to generate a local YAML-formatted test spec file. The test spec YAML file contains information about the agent being tested, such as its API name, and then one or more test cases. This command uses the metadata components in your DX project when prompting for information, such as the agent API name; it doesn't look in your org.\n\nTo generate a specific agent test case, this command prompts you for this information; when possible, the command provides a list of options for you to choose from:\n\n- Utterance: Natural language statement, question, or command used to test the agent.\n- Expected topic: API name of the topic you expect the agent to use when responding to the utterance.\n- Expected actions: One or more API names of the expection actions the agent takes.\n- Expected outcome: Natural language description of the outcome you expect.\n- (Optional) Custom evaluation: Test an agent's response for specific strings or numbers.\n- (Optional) Conversation history: Boilerplate for additional context you can add to the test in the form of a conversation history.\n\nYou can manually add contextVariables to test cases in the generated YAML file to inject contextual data (such as CaseId or RoutableId) into agent sessions. This is useful for testing agent behavior with different contextual information.\n\nWhen your test spec is ready, you then run the \"agent test create\" command to actually create the test in your org and synchronize the metadata with your DX project. The metadata type for an agent test is AiEvaluationDefinition.\n\nIf you have an existing AiEvaluationDefinition metadata XML file in your DX project, you can generate its equivalent YAML test spec file with the --from-definition flag.",
733
+ "description": "This command outputs a session ID that you then use with the \"agent preview send\" command to send an utterance to the agent. Use the \"agent preview sessions\" command to list all active sessions and the \"agent preview end\" command to end a specific session.\n\nIdentify the agent you want to start previewing with either the --authoring-bundle flag to specify a local authoring bundle's API name or --api-name to specify an activated published agent's API name. To find either API name, navigate to your package directory in your DX project. The API name of an authoring bundle is the same as its directory name under the \"aiAuthoringBundles\" metadata directory. Similarly, the published agent's API name is the same as its directory name under the \"Bots\" metadata directory.\n\nWhen starting a preview session with --authoring-bundle, you must explicitly specify the execution mode using one of these flags:\n\n- --use-live-actions: Executes real Apex classes, flows, and other actions in the org. This surfaces compile and validation errors during preview.\n- --simulate-actions: Uses AI to simulate action execution without calling real implementations.\n\nPublished agents (--api-name) always use live actions. The mode flags are optional and have no effect for published agents.",
818
734
  "examples": [
819
- "Generate an agent test spec YAML file interactively:\n<%= config.bin %> <%= command.id %>",
820
- "Generate an agent test spec YAML file and specify a name for the new file; if the file exists, overwrite it without confirmation:\n<%= config.bin %> <%= command.id %> --output-file specs/Resort_Manager-new-version-testSpec.yaml --force-overwrite",
821
- "Generate an agent test spec YAML file from an existing AiEvaluationDefinition metadata XML file in your DX project:\n<%= config.bin %> <%= command.id %> --from-definition force-app//main/default/aiEvaluationDefinitions/Resort_Manager_Tests.aiEvaluationDefinition-meta.xml"
735
+ "Start a programmatic agent preview session by specifying an authoring bundle; use simulated actions. Use the org with alias \"my-dev-org\":\n<%= config.bin %> <%= command.id %> --authoring-bundle My_Agent_Bundle --target-org my-dev-org --simulate-actions",
736
+ "Similar to previous example but use live actions and the default org:\n<%= config.bin %> <%= command.id %> --authoring-bundle My_Agent_Bundle --use-live-actions",
737
+ "Start a preview session with an activated published agent (always uses live actions):\n<%= config.bin %> <%= command.id %> --api-name My_Published_Agent"
822
738
  ],
823
739
  "flags": {
740
+ "json": {
741
+ "description": "Format output as json.",
742
+ "helpGroup": "GLOBAL",
743
+ "name": "json",
744
+ "allowNo": false,
745
+ "type": "boolean"
746
+ },
824
747
  "flags-dir": {
825
748
  "helpGroup": "GLOBAL",
826
749
  "name": "flags-dir",
@@ -829,64 +752,140 @@
829
752
  "multiple": false,
830
753
  "type": "option"
831
754
  },
832
- "from-definition": {
833
- "char": "d",
834
- "name": "from-definition",
835
- "summary": "Filepath to the AIEvaluationDefinition metadata XML file in your DX project that you want to convert to a test spec YAML file.",
755
+ "target-org": {
756
+ "char": "o",
757
+ "name": "target-org",
758
+ "noCacheDefault": true,
759
+ "required": true,
760
+ "summary": "Username or alias of the target org. Not required if the `target-org` configuration variable is already set.",
761
+ "hasDynamicHelp": true,
762
+ "multiple": false,
763
+ "type": "option"
764
+ },
765
+ "api-version": {
766
+ "description": "Override the api version used for api requests made by this command",
767
+ "name": "api-version",
836
768
  "hasDynamicHelp": false,
837
769
  "multiple": false,
838
770
  "type": "option"
839
771
  },
840
- "force-overwrite": {
841
- "name": "force-overwrite",
842
- "summary": "Don't prompt for confirmation when overwriting an existing test spec YAML file.",
772
+ "api-name": {
773
+ "char": "n",
774
+ "name": "api-name",
775
+ "summary": "API name of the activated published agent you want to preview.",
776
+ "hasDynamicHelp": false,
777
+ "multiple": false,
778
+ "type": "option"
779
+ },
780
+ "authoring-bundle": {
781
+ "name": "authoring-bundle",
782
+ "summary": "API name of the authoring bundle metadata component that contains the agent's Agent Script file.",
783
+ "hasDynamicHelp": false,
784
+ "multiple": false,
785
+ "type": "option"
786
+ },
787
+ "use-live-actions": {
788
+ "exclusive": [
789
+ "simulate-actions"
790
+ ],
791
+ "name": "use-live-actions",
792
+ "summary": "Execute real actions in the org (Apex classes, flows, etc.). Required with --authoring-bundle.",
843
793
  "allowNo": false,
844
794
  "type": "boolean"
845
795
  },
846
- "output-file": {
847
- "char": "f",
848
- "name": "output-file",
849
- "summary": "Name of the generated test spec YAML file. Default value is \"specs/<AGENT_API_NAME>-testSpec.yaml\".",
796
+ "simulate-actions": {
797
+ "exclusive": [
798
+ "use-live-actions"
799
+ ],
800
+ "name": "simulate-actions",
801
+ "summary": "Use AI to simulate action execution instead of calling real actions. Required with --authoring-bundle.",
802
+ "allowNo": false,
803
+ "type": "boolean"
804
+ },
805
+ "agent-json": {
806
+ "dependsOn": [
807
+ "authoring-bundle"
808
+ ],
809
+ "hidden": true,
810
+ "name": "agent-json",
811
+ "summary": "Path to a pre-compiled AgentJSON file to use instead of compiling the Agent Script file. Intended for internal use and testing.",
850
812
  "hasDynamicHelp": false,
851
813
  "multiple": false,
852
814
  "type": "option"
853
815
  }
854
816
  },
855
- "hasDynamicHelp": false,
817
+ "hasDynamicHelp": true,
856
818
  "hiddenAliases": [],
857
- "id": "agent:generate:test-spec",
819
+ "id": "agent:preview:start",
858
820
  "pluginAlias": "@salesforce/plugin-agent",
859
821
  "pluginName": "@salesforce/plugin-agent",
860
822
  "pluginType": "core",
861
823
  "strict": true,
862
- "summary": "Generate an agent test spec, which is a YAML file that lists the test cases for testing a specific agent.",
863
- "enableJsonFlag": false,
824
+ "summary": "Start a programmatic agent preview session.",
825
+ "enableJsonFlag": true,
826
+ "requiresProject": true,
827
+ "envVariablesSection": {
828
+ "header": "ENVIRONMENT VARIABLES",
829
+ "body": [
830
+ {
831
+ "name": "SF_TARGET_ORG",
832
+ "description": "Username or alias of your default org. Overrides the target-org configuration variable."
833
+ }
834
+ ]
835
+ },
836
+ "errorCodes": {
837
+ "header": "ERROR CODES",
838
+ "body": [
839
+ {
840
+ "name": "Succeeded (0)",
841
+ "description": "Preview session started successfully."
842
+ },
843
+ {
844
+ "name": "Failed (1)",
845
+ "description": "Agent Script compilation failed (syntax errors in the script)."
846
+ },
847
+ {
848
+ "name": "NotFound (2)",
849
+ "description": "Agent not found, or compilation API returned HTTP 404 (endpoint may not be available in your org or region)."
850
+ },
851
+ {
852
+ "name": "ServerError (3)",
853
+ "description": "Compilation API returned HTTP 500 (server error during compilation)."
854
+ },
855
+ {
856
+ "name": "PreviewStartFailed (4)",
857
+ "description": "Preview session failed to start due to API or network errors."
858
+ }
859
+ ]
860
+ },
864
861
  "isESM": true,
865
862
  "relativePath": [
866
863
  "lib",
867
864
  "commands",
868
865
  "agent",
869
- "generate",
870
- "test-spec.js"
866
+ "preview",
867
+ "start.js"
871
868
  ],
872
869
  "aliasPermutations": [],
873
870
  "permutations": [
874
- "agent:generate:test-spec",
875
- "generate:agent:test-spec",
876
- "generate:test-spec:agent",
877
- "agent:test-spec:generate",
878
- "test-spec:agent:generate",
879
- "test-spec:generate:agent"
871
+ "agent:preview:start",
872
+ "preview:agent:start",
873
+ "preview:start:agent",
874
+ "agent:start:preview",
875
+ "start:agent:preview",
876
+ "start:preview:agent"
880
877
  ]
881
878
  },
882
- "agent:preview:end": {
879
+ "agent:generate:agent-spec": {
883
880
  "aliases": [],
884
881
  "args": {},
885
- "description": "You must have previously started a programmatic agent preview session with the \"agent preview start\" command to then use this command to end it. This command also displays the local directory where the session trace files are stored.\n\nThe original \"agent preview start\" command outputs a session ID which you then use with the --session-id flag of this command to end the session. You don't have to specify the --session-id flag if an agent has only one active preview session. You must also use either the --authoring-bundle or --api-name flag to specify the API name of the authoring bundle or the published agent, respecitvely. To find either API name, navigate to your package directory in your DX project. The API name of an authoring bundle is the same as its directory name under the \"aiAuthoringBundles\" metadata directory. Similarly, the published agent's API name is the same as its directory name under the \"Bots\" metadata directory.",
882
+ "description": "An agent spec is a YAML-formatted file that contains basic information about the agent, such as its role, company description, and an AI-generated list of topics based on this information. Topics define the range of jobs your agent can handle.\n\nUse flags, such as --role and --company-description, to provide details about your company and the role that the agent plays in your company. If you prefer, you can also be prompted for the basic information; use --full-interview to be prompted for all required and optional properties. Upon command execution, the large language model (LLM) associated with your org uses the provided information to generate a list of topics for the agent. Because the LLM uses the company and role information to generate the topics, we recommend that you provide accurate, complete, and specific details so the LLM generates the best and most relevant topics. Once generated, you can edit the spec file; for example, you can remove topics that don't apply or change a topic's description.\n\nYou can also iterate the spec generation process by using the --spec flag to pass an existing agent spec file to this command, and then using the --role, --company-description, etc, flags to refine your agent properties. Iteratively improving the description of your agent allows the LLM to generate progressively better topics.\n\nYou can also specify other agent properties, such as a custom prompt template, how to ground the prompt template to add context to the agent's prompts, the tone of the prompts, and the username of a user in the org to assign to the agent.\n\nWhen your agent spec is ready, generate an authoring bundle from it by passing the spec file to the --spec flag of the \"agent generate authoring-bundle\" CLI command. An authoring bundle is a metadata type that contains an Agent Script file, which is the blueprint for an agent. (While not recommended, you can also use the agent spec file to immediately create an agent with the \"agent create\" command. We don't recommend this workflow because these types of agents don't use Agent Script, and are thus less flexible and more difficult to maintain.)",
886
883
  "examples": [
887
- "End a preview session of a published agent by specifying its session ID and API name ; use the default org:\n<%= config.bin %> <%= command.id %> --session-id <SESSION_ID> --api-name My_Published_Agent",
888
- "Similar to previous example, but don't specify a session ID; you get an error if the published agent has more than one active session. Use the org with alias \"my-dev-org\":\n<%= config.bin %> <%= command.id %> --api-name My_Published_Agent --target-org my-dev-org",
889
- "End a preview session of an agent using its authoring bundle API name; you get an error if the agent has more than one active session.\n<%= config.bin %> <%= command.id %> --authoring-bundle My_Local_Agent"
884
+ "Generate an agent spec in the default location and use flags to specify the agent properties, such as its role and your company details; use your default org:\n<%= config.bin %> <%= command.id %> --type customer --role \"Field customer complaints and manage employee schedules.\" --company-name \"Coral Cloud Resorts\" --company-description \"Provide customers with exceptional destination activities, unforgettable experiences, and reservation services.\"",
885
+ "Generate an agent spec by being prompted for the required agent properties and generate a maxiumum of 5 topics; write the generated file to the \"specs/resortManagerSpec.yaml\" file and use the org with alias \"my-org\":\n<%= config.bin %> <%= command.id %> --max-topics 5 --output-file specs/resortManagerAgent.yaml --target-org my-org",
886
+ "Be prompted for all required and optional agent properties; use your default org:\n<%= config.bin %> <%= command.id %> --full-interview",
887
+ "Specify an existing agent spec file called \"specs/resortManagerAgent.yaml\", and then overwrite it with a new version that contains newly AI-generated topics based on the updated role information passed in with the --role flag:\n<%= config.bin %> <%= command.id %> --spec specs/resortManagerAgent.yaml --output-file specs/resortManagerAgent.yaml --role \"Field customer complaints, manage employee schedules, and ensure all resort operations are running smoothly\"",
888
+ "Specify that the conversational tone of the agent is formal and to attach the \"resortmanager@myorg.com\" username to it; be prompted for the required properties and use your default org:\n<%= config.bin %> <%= command.id %> --tone formal --agent-user resortmanager@myorg.com"
890
889
  ],
891
890
  "flags": {
892
891
  "json": {
@@ -921,96 +920,164 @@
921
920
  "multiple": false,
922
921
  "type": "option"
923
922
  },
924
- "session-id": {
925
- "name": "session-id",
926
- "required": false,
927
- "summary": "Session ID outputted by \"agent preview start\". Not required when the agent has exactly one active session. Run \"agent preview sessions\" to see the list of all sessions.",
923
+ "type": {
924
+ "name": "type",
925
+ "summary": "Type of agent to create. Internal types are copilots used internally by your company and customer types are the agents you create for your customers.",
926
+ "hasDynamicHelp": false,
927
+ "multiple": false,
928
+ "options": [
929
+ "customer",
930
+ "internal"
931
+ ],
932
+ "type": "option"
933
+ },
934
+ "role": {
935
+ "name": "role",
936
+ "summary": "Role of the agent.",
928
937
  "hasDynamicHelp": false,
929
938
  "multiple": false,
930
939
  "type": "option"
931
940
  },
932
- "api-name": {
933
- "char": "n",
934
- "name": "api-name",
935
- "summary": "API name of the activated published agent you want to preview.",
941
+ "company-name": {
942
+ "name": "company-name",
943
+ "summary": "Name of your company.",
936
944
  "hasDynamicHelp": false,
937
945
  "multiple": false,
938
946
  "type": "option"
939
947
  },
940
- "authoring-bundle": {
941
- "name": "authoring-bundle",
942
- "summary": "API name of the authoring bundle metadata component that contains the agent's Agent Script file.",
948
+ "company-description": {
949
+ "name": "company-description",
950
+ "summary": "Description of your company.",
951
+ "hasDynamicHelp": false,
952
+ "multiple": false,
953
+ "type": "option"
954
+ },
955
+ "company-website": {
956
+ "name": "company-website",
957
+ "summary": "Website URL of your company.",
958
+ "hasDynamicHelp": false,
959
+ "multiple": false,
960
+ "type": "option"
961
+ },
962
+ "max-topics": {
963
+ "name": "max-topics",
964
+ "summary": "Maximum number of topics to generate in the agent spec; default is 5.",
965
+ "hasDynamicHelp": false,
966
+ "multiple": false,
967
+ "type": "option"
968
+ },
969
+ "agent-user": {
970
+ "name": "agent-user",
971
+ "summary": "Username of a user in your org to assign to your agent; determines what your agent can access and do.",
972
+ "hasDynamicHelp": false,
973
+ "multiple": false,
974
+ "type": "option"
975
+ },
976
+ "enrich-logs": {
977
+ "name": "enrich-logs",
978
+ "summary": "Adds agent conversation data to event logs so you can view all agent session activity in one place.",
979
+ "hasDynamicHelp": false,
980
+ "multiple": false,
981
+ "options": [
982
+ "true",
983
+ "false"
984
+ ],
985
+ "type": "option"
986
+ },
987
+ "tone": {
988
+ "name": "tone",
989
+ "summary": "Conversational style of the agent, such as how it expresses your brand personality in its messages through word choice, punctuation, and sentence structure.",
943
990
  "hasDynamicHelp": false,
944
991
  "multiple": false,
992
+ "options": [
993
+ "formal",
994
+ "casual",
995
+ "neutral"
996
+ ],
945
997
  "type": "option"
998
+ },
999
+ "spec": {
1000
+ "name": "spec",
1001
+ "summary": "Agent spec file, in YAML format, to use as input to the command.",
1002
+ "hasDynamicHelp": false,
1003
+ "multiple": false,
1004
+ "type": "option"
1005
+ },
1006
+ "output-file": {
1007
+ "name": "output-file",
1008
+ "summary": "Path for the generated YAML agent spec file; can be an absolute or relative path.",
1009
+ "default": "specs/agentSpec.yaml",
1010
+ "hasDynamicHelp": false,
1011
+ "multiple": false,
1012
+ "type": "option"
1013
+ },
1014
+ "full-interview": {
1015
+ "name": "full-interview",
1016
+ "summary": "Prompt for both required and optional flags.",
1017
+ "allowNo": false,
1018
+ "type": "boolean"
1019
+ },
1020
+ "prompt-template": {
1021
+ "name": "prompt-template",
1022
+ "summary": "API name of a customized prompt template to use instead of the default prompt template.",
1023
+ "hasDynamicHelp": false,
1024
+ "multiple": false,
1025
+ "type": "option"
1026
+ },
1027
+ "grounding-context": {
1028
+ "dependsOn": [
1029
+ "prompt-template"
1030
+ ],
1031
+ "name": "grounding-context",
1032
+ "summary": "Context information and personalization that's added to your prompts when using a custom prompt template.",
1033
+ "hasDynamicHelp": false,
1034
+ "multiple": false,
1035
+ "type": "option"
1036
+ },
1037
+ "force-overwrite": {
1038
+ "name": "force-overwrite",
1039
+ "summary": "Don't prompt the user to confirm that an existing spec file will be overwritten.",
1040
+ "allowNo": false,
1041
+ "type": "boolean"
946
1042
  }
947
1043
  },
948
1044
  "hasDynamicHelp": true,
949
1045
  "hiddenAliases": [],
950
- "id": "agent:preview:end",
1046
+ "id": "agent:generate:agent-spec",
951
1047
  "pluginAlias": "@salesforce/plugin-agent",
952
1048
  "pluginName": "@salesforce/plugin-agent",
953
1049
  "pluginType": "core",
954
1050
  "strict": true,
955
- "summary": "End an existing programmatic agent preview session and get trace location.",
1051
+ "summary": "Generate an agent spec, which is a YAML file that captures what an agent can do.",
956
1052
  "enableJsonFlag": true,
957
1053
  "requiresProject": true,
958
- "envVariablesSection": {
959
- "header": "ENVIRONMENT VARIABLES",
960
- "body": [
961
- {
962
- "name": "SF_TARGET_ORG",
963
- "description": "Username or alias of your default org. Overrides the target-org configuration variable."
964
- }
965
- ]
966
- },
967
- "errorCodes": {
968
- "header": "ERROR CODES",
969
- "body": [
970
- {
971
- "name": "Succeeded (0)",
972
- "description": "Preview session ended successfully and traces saved."
973
- },
974
- {
975
- "name": "NotFound (2)",
976
- "description": "Agent not found, or no preview session exists for this agent."
977
- },
978
- {
979
- "name": "PreviewEndFailed (4)",
980
- "description": "Failed to end the preview session."
981
- },
982
- {
983
- "name": "SessionAmbiguous (5)",
984
- "description": "Multiple preview sessions found; specify --session-id to choose one."
985
- }
986
- ]
987
- },
988
1054
  "isESM": true,
989
1055
  "relativePath": [
990
1056
  "lib",
991
1057
  "commands",
992
1058
  "agent",
993
- "preview",
994
- "end.js"
1059
+ "generate",
1060
+ "agent-spec.js"
995
1061
  ],
996
1062
  "aliasPermutations": [],
997
1063
  "permutations": [
998
- "agent:preview:end",
999
- "preview:agent:end",
1000
- "preview:end:agent",
1001
- "agent:end:preview",
1002
- "end:agent:preview",
1003
- "end:preview:agent"
1064
+ "agent:generate:agent-spec",
1065
+ "generate:agent:agent-spec",
1066
+ "generate:agent-spec:agent",
1067
+ "agent:agent-spec:generate",
1068
+ "agent-spec:agent:generate",
1069
+ "agent-spec:generate:agent"
1004
1070
  ]
1005
1071
  },
1006
- "agent:preview:send": {
1072
+ "agent:generate:authoring-bundle": {
1007
1073
  "aliases": [],
1008
1074
  "args": {},
1009
- "description": "You must have previously started a programmatic agent preview session with the \"agent preview start\" command to then use this command to send the agent a message (utterance). This command then displays the agent's response.\n\nThe original \"agent preview start\" command outputs a session ID which you then use with the --session-id flag of this command to send a message. You don't have to specify the --session-id flag if an agent has only one active preview session. You must also use either the --authoring-bundle or --api-name flag to specify the API name of the authoring bundle or the published agent, respecitvely. To find either API name, navigate to your package directory in your DX project. The API name of an authoring bundle is the same as its directory name under the \"aiAuthoringBundles\" metadata directory. Similarly, the published agent's API name is the same as its directory name under the \"Bots\" metadata directory.",
1075
+ "description": "Authoring bundles are metadata components that contain an agent's Agent Script file. The Agent Script file is the agent's blueprint; it fully describes what the agent can do using the Agent Script language.\n\nUse this command to generate a new authoring bundle based on an agent spec YAML file, which you create with the \"agent generate agent-spec\" command. The agent spec YAML file is a high-level description of the agent; it describes its essence rather than exactly what it can do. The resulting Agent Script file is customized to reflect what's in the agent spec file. You can also create an authoring bundle without an agent spec file by specifying the \"--no-spec\" flag; in this case, the resulting Agent Script file is just the default boilerplate.\n\nThe metadata type for authoring bundles is aiAuthoringBundle, which consist of a standard \"<bundle-api-name>.bundle-meta.xml\" metadata file and the Agent Script file (with extension \".agent\"). When you run this command, the new authoring bundle is generated in the force-app/main/default/aiAuthoringBundles/<bundle-api-name> directory. Use the --output-dir flag to generate them elsewhere.\n\nAfter you generate the initial authoring bundle, code the Agent Script file so your agent behaves exactly as you want. The Agent Script file generated by this command is just a first draft of your agent! Interactively test the agent by conversing with it using the \"agent preview\" command. Then publish the agent to your org with the \"agent publish authoring-bundle\" command.\n\nThis command requires an org because it uses it to access an LLM for generating the Agent Script file.",
1010
1076
  "examples": [
1011
- "Send a message to an activated published agent using its API name and session ID; use the default org:\n<%= config.bin %> <%= command.id %> --utterance \"What can you help me with?\" --api-name My_Published_Agent --session-id <SESSION_ID>",
1012
- "Similar to previous example, but don't specify a session ID; you get an error if the agent has more than one active session. Use the org with alias \"my-dev-org\":\n<%= config.bin %> <%= command.id %> --utterance \"What can you help me with?\" --api-name My_Published_Agent --target-org my-dev-org",
1013
- "Send a message to an agent using its authoring bundle API name; you get an error if the agent has more than one active session:\n<%= config.bin %> <%= command.id %> --utterance \"what can you help me with?\" --authoring-bundle My_Local_Agent"
1077
+ "Generate an authoring bundle by being prompted for all required values, such as the agent spec YAML file, the bundle name, and the API name; use your default org:\n<%= config.bin %> <%= command.id %>",
1078
+ "Generate an authoring bundle without using an agent spec file; give the bundle the label \"My Authoring Bundle\" and use your default org:\n<%= config.bin %> <%= command.id %> --no-spec --name \"My Authoring Bundle\"",
1079
+ "Generate an authoring bundle from the \"specs/agentSpec.yaml\" agent spec YAML file and give it the label \"My Authoring Bundle\"; use your default org:\n<%= config.bin %> <%= command.id %> --spec specs/agentSpec.yaml --name \"My Authoring Bundle\"",
1080
+ "Similar to previous example, but generate the authoring bundle files in the \"other-package-dir/main/default\" package directory; use the org with alias \"my-dev-org\":\n<%= config.bin %> <%= command.id %> --spec specs/agentSpec.yaml --name \"My Authoring Bundle\" --output-dir other-package-dir/main/default --target-org my-dev-org"
1014
1081
  ],
1015
1082
  "flags": {
1016
1083
  "json": {
@@ -1038,6 +1105,13 @@
1038
1105
  "multiple": false,
1039
1106
  "type": "option"
1040
1107
  },
1108
+ "api-name": {
1109
+ "name": "api-name",
1110
+ "summary": "API name of the new authoring bundle; if not specified, the API name is derived from the authoring bundle name (label); the API name can't exist in the org.",
1111
+ "hasDynamicHelp": false,
1112
+ "multiple": false,
1113
+ "type": "option"
1114
+ },
1041
1115
  "api-version": {
1042
1116
  "description": "Override the api version used for api requests made by this command",
1043
1117
  "name": "api-version",
@@ -1045,103 +1119,77 @@
1045
1119
  "multiple": false,
1046
1120
  "type": "option"
1047
1121
  },
1048
- "session-id": {
1049
- "name": "session-id",
1050
- "required": false,
1051
- "summary": "Session ID outputted by \"agent preview start\". Not required when the agent has exactly one active session. Run \"agent preview sessions\" to see list of all sessions.",
1122
+ "spec": {
1123
+ "char": "f",
1124
+ "name": "spec",
1125
+ "summary": "Path to the agent spec YAML file. If you don't specify the flag, the command provides a list that you can choose from. Use the --no-spec flag to skip using an agent spec entirely.",
1052
1126
  "hasDynamicHelp": false,
1053
1127
  "multiple": false,
1054
1128
  "type": "option"
1055
1129
  },
1056
- "utterance": {
1057
- "char": "u",
1058
- "name": "utterance",
1059
- "required": true,
1060
- "summary": "Utterance to send to the agent, enclosed in double quotes.",
1130
+ "no-spec": {
1131
+ "name": "no-spec",
1132
+ "summary": "Skip prompting for an agent spec and use the default Agent Script boilerplate in the generated authoring bundle.",
1133
+ "allowNo": false,
1134
+ "type": "boolean"
1135
+ },
1136
+ "output-dir": {
1137
+ "char": "d",
1138
+ "name": "output-dir",
1139
+ "summary": "Directory where the authoring bundle files are generated.",
1061
1140
  "hasDynamicHelp": false,
1062
1141
  "multiple": false,
1063
1142
  "type": "option"
1064
1143
  },
1065
- "api-name": {
1144
+ "name": {
1066
1145
  "char": "n",
1067
- "name": "api-name",
1068
- "summary": "API name of the activated published agent you want to preview.",
1146
+ "name": "name",
1147
+ "summary": "Name (label) of the authoring bundle; if not specified, you're prompted for the name.",
1069
1148
  "hasDynamicHelp": false,
1070
1149
  "multiple": false,
1071
1150
  "type": "option"
1072
1151
  },
1073
- "authoring-bundle": {
1074
- "name": "authoring-bundle",
1075
- "summary": "API name of the authoring bundle metadata component that contains the agent's Agent Script file.",
1076
- "hasDynamicHelp": false,
1077
- "multiple": false,
1078
- "type": "option"
1152
+ "force-overwrite": {
1153
+ "name": "force-overwrite",
1154
+ "summary": "Overwrite the existing authoring bundle if one with the same API name already exists locally.",
1155
+ "allowNo": false,
1156
+ "type": "boolean"
1079
1157
  }
1080
1158
  },
1081
1159
  "hasDynamicHelp": true,
1082
1160
  "hiddenAliases": [],
1083
- "id": "agent:preview:send",
1161
+ "id": "agent:generate:authoring-bundle",
1084
1162
  "pluginAlias": "@salesforce/plugin-agent",
1085
1163
  "pluginName": "@salesforce/plugin-agent",
1086
1164
  "pluginType": "core",
1087
1165
  "strict": true,
1088
- "summary": "Send a message to an existing agent preview session.",
1166
+ "summary": "Generate an authoring bundle from an existing agent spec YAML file.",
1089
1167
  "enableJsonFlag": true,
1090
1168
  "requiresProject": true,
1091
- "envVariablesSection": {
1092
- "header": "ENVIRONMENT VARIABLES",
1093
- "body": [
1094
- {
1095
- "name": "SF_TARGET_ORG",
1096
- "description": "Username or alias of your default org. Overrides the target-org configuration variable."
1097
- }
1098
- ]
1099
- },
1100
- "errorCodes": {
1101
- "header": "ERROR CODES",
1102
- "body": [
1103
- {
1104
- "name": "Succeeded (0)",
1105
- "description": "Message sent successfully and agent response received."
1106
- },
1107
- {
1108
- "name": "NotFound (2)",
1109
- "description": "Agent not found, or no preview session exists for this agent."
1110
- },
1111
- {
1112
- "name": "PreviewSendFailed (4)",
1113
- "description": "Failed to send message or receive response from the preview session."
1114
- },
1115
- {
1116
- "name": "SessionAmbiguous (5)",
1117
- "description": "Multiple preview sessions found; specify --session-id to choose one."
1118
- }
1119
- ]
1120
- },
1121
1169
  "isESM": true,
1122
1170
  "relativePath": [
1123
1171
  "lib",
1124
1172
  "commands",
1125
1173
  "agent",
1126
- "preview",
1127
- "send.js"
1174
+ "generate",
1175
+ "authoring-bundle.js"
1128
1176
  ],
1129
1177
  "aliasPermutations": [],
1130
1178
  "permutations": [
1131
- "agent:preview:send",
1132
- "preview:agent:send",
1133
- "preview:send:agent",
1134
- "agent:send:preview",
1135
- "send:agent:preview",
1136
- "send:preview:agent"
1179
+ "agent:generate:authoring-bundle",
1180
+ "generate:agent:authoring-bundle",
1181
+ "generate:authoring-bundle:agent",
1182
+ "agent:authoring-bundle:generate",
1183
+ "authoring-bundle:agent:generate",
1184
+ "authoring-bundle:generate:agent"
1137
1185
  ]
1138
1186
  },
1139
- "agent:preview:sessions": {
1187
+ "agent:generate:template": {
1140
1188
  "aliases": [],
1141
1189
  "args": {},
1142
- "description": "This command lists the agent preview sessions that were started with the \"agent preview start\" command and are still in the local cache. Use this command to discover specific session IDs that you can pass to the \"agent preview send\" or \"agent preview end\" commands with the --session-id flag.\n\nProgrammatic agent preview sessions can be started for both published activated agents and by using an agent's local authoring bundle, which contains its Agent Script file. In this command's output table, the Agent column contains either the API name of the authoring bundle or the published agent, whichever was used when starting the session. In the table, if the same API name has multiple rows with different session IDs, then it means that you previously started multiple preview sessions with the associated agent.",
1190
+ "description": "WARNING: This command doesn't work for agents that were created from an Agent Script file. In other words, you can't currently package an agent template for agents that use Agent Script.\n\nAt a high-level, agents are defined by the Bot, BotVersion, and GenAiPlannerBundle metadata types. The GenAiPlannerBundle type in turn defines the agent's topics and actions. This command uses the metadata files for these three types, located in your local DX project, to generate a BotTemplate metadata file for a specific agent (Bot). You then use the BotTemplate metadata file, along with the GenAiPlannerBundle metadata file that references the BotTemplate, to package the template in a managed package that you can share between orgs or on AppExchange.\n\nUse the --agent-file flag to specify the relative or full pathname of the Bot metadata file, such as force-app/main/default/bots/My_Awesome_Agent/My_Awesome_Agent.bot-meta.xml. A single Bot can have multiple BotVersions, so use the --agent-version flag to specify the version. The corresponding BotVersion metadata file must exist locally. For example, if you specify \"--agent-version 4\", then the file force-app/main/default/bots/My_Awesome_Agent/v4.botVersion-meta.xml must exist.\n\nThe new BotTemplate metadata file is generated in the \"botTemplates\" directory in the output directory specified with the --output-dir flag, and has the name <Agent_API_name>\\_v<Version>\\_Template.botTemplate-meta.xml, such as my-package/botTemplates/My_Awesome_Agent_v4_Template.botTemplate-meta.xml. The command displays the full pathname of the generated files when it completes.\n\nSee \"Develop and Package Agent Templates Using Scratch Orgs\" (https://developer.salesforce.com/docs/atlas.en-us.pkg2_dev.meta/pkg2_dev/dev2gp_package_agent_templates.htm) for details about the complete process, which includes using a scratch org to create and test the agent, retrieving the agent metadata to your DX project, running this command to create the agent template, and then packaging the template.",
1143
1191
  "examples": [
1144
- "List all cached agent preview sessions:\n<%= config.bin %> <%= command.id %>"
1192
+ "Generate an agent template from the My_Awesome_Agent Bot metadata file in your DX project and save the BotTemplate and GenAiPlannerBundle to the specified directory; use version 1 of the agent. The agent that the template is based on is in the org with alias \"my-scratch-org\":\n<%= config.bin %> <%= command.id %> --agent-file force-app/main/default/bots/My_Awesome_Agent/My_Awesome_Agent.bot-meta.xml --agent-version 1 --output-dir my-package --source-org my-scratch-org"
1145
1193
  ],
1146
1194
  "flags": {
1147
1195
  "json": {
@@ -1158,62 +1206,88 @@
1158
1206
  "hasDynamicHelp": false,
1159
1207
  "multiple": false,
1160
1208
  "type": "option"
1209
+ },
1210
+ "api-version": {
1211
+ "description": "Override the api version used for api requests made by this command",
1212
+ "name": "api-version",
1213
+ "hasDynamicHelp": false,
1214
+ "multiple": false,
1215
+ "type": "option"
1216
+ },
1217
+ "source-org": {
1218
+ "char": "s",
1219
+ "name": "source-org",
1220
+ "noCacheDefault": true,
1221
+ "required": true,
1222
+ "summary": "Username or alias of the namespaced scratch org that contains the agent which this template is based on.",
1223
+ "hasDynamicHelp": true,
1224
+ "multiple": false,
1225
+ "type": "option"
1226
+ },
1227
+ "agent-version": {
1228
+ "name": "agent-version",
1229
+ "required": true,
1230
+ "summary": "Version of the agent (BotVersion).",
1231
+ "hasDynamicHelp": false,
1232
+ "multiple": false,
1233
+ "type": "option"
1234
+ },
1235
+ "agent-file": {
1236
+ "char": "f",
1237
+ "name": "agent-file",
1238
+ "required": true,
1239
+ "summary": "Path to an agent (Bot) metadata file.",
1240
+ "hasDynamicHelp": false,
1241
+ "multiple": false,
1242
+ "type": "option"
1243
+ },
1244
+ "output-dir": {
1245
+ "char": "r",
1246
+ "name": "output-dir",
1247
+ "summary": "Directory where the generated BotTemplate and GenAiPlannerBundle files are saved.",
1248
+ "hasDynamicHelp": false,
1249
+ "multiple": false,
1250
+ "type": "option"
1161
1251
  }
1162
1252
  },
1163
- "hasDynamicHelp": false,
1253
+ "hasDynamicHelp": true,
1164
1254
  "hiddenAliases": [],
1165
- "id": "agent:preview:sessions",
1255
+ "id": "agent:generate:template",
1166
1256
  "pluginAlias": "@salesforce/plugin-agent",
1167
1257
  "pluginName": "@salesforce/plugin-agent",
1168
1258
  "pluginType": "core",
1169
1259
  "strict": true,
1170
- "summary": "List all known programmatic agent preview sessions.",
1260
+ "summary": "Generate an agent template from an existing agent in your DX project so you can then package the template in a second-generation managed package.",
1171
1261
  "enableJsonFlag": true,
1172
1262
  "requiresProject": true,
1173
- "errorCodes": {
1174
- "header": "ERROR CODES",
1175
- "body": [
1176
- {
1177
- "name": "Succeeded (0)",
1178
- "description": "Sessions listed successfully (or empty list if no active sessions)."
1179
- }
1180
- ]
1181
- },
1182
1263
  "isESM": true,
1183
1264
  "relativePath": [
1184
1265
  "lib",
1185
1266
  "commands",
1186
1267
  "agent",
1187
- "preview",
1188
- "sessions.js"
1268
+ "generate",
1269
+ "template.js"
1189
1270
  ],
1190
1271
  "aliasPermutations": [],
1191
1272
  "permutations": [
1192
- "agent:preview:sessions",
1193
- "preview:agent:sessions",
1194
- "preview:sessions:agent",
1195
- "agent:sessions:preview",
1196
- "sessions:agent:preview",
1197
- "sessions:preview:agent"
1273
+ "agent:generate:template",
1274
+ "generate:agent:template",
1275
+ "generate:template:agent",
1276
+ "agent:template:generate",
1277
+ "template:agent:generate",
1278
+ "template:generate:agent"
1198
1279
  ]
1199
1280
  },
1200
- "agent:preview:start": {
1281
+ "agent:generate:test-spec": {
1201
1282
  "aliases": [],
1202
1283
  "args": {},
1203
- "description": "This command outputs a session ID that you then use with the \"agent preview send\" command to send an utterance to the agent. Use the \"agent preview sessions\" command to list all active sessions and the \"agent preview end\" command to end a specific session.\n\nIdentify the agent you want to start previewing with either the --authoring-bundle flag to specify a local authoring bundle's API name or --api-name to specify an activated published agent's API name. To find either API name, navigate to your package directory in your DX project. The API name of an authoring bundle is the same as its directory name under the \"aiAuthoringBundles\" metadata directory. Similarly, the published agent's API name is the same as its directory name under the \"Bots\" metadata directory.\n\nWhen starting a preview session with --authoring-bundle, you must explicitly specify the execution mode using one of these flags:\n\n- --use-live-actions: Executes real Apex classes, flows, and other actions in the org. This surfaces compile and validation errors during preview.\n- --simulate-actions: Uses AI to simulate action execution without calling real implementations.\n\nPublished agents (--api-name) always use live actions. The mode flags are optional and have no effect for published agents.",
1284
+ "description": "The first step when using Salesforce CLI to create an agent test in your org is to use this interactive command to generate a local YAML-formatted test spec file. The test spec YAML file contains information about the agent being tested, such as its API name, and then one or more test cases. This command uses the metadata components in your DX project when prompting for information, such as the agent API name; it doesn't look in your org.\n\nTo generate a specific agent test case, this command prompts you for this information; when possible, the command provides a list of options for you to choose from:\n\n- Utterance: Natural language statement, question, or command used to test the agent.\n- Expected topic: API name of the topic you expect the agent to use when responding to the utterance.\n- Expected actions: One or more API names of the expection actions the agent takes.\n- Expected outcome: Natural language description of the outcome you expect.\n- (Optional) Custom evaluation: Test an agent's response for specific strings or numbers.\n- (Optional) Conversation history: Boilerplate for additional context you can add to the test in the form of a conversation history.\n\nYou can manually add contextVariables to test cases in the generated YAML file to inject contextual data (such as CaseId or RoutableId) into agent sessions. This is useful for testing agent behavior with different contextual information.\n\nWhen your test spec is ready, you then run the \"agent test create\" command to actually create the test in your org and synchronize the metadata with your DX project. The metadata type for an agent test is AiEvaluationDefinition.\n\nIf you have an existing AiEvaluationDefinition metadata XML file in your DX project, you can generate its equivalent YAML test spec file with the --from-definition flag.",
1204
1285
  "examples": [
1205
- "Start a programmatic agent preview session by specifying an authoring bundle; use simulated actions. Use the org with alias \"my-dev-org\":\n<%= config.bin %> <%= command.id %> --authoring-bundle My_Agent_Bundle --target-org my-dev-org --simulate-actions",
1206
- "Similar to previous example but use live actions and the default org:\n<%= config.bin %> <%= command.id %> --authoring-bundle My_Agent_Bundle --use-live-actions",
1207
- "Start a preview session with an activated published agent (always uses live actions):\n<%= config.bin %> <%= command.id %> --api-name My_Published_Agent"
1286
+ "Generate an agent test spec YAML file interactively:\n<%= config.bin %> <%= command.id %>",
1287
+ "Generate an agent test spec YAML file and specify a name for the new file; if the file exists, overwrite it without confirmation:\n<%= config.bin %> <%= command.id %> --output-file specs/Resort_Manager-new-version-testSpec.yaml --force-overwrite",
1288
+ "Generate an agent test spec YAML file from an existing AiEvaluationDefinition metadata XML file in your DX project:\n<%= config.bin %> <%= command.id %> --from-definition force-app//main/default/aiEvaluationDefinitions/Resort_Manager_Tests.aiEvaluationDefinition-meta.xml"
1208
1289
  ],
1209
1290
  "flags": {
1210
- "json": {
1211
- "description": "Format output as json.",
1212
- "helpGroup": "GLOBAL",
1213
- "name": "json",
1214
- "allowNo": false,
1215
- "type": "boolean"
1216
- },
1217
1291
  "flags-dir": {
1218
1292
  "helpGroup": "GLOBAL",
1219
1293
  "name": "flags-dir",
@@ -1222,128 +1296,54 @@
1222
1296
  "multiple": false,
1223
1297
  "type": "option"
1224
1298
  },
1225
- "target-org": {
1226
- "char": "o",
1227
- "name": "target-org",
1228
- "noCacheDefault": true,
1229
- "required": true,
1230
- "summary": "Username or alias of the target org. Not required if the `target-org` configuration variable is already set.",
1231
- "hasDynamicHelp": true,
1232
- "multiple": false,
1233
- "type": "option"
1234
- },
1235
- "api-version": {
1236
- "description": "Override the api version used for api requests made by this command",
1237
- "name": "api-version",
1238
- "hasDynamicHelp": false,
1239
- "multiple": false,
1240
- "type": "option"
1241
- },
1242
- "api-name": {
1243
- "char": "n",
1244
- "name": "api-name",
1245
- "summary": "API name of the activated published agent you want to preview.",
1246
- "hasDynamicHelp": false,
1247
- "multiple": false,
1248
- "type": "option"
1249
- },
1250
- "authoring-bundle": {
1251
- "name": "authoring-bundle",
1252
- "summary": "API name of the authoring bundle metadata component that contains the agent's Agent Script file.",
1299
+ "from-definition": {
1300
+ "char": "d",
1301
+ "name": "from-definition",
1302
+ "summary": "Filepath to the AIEvaluationDefinition metadata XML file in your DX project that you want to convert to a test spec YAML file.",
1253
1303
  "hasDynamicHelp": false,
1254
1304
  "multiple": false,
1255
1305
  "type": "option"
1256
1306
  },
1257
- "use-live-actions": {
1258
- "exclusive": [
1259
- "simulate-actions"
1260
- ],
1261
- "name": "use-live-actions",
1262
- "summary": "Execute real actions in the org (Apex classes, flows, etc.). Required with --authoring-bundle.",
1263
- "allowNo": false,
1264
- "type": "boolean"
1265
- },
1266
- "simulate-actions": {
1267
- "exclusive": [
1268
- "use-live-actions"
1269
- ],
1270
- "name": "simulate-actions",
1271
- "summary": "Use AI to simulate action execution instead of calling real actions. Required with --authoring-bundle.",
1307
+ "force-overwrite": {
1308
+ "name": "force-overwrite",
1309
+ "summary": "Don't prompt for confirmation when overwriting an existing test spec YAML file.",
1272
1310
  "allowNo": false,
1273
1311
  "type": "boolean"
1274
1312
  },
1275
- "agent-json": {
1276
- "dependsOn": [
1277
- "authoring-bundle"
1278
- ],
1279
- "hidden": true,
1280
- "name": "agent-json",
1281
- "summary": "Path to a pre-compiled AgentJSON file to use instead of compiling the Agent Script file. Intended for internal use and testing.",
1313
+ "output-file": {
1314
+ "char": "f",
1315
+ "name": "output-file",
1316
+ "summary": "Name of the generated test spec YAML file. Default value is \"specs/<AGENT_API_NAME>-testSpec.yaml\".",
1282
1317
  "hasDynamicHelp": false,
1283
1318
  "multiple": false,
1284
1319
  "type": "option"
1285
1320
  }
1286
1321
  },
1287
- "hasDynamicHelp": true,
1322
+ "hasDynamicHelp": false,
1288
1323
  "hiddenAliases": [],
1289
- "id": "agent:preview:start",
1324
+ "id": "agent:generate:test-spec",
1290
1325
  "pluginAlias": "@salesforce/plugin-agent",
1291
1326
  "pluginName": "@salesforce/plugin-agent",
1292
1327
  "pluginType": "core",
1293
1328
  "strict": true,
1294
- "summary": "Start a programmatic agent preview session.",
1295
- "enableJsonFlag": true,
1296
- "requiresProject": true,
1297
- "envVariablesSection": {
1298
- "header": "ENVIRONMENT VARIABLES",
1299
- "body": [
1300
- {
1301
- "name": "SF_TARGET_ORG",
1302
- "description": "Username or alias of your default org. Overrides the target-org configuration variable."
1303
- }
1304
- ]
1305
- },
1306
- "errorCodes": {
1307
- "header": "ERROR CODES",
1308
- "body": [
1309
- {
1310
- "name": "Succeeded (0)",
1311
- "description": "Preview session started successfully."
1312
- },
1313
- {
1314
- "name": "Failed (1)",
1315
- "description": "Agent Script compilation failed (syntax errors in the script)."
1316
- },
1317
- {
1318
- "name": "NotFound (2)",
1319
- "description": "Agent not found, or compilation API returned HTTP 404 (endpoint may not be available in your org or region)."
1320
- },
1321
- {
1322
- "name": "ServerError (3)",
1323
- "description": "Compilation API returned HTTP 500 (server error during compilation)."
1324
- },
1325
- {
1326
- "name": "PreviewStartFailed (4)",
1327
- "description": "Preview session failed to start due to API or network errors."
1328
- }
1329
- ]
1330
- },
1329
+ "summary": "Generate an agent test spec, which is a YAML file that lists the test cases for testing a specific agent.",
1330
+ "enableJsonFlag": false,
1331
1331
  "isESM": true,
1332
1332
  "relativePath": [
1333
1333
  "lib",
1334
1334
  "commands",
1335
1335
  "agent",
1336
- "preview",
1337
- "start.js"
1336
+ "generate",
1337
+ "test-spec.js"
1338
1338
  ],
1339
1339
  "aliasPermutations": [],
1340
1340
  "permutations": [
1341
- "agent:preview:start",
1342
- "preview:agent:start",
1343
- "preview:start:agent",
1344
- "agent:start:preview",
1345
- "start:agent:preview",
1346
- "start:preview:agent"
1341
+ "agent:generate:test-spec",
1342
+ "generate:agent:test-spec",
1343
+ "generate:test-spec:agent",
1344
+ "agent:test-spec:generate",
1345
+ "test-spec:agent:generate",
1346
+ "test-spec:generate:agent"
1347
1347
  ]
1348
1348
  },
1349
1349
  "agent:publish:authoring-bundle": {
@@ -2062,15 +2062,6 @@
2062
2062
  "multiple": false,
2063
2063
  "type": "option"
2064
2064
  },
2065
- "wait": {
2066
- "char": "w",
2067
- "name": "wait",
2068
- "summary": "Number of minutes to wait for results.",
2069
- "default": 10,
2070
- "hasDynamicHelp": false,
2071
- "multiple": false,
2072
- "type": "option"
2073
- },
2074
2065
  "result-format": {
2075
2066
  "name": "result-format",
2076
2067
  "summary": "Format of the agent test run results.",
@@ -2101,13 +2092,11 @@
2101
2092
  }
2102
2093
  },
2103
2094
  "hasDynamicHelp": true,
2104
- "hidden": true,
2105
2095
  "hiddenAliases": [],
2106
2096
  "id": "agent:test:run-eval",
2107
2097
  "pluginAlias": "@salesforce/plugin-agent",
2108
2098
  "pluginName": "@salesforce/plugin-agent",
2109
2099
  "pluginType": "core",
2110
- "state": "beta",
2111
2100
  "strict": true,
2112
2101
  "summary": "Run evaluation tests against an Agentforce agent.",
2113
2102
  "enableJsonFlag": true,
@@ -2317,6 +2306,293 @@
2317
2306
  "run:test:agent"
2318
2307
  ]
2319
2308
  },
2309
+ "agent:trace:delete": {
2310
+ "aliases": [],
2311
+ "args": {},
2312
+ "description": "Deletes trace files recorded during agent preview sessions. By default, shows a preview of what will be deleted and prompts for confirmation. Use --no-prompt to skip confirmation.\n\nWithout filters, deletes all traces for all agents and sessions. Use flags to narrow the scope: filter by agent name (--agent), by session (--session-id), or by age (--older-than).",
2313
+ "examples": [
2314
+ "Delete all traces for all agents and sessions (with confirmation prompt):\n<%= config.bin %> <%= command.id %>",
2315
+ "Delete all traces for a specific agent:\n<%= config.bin %> <%= command.id %> --agent My_Agent",
2316
+ "Delete traces from a specific session:\n<%= config.bin %> <%= command.id %> --session-id <SESSION_ID>",
2317
+ "Delete traces older than 7 days:\n<%= config.bin %> <%= command.id %> --older-than 7d",
2318
+ "Delete traces older than 24 hours for a specific agent, no prompt:\n<%= config.bin %> <%= command.id %> --agent My_Agent --older-than 24h --no-prompt",
2319
+ "Delete all traces without confirmation:\n<%= config.bin %> <%= command.id %> --no-prompt"
2320
+ ],
2321
+ "flags": {
2322
+ "json": {
2323
+ "description": "Format output as json.",
2324
+ "helpGroup": "GLOBAL",
2325
+ "name": "json",
2326
+ "allowNo": false,
2327
+ "type": "boolean"
2328
+ },
2329
+ "flags-dir": {
2330
+ "helpGroup": "GLOBAL",
2331
+ "name": "flags-dir",
2332
+ "summary": "Import flag values from a directory.",
2333
+ "hasDynamicHelp": false,
2334
+ "multiple": false,
2335
+ "type": "option"
2336
+ },
2337
+ "agent": {
2338
+ "char": "a",
2339
+ "name": "agent",
2340
+ "summary": "Only delete traces for this agent name (substring match). Matches against the name used when starting the session, whether that's an authoring bundle or a published agent API name.",
2341
+ "hasDynamicHelp": false,
2342
+ "multiple": false,
2343
+ "type": "option"
2344
+ },
2345
+ "session-id": {
2346
+ "name": "session-id",
2347
+ "summary": "Only delete traces from this session ID.",
2348
+ "hasDynamicHelp": false,
2349
+ "multiple": false,
2350
+ "type": "option"
2351
+ },
2352
+ "older-than": {
2353
+ "name": "older-than",
2354
+ "summary": "Only delete traces older than this duration. Accepts a number followed by a unit: m/minutes, h/hours, d/days, w/weeks (e.g. 7d, 24h, 2w).",
2355
+ "hasDynamicHelp": false,
2356
+ "multiple": false,
2357
+ "type": "option"
2358
+ },
2359
+ "no-prompt": {
2360
+ "name": "no-prompt",
2361
+ "summary": "Skip the confirmation prompt and delete immediately.",
2362
+ "allowNo": false,
2363
+ "type": "boolean"
2364
+ }
2365
+ },
2366
+ "hasDynamicHelp": false,
2367
+ "hiddenAliases": [],
2368
+ "id": "agent:trace:delete",
2369
+ "pluginAlias": "@salesforce/plugin-agent",
2370
+ "pluginName": "@salesforce/plugin-agent",
2371
+ "pluginType": "core",
2372
+ "strict": true,
2373
+ "summary": "Delete agent preview trace files.",
2374
+ "enableJsonFlag": true,
2375
+ "requiresProject": true,
2376
+ "errorCodes": {
2377
+ "header": "ERROR CODES",
2378
+ "body": [
2379
+ {
2380
+ "name": "Succeeded (0)",
2381
+ "description": "Traces deleted successfully (or no traces matched)."
2382
+ }
2383
+ ]
2384
+ },
2385
+ "isESM": true,
2386
+ "relativePath": [
2387
+ "lib",
2388
+ "commands",
2389
+ "agent",
2390
+ "trace",
2391
+ "delete.js"
2392
+ ],
2393
+ "aliasPermutations": [],
2394
+ "permutations": [
2395
+ "agent:trace:delete",
2396
+ "trace:agent:delete",
2397
+ "trace:delete:agent",
2398
+ "agent:delete:trace",
2399
+ "delete:agent:trace",
2400
+ "delete:trace:agent"
2401
+ ]
2402
+ },
2403
+ "agent:trace:list": {
2404
+ "aliases": [],
2405
+ "args": {},
2406
+ "description": "Lists trace files recorded during agent preview sessions. By default, lists all traces for all agents and all of their sessions. Use flags to narrow results: filter by agent name (--agent), by session (--session-id), or by date (--since).\n\nEach row in the output corresponds to one trace file, which in turn corresponds to one agent session. The Agent column shows the authoring bundle or API name used when starting the session.",
2407
+ "examples": [
2408
+ "List all traces for all agents and sessions:\n<%= config.bin %> <%= command.id %>",
2409
+ "List all traces for a specific agent:\n<%= config.bin %> <%= command.id %> --agent My_Agent",
2410
+ "List traces for a specific session:\n<%= config.bin %> <%= command.id %> --session-id <SESSION_ID>",
2411
+ "List traces recorded on or after April 20, 2026 (date-only, interpreted as UTC midnight):\n<%= config.bin %> <%= command.id %> --since 2026-04-20",
2412
+ "List traces recorded on or after a specific UTC time:\n<%= config.bin %> <%= command.id %> --since 2026-04-20T14:00:00Z",
2413
+ "Filter by agent and date together:\n<%= config.bin %> <%= command.id %> --agent My_Agent --since 2026-04-20",
2414
+ "Return results as JSON:\n<%= config.bin %> <%= command.id %> --json"
2415
+ ],
2416
+ "flags": {
2417
+ "json": {
2418
+ "description": "Format output as json.",
2419
+ "helpGroup": "GLOBAL",
2420
+ "name": "json",
2421
+ "allowNo": false,
2422
+ "type": "boolean"
2423
+ },
2424
+ "flags-dir": {
2425
+ "helpGroup": "GLOBAL",
2426
+ "name": "flags-dir",
2427
+ "summary": "Import flag values from a directory.",
2428
+ "hasDynamicHelp": false,
2429
+ "multiple": false,
2430
+ "type": "option"
2431
+ },
2432
+ "session-id": {
2433
+ "name": "session-id",
2434
+ "summary": "Session ID used to filter the list of trace files.",
2435
+ "hasDynamicHelp": false,
2436
+ "multiple": false,
2437
+ "type": "option"
2438
+ },
2439
+ "agent": {
2440
+ "char": "a",
2441
+ "name": "agent",
2442
+ "summary": "Only show traces for this agent name (substring match). Matches against the name used when starting the session, whether that's an authoring bundle or a published agent API name.",
2443
+ "hasDynamicHelp": false,
2444
+ "multiple": false,
2445
+ "type": "option"
2446
+ },
2447
+ "since": {
2448
+ "description": "Accepts ISO 8601 format: date-only (2026-04-20), date-time (2026-04-20T14:00:00Z), or date-time with milliseconds (2026-04-20T14:00:00.000Z). The \"Recorded At\" values shown in the table output are valid inputs.",
2449
+ "name": "since",
2450
+ "summary": "Date used to filter the list of trace files; only those recorded on or after the date are listed.",
2451
+ "hasDynamicHelp": false,
2452
+ "multiple": false,
2453
+ "type": "option"
2454
+ }
2455
+ },
2456
+ "hasDynamicHelp": false,
2457
+ "hiddenAliases": [],
2458
+ "id": "agent:trace:list",
2459
+ "pluginAlias": "@salesforce/plugin-agent",
2460
+ "pluginName": "@salesforce/plugin-agent",
2461
+ "pluginType": "core",
2462
+ "strict": true,
2463
+ "summary": "List the trace files that were recorded during all agent preview sessions.",
2464
+ "enableJsonFlag": true,
2465
+ "requiresProject": true,
2466
+ "errorCodes": {
2467
+ "header": "ERROR CODES",
2468
+ "body": [
2469
+ {
2470
+ "name": "Succeeded (0)",
2471
+ "description": "Trace files listed successfully (or empty list if none found)."
2472
+ }
2473
+ ]
2474
+ },
2475
+ "isESM": true,
2476
+ "relativePath": [
2477
+ "lib",
2478
+ "commands",
2479
+ "agent",
2480
+ "trace",
2481
+ "list.js"
2482
+ ],
2483
+ "aliasPermutations": [],
2484
+ "permutations": [
2485
+ "agent:trace:list",
2486
+ "trace:agent:list",
2487
+ "trace:list:agent",
2488
+ "agent:list:trace",
2489
+ "list:agent:trace",
2490
+ "list:trace:agent"
2491
+ ]
2492
+ },
2493
+ "agent:trace:read": {
2494
+ "aliases": [],
2495
+ "args": {},
2496
+ "description": "Reads trace files recorded during an agent preview session and outputs them in one of three formats.\n\n**--format summary** (default): A per-turn narrative showing topic routing, actions executed, and the agent's response. Use this to quickly understand what happened in a session.\n\n**--format detail**: Diagnostic drill-down into a specific dimension (--dimension required). Filters output to only the trace steps relevant to that dimension, minimizing noise.\n\n**--format raw**: Unprocessed trace JSON. Use this as a fallback when the trace schema has changed or you need to perform custom analysis.\n\nAvailable dimensions for --format detail: actions, grounding, routing, errors.\n\nUse --turn N to scope output to a single conversation turn.",
2497
+ "examples": [
2498
+ "Show a session summary (all turns):\n<%= config.bin %> <%= command.id %> --session-id <SESSION_ID>",
2499
+ "Show summary for a single turn:\n<%= config.bin %> <%= command.id %> --session-id <SESSION_ID> --turn 2",
2500
+ "Drill into action execution across all turns:\n<%= config.bin %> <%= command.id %> --session-id <SESSION_ID> --format detail --dimension actions",
2501
+ "Drill into routing decisions for a specific turn:\n<%= config.bin %> <%= command.id %> --session-id <SESSION_ID> --format detail --dimension routing --turn 1",
2502
+ "Show all errors across the session:\n<%= config.bin %> <%= command.id %> --session-id <SESSION_ID> --format detail --dimension errors",
2503
+ "Output raw trace JSON for custom parsing:\n<%= config.bin %> <%= command.id %> --session-id <SESSION_ID> --format raw",
2504
+ "Return results as JSON:\n<%= config.bin %> <%= command.id %> --session-id <SESSION_ID> --json"
2505
+ ],
2506
+ "flags": {
2507
+ "json": {
2508
+ "description": "Format output as json.",
2509
+ "helpGroup": "GLOBAL",
2510
+ "name": "json",
2511
+ "allowNo": false,
2512
+ "type": "boolean"
2513
+ },
2514
+ "flags-dir": {
2515
+ "helpGroup": "GLOBAL",
2516
+ "name": "flags-dir",
2517
+ "summary": "Import flag values from a directory.",
2518
+ "hasDynamicHelp": false,
2519
+ "multiple": false,
2520
+ "type": "option"
2521
+ },
2522
+ "session-id": {
2523
+ "char": "s",
2524
+ "name": "session-id",
2525
+ "required": true,
2526
+ "summary": "Session ID to read traces for.",
2527
+ "hasDynamicHelp": false,
2528
+ "multiple": false,
2529
+ "type": "option"
2530
+ },
2531
+ "format": {
2532
+ "char": "f",
2533
+ "name": "format",
2534
+ "summary": "Output format: summary (default), detail, or raw. Use detail with --dimension to drill into a specific aspect of the trace.",
2535
+ "default": "summary",
2536
+ "hasDynamicHelp": false,
2537
+ "multiple": false,
2538
+ "options": [
2539
+ "summary",
2540
+ "detail",
2541
+ "raw"
2542
+ ],
2543
+ "type": "option"
2544
+ },
2545
+ "dimension": {
2546
+ "char": "d",
2547
+ "name": "dimension",
2548
+ "summary": "Dimension to drill into when using --format detail. One of: actions, grounding, routing, errors. Required when --format is detail.",
2549
+ "hasDynamicHelp": false,
2550
+ "multiple": false,
2551
+ "options": [
2552
+ "actions",
2553
+ "grounding",
2554
+ "routing",
2555
+ "errors"
2556
+ ],
2557
+ "type": "option"
2558
+ },
2559
+ "turn": {
2560
+ "char": "t",
2561
+ "name": "turn",
2562
+ "summary": "Scope output to this conversation turn number.",
2563
+ "hasDynamicHelp": false,
2564
+ "multiple": false,
2565
+ "type": "option"
2566
+ }
2567
+ },
2568
+ "hasDynamicHelp": false,
2569
+ "hiddenAliases": [],
2570
+ "id": "agent:trace:read",
2571
+ "pluginAlias": "@salesforce/plugin-agent",
2572
+ "pluginName": "@salesforce/plugin-agent",
2573
+ "pluginType": "core",
2574
+ "strict": true,
2575
+ "summary": "Read and analyze trace files from an agent preview session.",
2576
+ "enableJsonFlag": true,
2577
+ "requiresProject": true,
2578
+ "isESM": true,
2579
+ "relativePath": [
2580
+ "lib",
2581
+ "commands",
2582
+ "agent",
2583
+ "trace",
2584
+ "read.js"
2585
+ ],
2586
+ "aliasPermutations": [],
2587
+ "permutations": [
2588
+ "agent:trace:read",
2589
+ "trace:agent:read",
2590
+ "trace:read:agent",
2591
+ "agent:read:trace",
2592
+ "read:agent:trace",
2593
+ "read:trace:agent"
2594
+ ]
2595
+ },
2320
2596
  "agent:validate:authoring-bundle": {
2321
2597
  "aliases": [],
2322
2598
  "args": {},
@@ -2432,5 +2708,5 @@
2432
2708
  ]
2433
2709
  }
2434
2710
  },
2435
- "version": "1.36.1"
2711
+ "version": "1.38.0"
2436
2712
  }