@labelbox/recursion-sdk 0.0.164 → 0.0.166

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.
@@ -562,6 +562,7 @@ export declare class ManagedAgents extends HeyApiClient {
562
562
  after_event_id?: string;
563
563
  limit?: number;
564
564
  hydrate?: 'images';
565
+ image_urls?: 'signed';
565
566
  payloads?: 'refs';
566
567
  }, options?: Options<never, ThrowOnError>): import("./client/types.gen.js").RequestResult<GetManagedAgentsV1SessionsBySessionIdEventsResponses, GetManagedAgentsV1SessionsBySessionIdEventsErrors, ThrowOnError, "data">;
567
568
  /**
@@ -646,6 +647,7 @@ export declare class ManagedAgents extends HeyApiClient {
646
647
  getSessionTree<ThrowOnError extends boolean = false>(parameters: {
647
648
  session_id: string;
648
649
  hydrate?: 'images';
650
+ image_urls?: 'signed';
649
651
  payloads?: 'refs';
650
652
  }, options?: Options<never, ThrowOnError>): import("./client/types.gen.js").RequestResult<GetManagedAgentsV1SessionsBySessionIdTreeResponses, GetManagedAgentsV1SessionsBySessionIdTreeErrors, ThrowOnError, "data">;
651
653
  /**
@@ -1068,6 +1068,7 @@ export class ManagedAgents extends HeyApiClient {
1068
1068
  { in: 'query', key: 'after_event_id' },
1069
1069
  { in: 'query', key: 'limit' },
1070
1070
  { in: 'query', key: 'hydrate' },
1071
+ { in: 'query', key: 'image_urls' },
1071
1072
  { in: 'query', key: 'payloads' }
1072
1073
  ] }]);
1073
1074
  return (options?.client ?? this.client).get({
@@ -1229,6 +1230,7 @@ export class ManagedAgents extends HeyApiClient {
1229
1230
  const params = buildClientParams([parameters], [{ args: [
1230
1231
  { in: 'path', key: 'session_id' },
1231
1232
  { in: 'query', key: 'hydrate' },
1233
+ { in: 'query', key: 'image_urls' },
1232
1234
  { in: 'query', key: 'payloads' }
1233
1235
  ] }]);
1234
1236
  return (options?.client ?? this.client).get({
@@ -8130,6 +8130,14 @@ export type ManagedAgentsContentBlock = {
8130
8130
  * Private typed content reference. Fetch through the authenticated session image proxy; clients cannot read this gs:// URI directly.
8131
8131
  */
8132
8132
  uri?: string;
8133
+ /**
8134
+ * Short-lived HTTPS URL for the image bytes. Present only when the read asked for image_urls=signed and the deployment has signing configured. Never stored; fetch a fresh read after url_expires_at.
8135
+ */
8136
+ url?: string;
8137
+ /**
8138
+ * When url stops working. Absent whenever url is.
8139
+ */
8140
+ url_expires_at?: unknown;
8133
8141
  /**
8134
8142
  * Validated image width in pixels.
8135
8143
  */
@@ -26727,6 +26735,10 @@ export type GetManagedAgentsV1SessionsBySessionIdEventsData = {
26727
26735
  * Opt-in compatibility mode. images rehydrates private image refs under strict response caps; omitted by default.
26728
26736
  */
26729
26737
  hydrate?: 'images';
26738
+ /**
26739
+ * Set to signed to add a short-lived url (and url_expires_at) to every stored image block the caller may read. Omitted when the deployment has no URL signing configured; the authenticated /images proxy always works.
26740
+ */
26741
+ image_urls?: 'signed';
26730
26742
  /**
26731
26743
  * External event payloads hydrate by default. Set refs to return bounded stubs and private reference metadata only.
26732
26744
  */
@@ -27230,6 +27242,10 @@ export type GetManagedAgentsV1SessionsBySessionIdTreeData = {
27230
27242
  * Opt-in compatibility mode. images rehydrates private image refs under strict response caps; omitted by default.
27231
27243
  */
27232
27244
  hydrate?: 'images';
27245
+ /**
27246
+ * Set to signed to add a short-lived url (and url_expires_at) to every stored image block the caller may read. Omitted when the deployment has no URL signing configured; the authenticated /images proxy always works.
27247
+ */
27248
+ image_urls?: 'signed';
27233
27249
  /**
27234
27250
  * External event payloads hydrate by default. Set refs to return bounded stubs and private reference metadata only.
27235
27251
  */
@@ -58,8 +58,12 @@ export declare const DOMAINS: readonly [{
58
58
  readonly id: "integrations";
59
59
  readonly title: "Integrations";
60
60
  readonly order: 13;
61
+ }, {
62
+ readonly id: "managed-agents";
63
+ readonly title: "Managed Agents";
64
+ readonly order: 14;
61
65
  }];
62
- /** Union of the thirteen canonical domain ids. */
66
+ /** Union of the fourteen canonical domain ids. */
63
67
  export type DomainId = (typeof DOMAINS)[number]['id'];
64
68
  /** Runtime guard: is `value` one of the canonical domain ids? */
65
69
  export declare function isDomainId(value: unknown): value is DomainId;
@@ -1,6 +1,6 @@
1
1
  // Canonical **product-domain taxonomy** — the single source of truth for the
2
2
  // docs information architecture. The How-to (recipes) and Explanation (concepts)
3
- // quadrants group their entries under these thirteen flat domains; Reference keeps
3
+ // quadrants group their entries under these fourteen flat domains; Reference keeps
4
4
  // its own deep, spec-derived tree (it is not domain-grouped).
5
5
  //
6
6
  // Consumed by the frontend docs nav, the `rl` CLI, and the dx generators. The
@@ -24,6 +24,7 @@ export const DOMAINS = [
24
24
  { id: 'cost', title: 'Cost', order: 11 },
25
25
  { id: 'administration', title: 'Administration', order: 12 },
26
26
  { id: 'integrations', title: 'Integrations', order: 13 },
27
+ { id: 'managed-agents', title: 'Managed Agents', order: 14 },
27
28
  ];
28
29
  const DOMAIN_IDS = new Set(DOMAINS.map((d) => d.id));
29
30
  /** Runtime guard: is `value` one of the canonical domain ids? */
@@ -4661,6 +4661,140 @@ export const RECIPE_REFERENCE = {
4661
4661
  ],
4662
4662
  },
4663
4663
  },
4664
+ 'define-a-session-outcome': {
4665
+ id: 'define-a-session-outcome',
4666
+ title: 'Define a session outcome',
4667
+ goal: 'Give a session a rubric so the agent is graded against a checkable bar, then read the verdict it earned.',
4668
+ category: 'managed-agents',
4669
+ video: 'define-a-session-outcome.mp4',
4670
+ walkthrough: [
4671
+ {
4672
+ caption: 'Start a session with an outcome',
4673
+ image: '01-start-a-session-with-an-outcome.png',
4674
+ description: 'The rubric travels with the start request: the session is graded against it from the first turn.',
4675
+ },
4676
+ {
4677
+ caption: 'Wait for the graded session, then read the verdict',
4678
+ image: '02-wait-for-the-graded-session-then-read-the-verdict.png',
4679
+ description: 'A graded session ends once the grader has run its revision passes, and the outcome then carries its evaluations: a per-criterion verdict with rationale.',
4680
+ },
4681
+ ],
4682
+ steps: [
4683
+ {
4684
+ kind: 'sdk',
4685
+ operationId: 'managedAgentsCreateEnvironment',
4686
+ caption: 'Create the environment the agent works in',
4687
+ phase: 'setup',
4688
+ inputs: {
4689
+ name: {
4690
+ value: 'Graded sandbox',
4691
+ },
4692
+ provider: {
4693
+ value: 'runs',
4694
+ },
4695
+ },
4696
+ captures: {
4697
+ environmentId: 'environment_id',
4698
+ },
4699
+ },
4700
+ {
4701
+ kind: 'sdk',
4702
+ operationId: 'managedAgentsCreateAgent',
4703
+ caption: 'Create the agent',
4704
+ phase: 'setup',
4705
+ inputs: {
4706
+ name: {
4707
+ value: 'Report writer',
4708
+ },
4709
+ system: {
4710
+ value: 'Write the requested report. Follow every instruction exactly.',
4711
+ },
4712
+ model: {
4713
+ value: '<gatewayModel>',
4714
+ },
4715
+ },
4716
+ captures: {
4717
+ agentId: 'agent_id',
4718
+ },
4719
+ },
4720
+ {
4721
+ kind: 'sdk',
4722
+ operationId: 'managedAgentsStartSession',
4723
+ caption: 'Start a session with an outcome',
4724
+ phase: 'main',
4725
+ inputs: {
4726
+ agent_id: {
4727
+ $ref: 'agentId',
4728
+ },
4729
+ environment_id: {
4730
+ $ref: 'environmentId',
4731
+ },
4732
+ message: {
4733
+ value: 'Write a two-sentence summary of what a managed agent session is.',
4734
+ },
4735
+ outcome: {
4736
+ value: {
4737
+ description: 'A two-sentence summary of what a managed agent session is.',
4738
+ rubric: '- The summary is exactly two sentences.\n- The summary names the sandbox the session runs in.',
4739
+ max_iterations: 3,
4740
+ },
4741
+ },
4742
+ },
4743
+ captures: {
4744
+ sessionId: 'session_id',
4745
+ },
4746
+ },
4747
+ {
4748
+ kind: 'sdk',
4749
+ operationId: 'managedAgentsGetSession',
4750
+ caption: 'Wait for the graded session to finish',
4751
+ phase: 'main',
4752
+ inputs: {
4753
+ session_id: {
4754
+ $ref: 'sessionId',
4755
+ },
4756
+ },
4757
+ captures: {
4758
+ sessionStatus: 'status',
4759
+ },
4760
+ },
4761
+ {
4762
+ kind: 'sdk',
4763
+ operationId: 'managedAgentsListSessionOutcomes',
4764
+ caption: 'Read the verdict',
4765
+ phase: 'main',
4766
+ inputs: {
4767
+ session_id: {
4768
+ $ref: 'sessionId',
4769
+ },
4770
+ },
4771
+ captures: {
4772
+ outcomes: 'outcomes',
4773
+ },
4774
+ },
4775
+ ],
4776
+ sdk: {
4777
+ setup: "// Create the environment the agent works in\nconst managedAgent = await rl.managedAgents.createEnvironment({\n body: {\n name: 'Graded sandbox',\n provider: 'runs',\n },\n});\nconst environmentId = managedAgent.environment_id;\n\n// Create the agent\nconst managedAgent2 = await rl.managedAgents.createAgent({\n body: {\n model: '<gatewayModel>',\n name: 'Report writer',\n system: 'Write the requested report. Follow every instruction exactly.',\n },\n});\nconst agentId = managedAgent2.agent_id;",
4778
+ main: "// Start a session with an outcome\nconst managedAgent3 = await rl.managedAgents.startSession({\n body: {\n agent_id: agentId,\n environment_id: environmentId,\n message: 'Write a two-sentence summary of what a managed agent session is.',\n outcome: { description: 'A two-sentence summary of what a managed agent session is.', rubric: '- The summary is exactly two sentences.\\n- The summary names the sandbox the session runs in.', max_iterations: 3 },\n },\n});\nconst sessionId = managedAgent3.session_id;\n\n// Wait for the graded session to finish\nlet managedAgent4;\nconst managedAgent4Deadline = Date.now() + 900000;\nfor (;;) {\n managedAgent4 = await rl.managedAgents.getSession({\n session_id: sessionId,\n });\n if (['failed', 'cancelled'].includes(managedAgent4.status)) throw new Error('reached a terminal failure state: ' + managedAgent4.status);\n if (['completed'].includes(managedAgent4.status)) break;\n if (Date.now() > managedAgent4Deadline) throw new Error('timed out after 900000ms waiting for a terminal state');\n await new Promise((resolve) => setTimeout(resolve, 10000));\n}\nconst sessionStatus = managedAgent4.status;\n\n// Read the verdict\nconst managedAgent5 = await rl.managedAgents.listSessionOutcomes({\n session_id: sessionId,\n});\nconst outcomes = managedAgent5.outcomes;",
4779
+ },
4780
+ cli: {
4781
+ setup: '# Create the environment the agent works in\nENVIRONMENT_ID=$(rl managed-agents create-environment \\\n --data "{ \\"name\\": \\"Graded sandbox\\", \\"provider\\": \\"runs\\" }" \\\n | jq -r \'.environment_id\')\n\n# Create the agent\nAGENT_ID=$(rl managed-agents create-agent \\\n --data "{ \\"model\\": \\"<gatewayModel>\\", \\"name\\": \\"Report writer\\", \\"system\\": \\"Write the requested report. Follow every instruction exactly.\\" }" \\\n | jq -r \'.agent_id\')',
4782
+ main: '# Start a session with an outcome\nSESSION_ID=$(rl managed-agents start-session \\\n --data "{ \\"agent_id\\": \\"$AGENT_ID\\", \\"environment_id\\": \\"$ENVIRONMENT_ID\\", \\"message\\": \\"Write a two-sentence summary of what a managed agent session is.\\", \\"outcome\\": { \\"description\\": \\"A two-sentence summary of what a managed agent session is.\\", \\"rubric\\": \\"- The summary is exactly two sentences.\\\\n- The summary names the sandbox the session runs in.\\", \\"max_iterations\\": 3 } }" \\\n | jq -r \'.session_id\')\n\n# Wait for the graded session to finish\ndeadline=$(( $(date +%s) + 900 ))\nwhile :; do\n response=$(rl managed-agents get-session \\\n --session_id "$SESSION_ID")\n case "$(printf \'%s\' "$response" | jq -r \'.status\')" in failed|cancelled) echo "reached a terminal failure state: $response" >&2; exit 1 ;; esac\n case "$(printf \'%s\' "$response" | jq -r \'.status\')" in completed) break ;; esac\n [ "$(date +%s)" -ge "$deadline" ] && { echo "timed out waiting for a terminal state" >&2; exit 1; }\n sleep 10\ndone\nSESSION_STATUS=$(printf \'%s\' "$response" | jq -r \'.status\')\n\n# Read the verdict\nOUTCOMES=$(rl managed-agents list-session-outcomes \\\n --session_id "$SESSION_ID" \\\n | jq -r \'.outcomes\')',
4783
+ },
4784
+ curl: {
4785
+ setup: '# Create the environment the agent works in\nENVIRONMENT_ID=$(curl -s -X POST "https://api.recursion.labelbox.com/managed-agents/v1/environments" \\\n -H "Authorization: Bearer $LABELBOX_API_KEY" \\\n -H "Content-Type: application/json" \\\n -d "{ \\"name\\": \\"Graded sandbox\\", \\"provider\\": \\"runs\\" }" \\\n | jq -r \'.environment_id\')\n\n# Create the agent\nAGENT_ID=$(curl -s -X POST "https://api.recursion.labelbox.com/managed-agents/v1/agents" \\\n -H "Authorization: Bearer $LABELBOX_API_KEY" \\\n -H "Content-Type: application/json" \\\n -d "{ \\"model\\": \\"<gatewayModel>\\", \\"name\\": \\"Report writer\\", \\"system\\": \\"Write the requested report. Follow every instruction exactly.\\" }" \\\n | jq -r \'.agent_id\')',
4786
+ main: '# Start a session with an outcome\nSESSION_ID=$(curl -s -X POST "https://api.recursion.labelbox.com/managed-agents/v1/sessions" \\\n -H "Authorization: Bearer $LABELBOX_API_KEY" \\\n -H "Content-Type: application/json" \\\n -d "{ \\"agent_id\\": \\"$AGENT_ID\\", \\"environment_id\\": \\"$ENVIRONMENT_ID\\", \\"message\\": \\"Write a two-sentence summary of what a managed agent session is.\\", \\"outcome\\": { \\"description\\": \\"A two-sentence summary of what a managed agent session is.\\", \\"rubric\\": \\"- The summary is exactly two sentences.\\\\n- The summary names the sandbox the session runs in.\\", \\"max_iterations\\": 3 } }" \\\n | jq -r \'.session_id\')\n\n# Wait for the graded session to finish\ndeadline=$(( $(date +%s) + 900 ))\nwhile :; do\n response=$(curl -s -X GET "https://api.recursion.labelbox.com/managed-agents/v1/sessions/$SESSION_ID" \\\n -H "Authorization: Bearer $LABELBOX_API_KEY")\n case "$(printf \'%s\' "$response" | jq -r \'.status\')" in failed|cancelled) echo "reached a terminal failure state: $response" >&2; exit 1 ;; esac\n case "$(printf \'%s\' "$response" | jq -r \'.status\')" in completed) break ;; esac\n [ "$(date +%s)" -ge "$deadline" ] && { echo "timed out waiting for a terminal state" >&2; exit 1; }\n sleep 10\ndone\nSESSION_STATUS=$(printf \'%s\' "$response" | jq -r \'.status\')\n\n# Read the verdict\nOUTCOMES=$(curl -s -X GET "https://api.recursion.labelbox.com/managed-agents/v1/sessions/$SESSION_ID/outcomes" \\\n -H "Authorization: Bearer $LABELBOX_API_KEY" \\\n | jq -r \'.outcomes\')',
4787
+ },
4788
+ related: {
4789
+ variationOf: 'run-an-agent-session',
4790
+ learnMore: [
4791
+ {
4792
+ type: 'concept',
4793
+ id: 'how-grading-works',
4794
+ },
4795
+ ],
4796
+ },
4797
+ },
4664
4798
  'delete-a-draft-version': {
4665
4799
  id: 'delete-a-draft-version',
4666
4800
  title: 'Delete a draft version',
@@ -6288,6 +6422,136 @@ export const RECIPE_REFERENCE = {
6288
6422
  ],
6289
6423
  },
6290
6424
  },
6425
+ 'give-an-agent-a-skill': {
6426
+ id: 'give-an-agent-a-skill',
6427
+ title: 'Give an agent a skill',
6428
+ goal: 'Write a procedure as an Agent Skill and attach it to an agent, so every session it starts loads that procedure.',
6429
+ category: 'managed-agents',
6430
+ video: 'give-an-agent-a-skill.mp4',
6431
+ walkthrough: [
6432
+ {
6433
+ caption: 'Write the skill document',
6434
+ image: '01-write-the-skill-document.png',
6435
+ description: 'A skill is a SKILL.md: YAML frontmatter naming and describing it, then the procedure itself.',
6436
+ },
6437
+ {
6438
+ caption: 'Attach the skill to the agent',
6439
+ image: '02-attach-the-skill-to-the-agent.png',
6440
+ description: 'Attaching by skill id follows the skill: the agent picks up each new version as it is published.',
6441
+ },
6442
+ {
6443
+ caption: 'Confirm the agent carries the skill',
6444
+ image: '03-confirm-the-agent-carries-the-skill.png',
6445
+ description: 'Reading the agent back shows the attachment as the service stored it, on a new agent version.',
6446
+ },
6447
+ ],
6448
+ steps: [
6449
+ {
6450
+ kind: 'sdk',
6451
+ operationId: 'managedAgentsCreateAgent',
6452
+ caption: 'Create the agent the skill is for',
6453
+ phase: 'setup',
6454
+ inputs: {
6455
+ name: {
6456
+ value: 'Release notes writer',
6457
+ },
6458
+ system: {
6459
+ value: 'Follow the attached procedures exactly.',
6460
+ },
6461
+ model: {
6462
+ value: '<gatewayModel>',
6463
+ },
6464
+ },
6465
+ captures: {
6466
+ agentId: 'agent_id',
6467
+ },
6468
+ },
6469
+ {
6470
+ kind: 'sdk',
6471
+ operationId: 'managedAgentsCreateSkill',
6472
+ caption: 'Write the skill document',
6473
+ phase: 'main',
6474
+ inputs: {
6475
+ document: {
6476
+ value: '---\nname: write-release-notes\ndescription: Turn a list of merged changes into release notes grouped by audience impact.\n---\n\n# Write release notes\n\n1. Group the merged changes by who notices them: users, operators, nobody.\n2. Drop the "nobody" group.\n3. Write one line per change, in the reader\'s language, not the commit\'s.',
6477
+ },
6478
+ display_title: {
6479
+ value: 'Write release notes',
6480
+ },
6481
+ },
6482
+ captures: {
6483
+ skillId: 'skill_id',
6484
+ },
6485
+ },
6486
+ {
6487
+ kind: 'sdk',
6488
+ operationId: 'managedAgentsUpdateAgent',
6489
+ caption: 'Attach the skill to the agent',
6490
+ phase: 'main',
6491
+ inputs: {
6492
+ agent_id: {
6493
+ $ref: 'agentId',
6494
+ },
6495
+ skills: {
6496
+ value: [
6497
+ {
6498
+ skill_id: {
6499
+ $ref: 'skillId',
6500
+ },
6501
+ },
6502
+ ],
6503
+ },
6504
+ },
6505
+ captures: {
6506
+ agentVersionId: 'latest_agent_version_id',
6507
+ },
6508
+ },
6509
+ {
6510
+ kind: 'sdk',
6511
+ operationId: 'managedAgentsGetAgent',
6512
+ caption: 'Confirm the agent carries the skill',
6513
+ phase: 'main',
6514
+ inputs: {
6515
+ agent_id: {
6516
+ $ref: 'agentId',
6517
+ },
6518
+ },
6519
+ captures: {
6520
+ attachedSkills: 'skills',
6521
+ },
6522
+ },
6523
+ ],
6524
+ sdk: {
6525
+ setup: "// Create the agent the skill is for\nconst managedAgent = await rl.managedAgents.createAgent({\n body: {\n model: '<gatewayModel>',\n name: 'Release notes writer',\n system: 'Follow the attached procedures exactly.',\n },\n});\nconst agentId = managedAgent.agent_id;",
6526
+ main: "// Write the skill document\nconst managedAgent2 = await rl.managedAgents.createSkill({\n body: {\n display_title: 'Write release notes',\n document: '---\\nname: write-release-notes\\ndescription: Turn a list of merged changes into release notes grouped by audience impact.\\n---\\n\\n# Write release notes\\n\\n1. Group the merged changes by who notices them: users, operators, nobody.\\n2. Drop the \"nobody\" group.\\n3. Write one line per change, in the reader\\'s language, not the commit\\'s.',\n },\n});\nconst skillId = managedAgent2.skill_id;\n\n// Attach the skill to the agent\nconst managedAgent3 = await rl.managedAgents.updateAgent({\n agent_id: agentId,\n body: {\n agent_id: agentId,\n skills: [{ skill_id: skillId }],\n },\n});\nconst agentVersionId = managedAgent3.latest_agent_version_id;\n\n// Confirm the agent carries the skill\nconst managedAgent4 = await rl.managedAgents.getAgent({\n agent_id: agentId,\n});\nconst attachedSkills = managedAgent4.skills;",
6527
+ },
6528
+ cli: {
6529
+ setup: '# Create the agent the skill is for\nAGENT_ID=$(rl managed-agents create-agent \\\n --data "{ \\"model\\": \\"<gatewayModel>\\", \\"name\\": \\"Release notes writer\\", \\"system\\": \\"Follow the attached procedures exactly.\\" }" \\\n | jq -r \'.agent_id\')',
6530
+ main: '# Write the skill document\nSKILL_ID=$(rl managed-agents create-skill \\\n --data "{ \\"display_title\\": \\"Write release notes\\", \\"document\\": \\"---\\\\nname: write-release-notes\\\\ndescription: Turn a list of merged changes into release notes grouped by audience impact.\\\\n---\\\\n\\\\n# Write release notes\\\\n\\\\n1. Group the merged changes by who notices them: users, operators, nobody.\\\\n2. Drop the \\\\\\"nobody\\\\\\" group.\\\\n3. Write one line per change, in the reader\'s language, not the commit\'s.\\" }" \\\n | jq -r \'.skill_id\')\n\n# Attach the skill to the agent\nAGENT_VERSION_ID=$(rl managed-agents update-agent \\\n --agent_id "$AGENT_ID" \\\n --data "{ \\"agent_id\\": \\"$AGENT_ID\\", \\"skills\\": [{ \\"skill_id\\": \\"$SKILL_ID\\" }] }" \\\n | jq -r \'.latest_agent_version_id\')\n\n# Confirm the agent carries the skill\nATTACHED_SKILLS=$(rl managed-agents get-agent \\\n --agent_id "$AGENT_ID" \\\n | jq -r \'.skills\')',
6531
+ },
6532
+ curl: {
6533
+ setup: '# Create the agent the skill is for\nAGENT_ID=$(curl -s -X POST "https://api.recursion.labelbox.com/managed-agents/v1/agents" \\\n -H "Authorization: Bearer $LABELBOX_API_KEY" \\\n -H "Content-Type: application/json" \\\n -d "{ \\"model\\": \\"<gatewayModel>\\", \\"name\\": \\"Release notes writer\\", \\"system\\": \\"Follow the attached procedures exactly.\\" }" \\\n | jq -r \'.agent_id\')',
6534
+ main: '# Write the skill document\nSKILL_ID=$(curl -s -X POST "https://api.recursion.labelbox.com/managed-agents/v1/skills" \\\n -H "Authorization: Bearer $LABELBOX_API_KEY" \\\n -H "Content-Type: application/json" \\\n -d "{ \\"display_title\\": \\"Write release notes\\", \\"document\\": \\"---\\\\nname: write-release-notes\\\\ndescription: Turn a list of merged changes into release notes grouped by audience impact.\\\\n---\\\\n\\\\n# Write release notes\\\\n\\\\n1. Group the merged changes by who notices them: users, operators, nobody.\\\\n2. Drop the \\\\\\"nobody\\\\\\" group.\\\\n3. Write one line per change, in the reader\'s language, not the commit\'s.\\" }" \\\n | jq -r \'.skill_id\')\n\n# Attach the skill to the agent\nAGENT_VERSION_ID=$(curl -s -X PATCH "https://api.recursion.labelbox.com/managed-agents/v1/agents/$AGENT_ID" \\\n -H "Authorization: Bearer $LABELBOX_API_KEY" \\\n -H "Content-Type: application/json" \\\n -d "{ \\"agent_id\\": \\"$AGENT_ID\\", \\"skills\\": [{ \\"skill_id\\": \\"$SKILL_ID\\" }] }" \\\n | jq -r \'.latest_agent_version_id\')\n\n# Confirm the agent carries the skill\nATTACHED_SKILLS=$(curl -s -X GET "https://api.recursion.labelbox.com/managed-agents/v1/agents/$AGENT_ID" \\\n -H "Authorization: Bearer $LABELBOX_API_KEY" \\\n | jq -r \'.skills\')',
6535
+ },
6536
+ related: {
6537
+ requires: [
6538
+ {
6539
+ type: 'state',
6540
+ explanation: 'an agent exists to attach the skill to',
6541
+ via: {
6542
+ type: 'recipe',
6543
+ id: 'run-an-agent-session',
6544
+ },
6545
+ },
6546
+ ],
6547
+ learnMore: [
6548
+ {
6549
+ type: 'resource',
6550
+ id: 'managed-agents',
6551
+ },
6552
+ ],
6553
+ },
6554
+ },
6291
6555
  'grade-with-a-composite-grader': {
6292
6556
  id: 'grade-with-a-composite-grader',
6293
6557
  title: 'Grade with a composite grader',
@@ -9823,6 +10087,150 @@ export const RECIPE_REFERENCE = {
9823
10087
  ],
9824
10088
  },
9825
10089
  },
10090
+ 'run-an-agent-session': {
10091
+ id: 'run-an-agent-session',
10092
+ title: 'Run an agent session',
10093
+ goal: 'Give a managed agent a sandboxed environment and a task, then watch the session run to completion and read what it did.',
10094
+ category: 'managed-agents',
10095
+ video: 'run-an-agent-session.mp4',
10096
+ walkthrough: [
10097
+ {
10098
+ caption: 'Create the environment the agent works in',
10099
+ image: '01-create-the-environment-the-agent-works-in.png',
10100
+ description: 'The environment is the sandbox: its runtime, image, and setup commands are what the agent gets a shell in.',
10101
+ },
10102
+ {
10103
+ caption: 'Create the agent',
10104
+ image: '02-create-the-agent.png',
10105
+ description: 'An agent is a name, a system prompt, and a model — the definition a session snapshots.',
10106
+ },
10107
+ {
10108
+ caption: 'Start a session',
10109
+ image: '03-start-a-session.png',
10110
+ description: 'Starting is accepted, not finished: the response carries the session id to observe.',
10111
+ },
10112
+ {
10113
+ caption: 'Wait for the session to finish',
10114
+ image: '04-wait-for-the-session-to-finish.png',
10115
+ description: 'The session provisions its sandbox, runs the agent loop, and lands on a terminal status.',
10116
+ },
10117
+ {
10118
+ caption: 'Read what the agent did',
10119
+ image: '05-read-what-the-agent-did.png',
10120
+ description: 'The event timeline is the durable record of the run — messages, tool calls, and results.',
10121
+ },
10122
+ ],
10123
+ steps: [
10124
+ {
10125
+ kind: 'sdk',
10126
+ operationId: 'managedAgentsCreateEnvironment',
10127
+ caption: 'Create the environment the agent works in',
10128
+ phase: 'setup',
10129
+ inputs: {
10130
+ name: {
10131
+ value: 'Research sandbox',
10132
+ },
10133
+ provider: {
10134
+ value: 'runs',
10135
+ },
10136
+ description: {
10137
+ value: 'Sandbox for the quickstart research session.',
10138
+ },
10139
+ },
10140
+ captures: {
10141
+ environmentId: 'environment_id',
10142
+ },
10143
+ },
10144
+ {
10145
+ kind: 'sdk',
10146
+ operationId: 'managedAgentsCreateAgent',
10147
+ caption: 'Create the agent',
10148
+ phase: 'setup',
10149
+ inputs: {
10150
+ name: {
10151
+ value: 'Research assistant',
10152
+ },
10153
+ system: {
10154
+ value: 'Research the task, then write a concise report of what you found.',
10155
+ },
10156
+ model: {
10157
+ value: '<gatewayModel>',
10158
+ },
10159
+ },
10160
+ captures: {
10161
+ agentId: 'agent_id',
10162
+ },
10163
+ },
10164
+ {
10165
+ kind: 'sdk',
10166
+ operationId: 'managedAgentsStartSession',
10167
+ caption: 'Start a session',
10168
+ phase: 'main',
10169
+ inputs: {
10170
+ agent_id: {
10171
+ $ref: 'agentId',
10172
+ },
10173
+ environment_id: {
10174
+ $ref: 'environmentId',
10175
+ },
10176
+ message: {
10177
+ value: 'Write a one-paragraph summary of what a managed agent session is.',
10178
+ },
10179
+ },
10180
+ captures: {
10181
+ sessionId: 'session_id',
10182
+ },
10183
+ },
10184
+ {
10185
+ kind: 'sdk',
10186
+ operationId: 'managedAgentsGetSession',
10187
+ caption: 'Wait for the session to finish',
10188
+ phase: 'main',
10189
+ inputs: {
10190
+ session_id: {
10191
+ $ref: 'sessionId',
10192
+ },
10193
+ },
10194
+ captures: {
10195
+ sessionStatus: 'status',
10196
+ },
10197
+ },
10198
+ {
10199
+ kind: 'sdk',
10200
+ operationId: 'managedAgentsListSessionEvents',
10201
+ caption: 'Read what the agent did',
10202
+ phase: 'main',
10203
+ inputs: {
10204
+ session_id: {
10205
+ $ref: 'sessionId',
10206
+ },
10207
+ },
10208
+ captures: {
10209
+ events: 'events',
10210
+ },
10211
+ },
10212
+ ],
10213
+ sdk: {
10214
+ setup: "// Create the environment the agent works in\nconst managedAgent = await rl.managedAgents.createEnvironment({\n body: {\n description: 'Sandbox for the quickstart research session.',\n name: 'Research sandbox',\n provider: 'runs',\n },\n});\nconst environmentId = managedAgent.environment_id;\n\n// Create the agent\nconst managedAgent2 = await rl.managedAgents.createAgent({\n body: {\n model: '<gatewayModel>',\n name: 'Research assistant',\n system: 'Research the task, then write a concise report of what you found.',\n },\n});\nconst agentId = managedAgent2.agent_id;",
10215
+ main: "// Start a session\nconst managedAgent3 = await rl.managedAgents.startSession({\n body: {\n agent_id: agentId,\n environment_id: environmentId,\n message: 'Write a one-paragraph summary of what a managed agent session is.',\n },\n});\nconst sessionId = managedAgent3.session_id;\n\n// Wait for the session to finish\nlet managedAgent4;\nconst managedAgent4Deadline = Date.now() + 900000;\nfor (;;) {\n managedAgent4 = await rl.managedAgents.getSession({\n session_id: sessionId,\n });\n if (['failed', 'cancelled'].includes(managedAgent4.status)) throw new Error('reached a terminal failure state: ' + managedAgent4.status);\n if (['completed'].includes(managedAgent4.status)) break;\n if (Date.now() > managedAgent4Deadline) throw new Error('timed out after 900000ms waiting for a terminal state');\n await new Promise((resolve) => setTimeout(resolve, 10000));\n}\nconst sessionStatus = managedAgent4.status;\n\n// Read what the agent did\nconst managedAgent5 = await rl.managedAgents.listSessionEvents({\n session_id: sessionId,\n});\nconst events = managedAgent5.events;",
10216
+ },
10217
+ cli: {
10218
+ setup: '# Create the environment the agent works in\nENVIRONMENT_ID=$(rl managed-agents create-environment \\\n --data "{ \\"description\\": \\"Sandbox for the quickstart research session.\\", \\"name\\": \\"Research sandbox\\", \\"provider\\": \\"runs\\" }" \\\n | jq -r \'.environment_id\')\n\n# Create the agent\nAGENT_ID=$(rl managed-agents create-agent \\\n --data "{ \\"model\\": \\"<gatewayModel>\\", \\"name\\": \\"Research assistant\\", \\"system\\": \\"Research the task, then write a concise report of what you found.\\" }" \\\n | jq -r \'.agent_id\')',
10219
+ main: '# Start a session\nSESSION_ID=$(rl managed-agents start-session \\\n --data "{ \\"agent_id\\": \\"$AGENT_ID\\", \\"environment_id\\": \\"$ENVIRONMENT_ID\\", \\"message\\": \\"Write a one-paragraph summary of what a managed agent session is.\\" }" \\\n | jq -r \'.session_id\')\n\n# Wait for the session to finish\ndeadline=$(( $(date +%s) + 900 ))\nwhile :; do\n response=$(rl managed-agents get-session \\\n --session_id "$SESSION_ID")\n case "$(printf \'%s\' "$response" | jq -r \'.status\')" in failed|cancelled) echo "reached a terminal failure state: $response" >&2; exit 1 ;; esac\n case "$(printf \'%s\' "$response" | jq -r \'.status\')" in completed) break ;; esac\n [ "$(date +%s)" -ge "$deadline" ] && { echo "timed out waiting for a terminal state" >&2; exit 1; }\n sleep 10\ndone\nSESSION_STATUS=$(printf \'%s\' "$response" | jq -r \'.status\')\n\n# Read what the agent did\nEVENTS=$(rl managed-agents list-session-events \\\n --session_id "$SESSION_ID" \\\n | jq -r \'.events\')',
10220
+ },
10221
+ curl: {
10222
+ setup: '# Create the environment the agent works in\nENVIRONMENT_ID=$(curl -s -X POST "https://api.recursion.labelbox.com/managed-agents/v1/environments" \\\n -H "Authorization: Bearer $LABELBOX_API_KEY" \\\n -H "Content-Type: application/json" \\\n -d "{ \\"description\\": \\"Sandbox for the quickstart research session.\\", \\"name\\": \\"Research sandbox\\", \\"provider\\": \\"runs\\" }" \\\n | jq -r \'.environment_id\')\n\n# Create the agent\nAGENT_ID=$(curl -s -X POST "https://api.recursion.labelbox.com/managed-agents/v1/agents" \\\n -H "Authorization: Bearer $LABELBOX_API_KEY" \\\n -H "Content-Type: application/json" \\\n -d "{ \\"model\\": \\"<gatewayModel>\\", \\"name\\": \\"Research assistant\\", \\"system\\": \\"Research the task, then write a concise report of what you found.\\" }" \\\n | jq -r \'.agent_id\')',
10223
+ main: '# Start a session\nSESSION_ID=$(curl -s -X POST "https://api.recursion.labelbox.com/managed-agents/v1/sessions" \\\n -H "Authorization: Bearer $LABELBOX_API_KEY" \\\n -H "Content-Type: application/json" \\\n -d "{ \\"agent_id\\": \\"$AGENT_ID\\", \\"environment_id\\": \\"$ENVIRONMENT_ID\\", \\"message\\": \\"Write a one-paragraph summary of what a managed agent session is.\\" }" \\\n | jq -r \'.session_id\')\n\n# Wait for the session to finish\ndeadline=$(( $(date +%s) + 900 ))\nwhile :; do\n response=$(curl -s -X GET "https://api.recursion.labelbox.com/managed-agents/v1/sessions/$SESSION_ID" \\\n -H "Authorization: Bearer $LABELBOX_API_KEY")\n case "$(printf \'%s\' "$response" | jq -r \'.status\')" in failed|cancelled) echo "reached a terminal failure state: $response" >&2; exit 1 ;; esac\n case "$(printf \'%s\' "$response" | jq -r \'.status\')" in completed) break ;; esac\n [ "$(date +%s)" -ge "$deadline" ] && { echo "timed out waiting for a terminal state" >&2; exit 1; }\n sleep 10\ndone\nSESSION_STATUS=$(printf \'%s\' "$response" | jq -r \'.status\')\n\n# Read what the agent did\nEVENTS=$(curl -s -X GET "https://api.recursion.labelbox.com/managed-agents/v1/sessions/$SESSION_ID/events" \\\n -H "Authorization: Bearer $LABELBOX_API_KEY" \\\n | jq -r \'.events\')',
10224
+ },
10225
+ related: {
10226
+ learnMore: [
10227
+ {
10228
+ type: 'resource',
10229
+ id: 'managed-agents',
10230
+ },
10231
+ ],
10232
+ },
10233
+ },
9826
10234
  'run-an-evaluation': {
9827
10235
  id: 'run-an-evaluation',
9828
10236
  title: 'Run an evaluation',
@@ -129,7 +129,7 @@ export const RecipeManifestSchema = z
129
129
  // One-sentence statement of the user goal this recipe accomplishes.
130
130
  goal: z.string().min(1),
131
131
  // The canonical product domain this recipe lives under in the docs How-to nav
132
- // (one of the eight `DOMAINS`). Kebab here; membership in `DOMAINS` is enforced
132
+ // (one of the canonical `DOMAINS`). Kebab here; membership in `DOMAINS` is enforced
133
133
  // fail-fast by `recipes:generate` (it can't import the domains module — schema
134
134
  // files are loaded as source at codegen time, so they may only import npm deps).
135
135
  category: z.string().regex(KEBAB_CASE, 'category must be kebab-case'),
@@ -51960,7 +51960,7 @@ export const SDK_REFERENCE = {
51960
51960
  namespace: 'managedAgents',
51961
51961
  method: 'getSessionTree',
51962
51962
  signature: 'rl.managedAgents.getSessionTree({ session_id })',
51963
- example: "const result = await rl.managedAgents.getSessionTree({\n session_id: '<session_id>',\n // optional: hydrate, payloads\n});",
51963
+ example: "const result = await rl.managedAgents.getSessionTree({\n session_id: '<session_id>',\n // optional: hydrate, image_urls, payloads\n});",
51964
51964
  cliInvocation: 'rl managed-agents get-session-tree',
51965
51965
  cliExample: 'rl managed-agents get-session-tree \\\n --session_id <session_id>',
51966
51966
  curlExample: "curl -X GET 'https://api.recursion.labelbox.com/managed-agents/v1/sessions/<session_id>/tree' \\\n -H 'Authorization: Bearer $LABELBOX_API_KEY'",
@@ -51978,6 +51978,14 @@ export const SDK_REFERENCE = {
51978
51978
  description: 'Opt-in compatibility mode. images rehydrates private image refs under strict response caps; omitted by default.',
51979
51979
  enum: ['images'],
51980
51980
  },
51981
+ {
51982
+ name: 'image_urls',
51983
+ in: 'query',
51984
+ required: false,
51985
+ type: 'string',
51986
+ description: 'Set to signed to add a short-lived url (and url_expires_at) to every stored image block the caller may read. Omitted when the deployment has no URL signing configured; the authenticated /images proxy always works.',
51987
+ enum: ['signed'],
51988
+ },
51981
51989
  {
51982
51990
  name: 'payloads',
51983
51991
  in: 'query',
@@ -53397,7 +53405,7 @@ export const SDK_REFERENCE = {
53397
53405
  namespace: 'managedAgents',
53398
53406
  method: 'listSessionEvents',
53399
53407
  signature: 'rl.managedAgents.listSessionEvents({ session_id })',
53400
- example: "const result = await rl.managedAgents.listSessionEvents({\n session_id: '<session_id>',\n // optional: after_event_id, limit, hydrate, payloads\n});",
53408
+ example: "const result = await rl.managedAgents.listSessionEvents({\n session_id: '<session_id>',\n // optional: after_event_id, limit, hydrate, image_urls, payloads\n});",
53401
53409
  cliInvocation: 'rl managed-agents list-session-events',
53402
53410
  cliExample: 'rl managed-agents list-session-events \\\n --session_id <session_id>',
53403
53411
  curlExample: "curl -X GET 'https://api.recursion.labelbox.com/managed-agents/v1/sessions/<session_id>/events' \\\n -H 'Authorization: Bearer $LABELBOX_API_KEY'",
@@ -53429,6 +53437,14 @@ export const SDK_REFERENCE = {
53429
53437
  description: 'Opt-in compatibility mode. images rehydrates private image refs under strict response caps; omitted by default.',
53430
53438
  enum: ['images'],
53431
53439
  },
53440
+ {
53441
+ name: 'image_urls',
53442
+ in: 'query',
53443
+ required: false,
53444
+ type: 'string',
53445
+ description: 'Set to signed to add a short-lived url (and url_expires_at) to every stored image block the caller may read. Omitted when the deployment has no URL signing configured; the authenticated /images proxy always works.',
53446
+ enum: ['signed'],
53447
+ },
53432
53448
  {
53433
53449
  name: 'payloads',
53434
53450
  in: 'query',
@@ -54887,10 +54903,10 @@ export const SDK_REFERENCE = {
54887
54903
  method: 'sendSessionEvents',
54888
54904
  bodyKey: 'body',
54889
54905
  signature: 'rl.managedAgents.sendSessionEvents({ session_id, body })',
54890
- example: 'const result = await rl.managedAgents.sendSessionEvents({\n session_id: \'<session_id>\',\n body: {\n actor: "human:api",\n events: [\n {\n actor: "human:api",\n content: [\n {\n byte_size: 1,\n content: [],\n data: "example",\n encrypted_content: "example",\n height: 1,\n id: "9f8b1c2d-3e4f-5a6b-7c8d-9e0f1a2b3c4d",\n input: {\n key: "example"\n },\n is_error: true,\n media_type: "example",\n name: "example-name",\n omitted_bytes: 1,\n payload: "example",\n provider: "example",\n provider_payload: "example",\n redacted: true,\n semantic_hint: "example",\n sha256: "example",\n signature: "example",\n summary: [],\n text: "example",\n tool_use_id: "9f8b1c2d-3e4f-5a6b-7c8d-9e0f1a2b3c4d",\n type: "example",\n uri: "example",\n width: 1\n }\n ],\n text: "example",\n type: "user.message"\n }\n ],\n message: "example"\n },\n});',
54906
+ example: 'const result = await rl.managedAgents.sendSessionEvents({\n session_id: \'<session_id>\',\n body: {\n actor: "human:api",\n events: [\n {\n actor: "human:api",\n content: [\n {\n byte_size: 1,\n content: [],\n data: "example",\n encrypted_content: "example",\n height: 1,\n id: "9f8b1c2d-3e4f-5a6b-7c8d-9e0f1a2b3c4d",\n input: {\n key: "example"\n },\n is_error: true,\n media_type: "example",\n name: "example-name",\n omitted_bytes: 1,\n payload: "example",\n provider: "example",\n provider_payload: "example",\n redacted: true,\n semantic_hint: "example",\n sha256: "example",\n signature: "example",\n summary: [],\n text: "example",\n tool_use_id: "9f8b1c2d-3e4f-5a6b-7c8d-9e0f1a2b3c4d",\n type: "example",\n uri: "example",\n url: "https://example.com",\n url_expires_at: "2026-02-18T09:30:00Z",\n width: 1\n }\n ],\n text: "example",\n type: "user.message"\n }\n ],\n message: "example"\n },\n});',
54891
54907
  cliInvocation: 'rl managed-agents send-session-events',
54892
54908
  cliExample: 'rl managed-agents send-session-events \\\n --session_id <session_id> \\\n --from-json body.json',
54893
- curlExample: 'curl -X POST \'https://api.recursion.labelbox.com/managed-agents/v1/sessions/<session_id>/events\' \\\n -H \'Authorization: Bearer $LABELBOX_API_KEY\' \\\n -H \'Content-Type: application/json\' \\\n -d \'{\n "actor": "human:api",\n "events": [\n {\n "actor": "human:api",\n "content": [\n {\n "byte_size": 1,\n "content": [],\n "data": "example",\n "encrypted_content": "example",\n "height": 1,\n "id": "9f8b1c2d-3e4f-5a6b-7c8d-9e0f1a2b3c4d",\n "input": {\n "key": "example"\n },\n "is_error": true,\n "media_type": "example",\n "name": "example-name",\n "omitted_bytes": 1,\n "payload": "example",\n "provider": "example",\n "provider_payload": "example",\n "redacted": true,\n "semantic_hint": "example",\n "sha256": "example",\n "signature": "example",\n "summary": [],\n "text": "example",\n "tool_use_id": "9f8b1c2d-3e4f-5a6b-7c8d-9e0f1a2b3c4d",\n "type": "example",\n "uri": "example",\n "width": 1\n }\n ],\n "text": "example",\n "type": "user.message"\n }\n ],\n "message": "example"\n }\'',
54909
+ curlExample: 'curl -X POST \'https://api.recursion.labelbox.com/managed-agents/v1/sessions/<session_id>/events\' \\\n -H \'Authorization: Bearer $LABELBOX_API_KEY\' \\\n -H \'Content-Type: application/json\' \\\n -d \'{\n "actor": "human:api",\n "events": [\n {\n "actor": "human:api",\n "content": [\n {\n "byte_size": 1,\n "content": [],\n "data": "example",\n "encrypted_content": "example",\n "height": 1,\n "id": "9f8b1c2d-3e4f-5a6b-7c8d-9e0f1a2b3c4d",\n "input": {\n "key": "example"\n },\n "is_error": true,\n "media_type": "example",\n "name": "example-name",\n "omitted_bytes": 1,\n "payload": "example",\n "provider": "example",\n "provider_payload": "example",\n "redacted": true,\n "semantic_hint": "example",\n "sha256": "example",\n "signature": "example",\n "summary": [],\n "text": "example",\n "tool_use_id": "9f8b1c2d-3e4f-5a6b-7c8d-9e0f1a2b3c4d",\n "type": "example",\n "uri": "example",\n "url": "https://example.com",\n "url_expires_at": "2026-02-18T09:30:00Z",\n "width": 1\n }\n ],\n "text": "example",\n "type": "user.message"\n }\n ],\n "message": "example"\n }\'',
54894
54910
  summary: 'Append user/system events to a session',
54895
54911
  description: 'Appends user or system events to a session and returns how many were accepted. A running session is signalled so the agent wakes and sees them; once the workflow is gone the events are appended to the transcript instead, which the temporal_signaled field distinguishes. Events are appended in the order given. An omitted or empty events array yields exactly one user turn built from message; the request fails with 400 only when every entry sent was dropped, leaving nothing to append.',
54896
54912
  httpMethod: 'post',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@labelbox/recursion-sdk",
3
- "version": "0.0.164",
3
+ "version": "0.0.166",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",