Files
simstudioai--sim/apps/sim/tools/databricks/get_run_output.ts
T
wehub-resource-sync d25d482dc2
Publish CLI Package / publish-npm (push) Waiting to run
Publish Python SDK / publish-pypi (push) Waiting to run
Publish TypeScript SDK / publish-npm (push) Waiting to run
CI / Migrate Dev DB (push) Has been skipped
CI / Detect Version (push) Has been cancelled
CI / Migrate DB (push) Has been cancelled
CI / Build Dev ECR (./docker/app.Dockerfile, ECR_APP) (push) Has been cancelled
CI / Build Dev ECR (./docker/db.Dockerfile, ECR_MIGRATIONS) (push) Has been cancelled
CI / Build Dev ECR (./docker/pii.Dockerfile, ECR_PII) (push) Has been cancelled
CI / Build Dev ECR (./docker/realtime.Dockerfile, ECR_REALTIME) (push) Has been cancelled
CI / Deploy Trigger.dev (Dev) (push) Has been cancelled
CI / Build AMD64 (./docker/app.Dockerfile, ECR_APP, ghcr.io/simstudioai/simstudio) (push) Has been cancelled
CI / Build AMD64 (./docker/db.Dockerfile, ECR_MIGRATIONS, ghcr.io/simstudioai/migrations) (push) Has been cancelled
CI / Build AMD64 (./docker/pii.Dockerfile, ECR_PII, ghcr.io/simstudioai/pii) (push) Has been cancelled
CI / Build AMD64 (./docker/realtime.Dockerfile, ECR_REALTIME, ghcr.io/simstudioai/realtime) (push) Has been cancelled
CI / Build ARM64 (GHCR Only) (./docker/app.Dockerfile, ghcr.io/simstudioai/simstudio) (push) Has been cancelled
CI / Build ARM64 (GHCR Only) (./docker/db.Dockerfile, ghcr.io/simstudioai/migrations) (push) Has been cancelled
CI / Build ARM64 (GHCR Only) (./docker/pii.Dockerfile, ghcr.io/simstudioai/pii) (push) Has been cancelled
CI / Build ARM64 (GHCR Only) (./docker/realtime.Dockerfile, ghcr.io/simstudioai/realtime) (push) Has been cancelled
CI / Create GHCR Manifests (ghcr.io/simstudioai/migrations) (push) Has been cancelled
CI / Create GHCR Manifests (ghcr.io/simstudioai/pii) (push) Has been cancelled
CI / Create GHCR Manifests (ghcr.io/simstudioai/realtime) (push) Has been cancelled
CI / Create GHCR Manifests (ghcr.io/simstudioai/simstudio) (push) Has been cancelled
CI / Check Docs Changes (push) Has been cancelled
CI / Process Docs (push) Has been cancelled
CI / Create GitHub Release (push) Has been cancelled
CI / Test and Build (push) Has been cancelled
chore: import upstream snapshot with attribution
2026-07-13 13:20:55 +08:00

115 lines
3.1 KiB
TypeScript

import type {
DatabricksGetRunOutputParams,
DatabricksGetRunOutputResponse,
} from '@/tools/databricks/types'
import type { ToolConfig } from '@/tools/types'
export const getRunOutputTool: ToolConfig<
DatabricksGetRunOutputParams,
DatabricksGetRunOutputResponse
> = {
id: 'databricks_get_run_output',
name: 'Databricks Get Run Output',
description:
'Get the output of a completed Databricks job run, including notebook results, error messages, and logs. For multi-task jobs, use the task run ID (not the parent run ID).',
version: '1.0.0',
params: {
host: {
type: 'string',
required: true,
visibility: 'user-only',
description: 'Databricks workspace host (e.g., dbc-abc123.cloud.databricks.com)',
},
apiKey: {
type: 'string',
required: true,
visibility: 'user-only',
description: 'Databricks Personal Access Token',
},
runId: {
type: 'number',
required: true,
visibility: 'user-or-llm',
description: 'The run ID to get output for. For multi-task jobs, use the task run ID',
},
},
request: {
url: (params) => {
const host = params.host
.trim()
.replace(/^https?:\/\//, '')
.replace(/\/$/, '')
return `https://${host}/api/2.1/jobs/runs/get-output?run_id=${params.runId}`
},
method: 'GET',
headers: (params) => ({
Accept: 'application/json',
Authorization: `Bearer ${params.apiKey}`,
}),
},
transformResponse: async (response: Response) => {
const data = await response.json()
if (!response.ok) {
throw new Error(data.message || data.error?.message || 'Failed to get run output')
}
return {
success: true,
output: {
notebookOutput: data.notebook_output
? {
result: data.notebook_output.result ?? null,
truncated: data.notebook_output.truncated ?? false,
}
: null,
error: data.error ?? null,
errorTrace: data.error_trace ?? null,
logs: data.logs ?? null,
logsTruncated: data.logs_truncated ?? false,
},
}
},
outputs: {
notebookOutput: {
type: 'object',
description: 'Notebook task output (from dbutils.notebook.exit())',
optional: true,
properties: {
result: {
type: 'string',
description: 'Value passed to dbutils.notebook.exit() (max 5 MB)',
optional: true,
},
truncated: {
type: 'boolean',
description: 'Whether the result was truncated',
},
},
},
error: {
type: 'string',
description: 'Error message if the run failed or output is unavailable',
optional: true,
},
errorTrace: {
type: 'string',
description: 'Error stack trace if available',
optional: true,
},
logs: {
type: 'string',
description: 'Log output (last 5 MB) from spark_jar, spark_python, or python_wheel tasks',
optional: true,
},
logsTruncated: {
type: 'boolean',
description: 'Whether the log output was truncated',
},
},
}