<span id="查看工作流节点定义"></span>

# Inspect Workflow Node Definitions

List workflow nodes available in a workspace, obtain a target node ID and its preferred version, and read the node's input and output configuration definition.

(sdk-ai-studio-workflow-nodes-flow)=
<span id="任务流程"></span>

## Task flow

1. Query the workspace node catalog to list node IDs, display names, and preferred versions.
2. Select the node ID matching the processing step you plan to author.
3. Query the detailed definition for that node ID to verify its input parameters, output fields, and version metadata.

(sdk-ai-studio-workflow-nodes-prepare)=
<span id="准备"></span>

## Prerequisites

1. Complete the endpoint, personal access token, and workspace setup in [Use the SDK](../../../quickstart/ai-studio/sdk.md).

(sdk-ai-studio-workflow-nodes-s1)=
<span id="列出节点并读取定义"></span>

## List nodes and read a definition

The example below prints the node ID, display name, and preferred version for each entry in the catalog, then reads the full definition of the first node. When authoring a workflow, replace the first item with the node ID required for your task.

:::::{tab-set}
:sync-group: sdk-language

::::{tab-item} Python
:sync: python

```python
import os

import moi_product_sdk as sdk

client = sdk.new_with_personal_access_token(
    os.environ["PRODUCT_API_BASE_URL"], os.environ["PRODUCT_API_KEY"]
)
workspace = client.workspace(os.environ["WORKSPACE_ID"])
catalog = workspace.workflows().workitem_catalog()
for node in catalog.items:
    print(node.node_id, node.display_name, node.preferred_version)
if not catalog.items:
    raise SystemExit("No workflow nodes available")
node_id = catalog.items[0].node_id
detail = workspace.workflows().workitem_catalog_item(node_id)
print("Node definition:", detail.item)
```

::::

::::{tab-item} Go
:sync: go

```go
package main

import (
	"context"
	"fmt"
	"os"

	sdk "github.com/matrixorigin/matrixflow/sdk/go-sdk"
)

func main() {
	ctx := context.Background()
	client, err := sdk.NewWithPersonalAccessToken(
		os.Getenv("PRODUCT_API_BASE_URL"),
		os.Getenv("PRODUCT_API_KEY"),
	)
	if err != nil {
		panic(err)
	}
	workspace, err := client.Workspace(os.Getenv("WORKSPACE_ID"))
	if err != nil {
		panic(err)
	}
	catalog, err := workspace.Workflows().WorkitemCatalog(ctx)
	if err != nil {
		panic(err)
	}
	for _, node := range catalog.GetItems() {
		fmt.Println(node.GetNodeId(), node.GetDisplayName(), node.GetPreferredVersion())
	}
	if len(catalog.GetItems()) == 0 {
		fmt.Println("No workflow nodes available")
		return
	}
	detail, err := workspace.Workflows().WorkitemCatalogItem(ctx, catalog.GetItems()[0].GetNodeId())
	if err != nil {
		panic(err)
	}
	fmt.Println("Node definition:", detail.GetItem())
}
```

::::

:::::

(sdk-ai-studio-workflow-nodes-next)=
<span id="下一步"></span>

## Next steps

- [Create and Publish Workflows](创建工作流.md#sdk-ai-studio-workflow-deploy-submit)
- [Manage Custom Operators and Templates](自定义算子和工作流模板.md#sdk-ai-studio-workflow-design-create-operator)
