> ## Documentation Index
> Fetch the complete documentation index at: https://docs.galileo.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# AgentSpan

***

# Class: AgentSpan

Defined in: [src/types/logging/span.types.ts](https://github.com/rungalileo/galileo-js/blob/main/src/types/logging/span.types.ts)

## Extends

* [`StepWithChildSpans`](/sdk-api/typescript/reference/types/classes/StepWithChildSpans)

## Constructors

### Constructor

```ts theme={null}
new AgentSpan(data: AgentSpanOptions): AgentSpan;
```

Defined in: [src/types/logging/span.types.ts](https://github.com/rungalileo/galileo-js/blob/main/src/types/logging/span.types.ts)

#### Parameters

##### data

[`AgentSpanOptions`](/sdk-api/typescript/reference/types/interfaces/AgentSpanOptions)

#### Returns

`AgentSpan`

#### Overrides

[`StepWithChildSpans`](/sdk-api/typescript/reference/types/classes/StepWithChildSpans).[`constructor`](/sdk-api/typescript/reference/types/classes/StepWithChildSpans.mdx#constructor)

## Properties

### agentType

```ts theme={null}
agentType:
  | "default"
  | "planner"
  | "react"
  | "reflection"
  | "router"
  | "classifier"
  | "supervisor"
  | "judge";
```

Defined in: [src/types/logging/span.types.ts](https://github.com/rungalileo/galileo-js/blob/main/src/types/logging/span.types.ts)

***

### createdAt

```ts theme={null}
createdAt: Date;
```

Defined in: [src/types/logging/step.types.ts](https://github.com/rungalileo/galileo-js/blob/main/src/types/logging/step.types.ts)

#### Inherited from

[`StepWithChildSpans`](/sdk-api/typescript/reference/types/classes/StepWithChildSpans).[`createdAt`](/sdk-api/typescript/reference/types/classes/StepWithChildSpans.mdx#createdat)

***

### datasetInput?

```ts theme={null}
optional datasetInput: string;
```

Defined in: [src/types/logging/step.types.ts](https://github.com/rungalileo/galileo-js/blob/main/src/types/logging/step.types.ts)

#### Inherited from

[`StepWithChildSpans`](/sdk-api/typescript/reference/types/classes/StepWithChildSpans).[`datasetInput`](/sdk-api/typescript/reference/types/classes/StepWithChildSpans.mdx#datasetinput)

***

### datasetMetadata?

```ts theme={null}
optional datasetMetadata: Record<string, string> = {};
```

Defined in: [src/types/logging/step.types.ts](https://github.com/rungalileo/galileo-js/blob/main/src/types/logging/step.types.ts)

#### Inherited from

[`StepWithChildSpans`](/sdk-api/typescript/reference/types/classes/StepWithChildSpans).[`datasetMetadata`](/sdk-api/typescript/reference/types/classes/StepWithChildSpans.mdx#datasetmetadata)

***

### datasetOutput?

```ts theme={null}
optional datasetOutput: string;
```

Defined in: [src/types/logging/step.types.ts](https://github.com/rungalileo/galileo-js/blob/main/src/types/logging/step.types.ts)

#### Inherited from

[`StepWithChildSpans`](/sdk-api/typescript/reference/types/classes/StepWithChildSpans).[`datasetOutput`](/sdk-api/typescript/reference/types/classes/StepWithChildSpans.mdx#datasetoutput)

***

### externalId?

```ts theme={null}
optional externalId: string;
```

Defined in: [src/types/logging/step.types.ts](https://github.com/rungalileo/galileo-js/blob/main/src/types/logging/step.types.ts)

#### Inherited from

[`StepWithChildSpans`](/sdk-api/typescript/reference/types/classes/StepWithChildSpans).[`externalId`](/sdk-api/typescript/reference/types/classes/StepWithChildSpans.mdx#externalid)

***

### input

```ts theme={null}
input: StepAllowedInputType;
```

Defined in: [src/types/logging/span.types.ts](https://github.com/rungalileo/galileo-js/blob/main/src/types/logging/span.types.ts)

#### Inherited from

[`StepWithChildSpans`](/sdk-api/typescript/reference/types/classes/StepWithChildSpans).[`input`](/sdk-api/typescript/reference/types/classes/StepWithChildSpans.mdx#input)

***

### metrics

```ts theme={null}
metrics: Metrics;
```

Defined in: [src/types/logging/step.types.ts](https://github.com/rungalileo/galileo-js/blob/main/src/types/logging/step.types.ts)

#### Inherited from

[`StepWithChildSpans`](/sdk-api/typescript/reference/types/classes/StepWithChildSpans).[`metrics`](/sdk-api/typescript/reference/types/classes/StepWithChildSpans.mdx#metrics)

***

### name

```ts theme={null}
name: string = "";
```

Defined in: [src/types/logging/step.types.ts](https://github.com/rungalileo/galileo-js/blob/main/src/types/logging/step.types.ts)

#### Inherited from

[`StepWithChildSpans`](/sdk-api/typescript/reference/types/classes/StepWithChildSpans).[`name`](/sdk-api/typescript/reference/types/classes/StepWithChildSpans.mdx#name)

***

### output?

```ts theme={null}
optional output: StepAllowedOutputType;
```

Defined in: [src/types/logging/step.types.ts](https://github.com/rungalileo/galileo-js/blob/main/src/types/logging/step.types.ts)

#### Inherited from

[`StepWithChildSpans`](/sdk-api/typescript/reference/types/classes/StepWithChildSpans).[`output`](/sdk-api/typescript/reference/types/classes/StepWithChildSpans.mdx#output)

***

### redactedInput?

```ts theme={null}
optional redactedInput: StepAllowedInputType;
```

Defined in: [src/types/logging/span.types.ts](https://github.com/rungalileo/galileo-js/blob/main/src/types/logging/span.types.ts)

#### Inherited from

[`StepWithChildSpans`](/sdk-api/typescript/reference/types/classes/StepWithChildSpans).[`redactedInput`](/sdk-api/typescript/reference/types/classes/StepWithChildSpans.mdx#redactedinput)

***

### redactedOutput?

```ts theme={null}
optional redactedOutput: StepAllowedOutputType;
```

Defined in: [src/types/logging/step.types.ts](https://github.com/rungalileo/galileo-js/blob/main/src/types/logging/step.types.ts)

#### Inherited from

[`StepWithChildSpans`](/sdk-api/typescript/reference/types/classes/StepWithChildSpans).[`redactedOutput`](/sdk-api/typescript/reference/types/classes/StepWithChildSpans.mdx#redactedoutput)

***

### spans

```ts theme={null}
spans: Span[] = [];
```

Defined in: [src/types/logging/span.types.ts](https://github.com/rungalileo/galileo-js/blob/main/src/types/logging/span.types.ts)

#### Inherited from

[`StepWithChildSpans`](/sdk-api/typescript/reference/types/classes/StepWithChildSpans).[`spans`](/sdk-api/typescript/reference/types/classes/StepWithChildSpans.mdx#spans)

***

### statusCode?

```ts theme={null}
optional statusCode: number;
```

Defined in: [src/types/logging/step.types.ts](https://github.com/rungalileo/galileo-js/blob/main/src/types/logging/step.types.ts)

#### Inherited from

[`StepWithChildSpans`](/sdk-api/typescript/reference/types/classes/StepWithChildSpans).[`statusCode`](/sdk-api/typescript/reference/types/classes/StepWithChildSpans.mdx#statuscode)

***

### stepNumber?

```ts theme={null}
optional stepNumber: number;
```

Defined in: [src/types/logging/step.types.ts](https://github.com/rungalileo/galileo-js/blob/main/src/types/logging/step.types.ts)

#### Inherited from

[`StepWithChildSpans`](/sdk-api/typescript/reference/types/classes/StepWithChildSpans).[`stepNumber`](/sdk-api/typescript/reference/types/classes/StepWithChildSpans.mdx#stepnumber)

***

### tags?

```ts theme={null}
optional tags: string[];
```

Defined in: [src/types/logging/step.types.ts](https://github.com/rungalileo/galileo-js/blob/main/src/types/logging/step.types.ts)

#### Inherited from

[`StepWithChildSpans`](/sdk-api/typescript/reference/types/classes/StepWithChildSpans).[`tags`](/sdk-api/typescript/reference/types/classes/StepWithChildSpans.mdx#tags)

***

### type

```ts theme={null}
type: "agent" | "llm" | "retriever" | "tool" | "workflow" | "trace" | "session" = StepType.agent;
```

Defined in: [src/types/logging/span.types.ts](https://github.com/rungalileo/galileo-js/blob/main/src/types/logging/span.types.ts)

#### Overrides

[`StepWithChildSpans`](/sdk-api/typescript/reference/types/classes/StepWithChildSpans).[`type`](/sdk-api/typescript/reference/types/classes/StepWithChildSpans.mdx#type)

***

### userMetadata

```ts theme={null}
userMetadata: Record<string, string> = {};
```

Defined in: [src/types/logging/step.types.ts](https://github.com/rungalileo/galileo-js/blob/main/src/types/logging/step.types.ts)

#### Inherited from

[`StepWithChildSpans`](/sdk-api/typescript/reference/types/classes/StepWithChildSpans).[`userMetadata`](/sdk-api/typescript/reference/types/classes/StepWithChildSpans.mdx#usermetadata)

## Methods

### addChildSpan()

```ts theme={null}
addChildSpan(...spans: Span[]): void;
```

Defined in: [src/types/logging/span.types.ts](https://github.com/rungalileo/galileo-js/blob/main/src/types/logging/span.types.ts)

#### Parameters

##### spans

...[`Span`](/sdk-api/typescript/reference/types/type-aliases/Span)\[]

#### Returns

`void`

#### Inherited from

[`StepWithChildSpans`](/sdk-api/typescript/reference/types/classes/StepWithChildSpans).[`addChildSpan`](/sdk-api/typescript/reference/types/classes/StepWithChildSpans.mdx#addchildspan)

***

### toJSON()

```ts theme={null}
toJSON(): Record<string, any>;
```

Defined in: [src/types/logging/span.types.ts](https://github.com/rungalileo/galileo-js/blob/main/src/types/logging/span.types.ts)

#### Returns

`Record`\<`string`, `any`>

#### Overrides

[`StepWithChildSpans`](/sdk-api/typescript/reference/types/classes/StepWithChildSpans).[`toJSON`](/sdk-api/typescript/reference/types/classes/StepWithChildSpans.mdx#tojson)

***

### validateInputOutputSerializable()

```ts theme={null}
validateInputOutputSerializable<T>(val: T): T;
```

Defined in: [src/types/logging/step.types.ts](https://github.com/rungalileo/galileo-js/blob/main/src/types/logging/step.types.ts)

#### Type Parameters

##### T

`T` =
\| `string`
\| \{
`content`: `string`;
`role`: | `"function"`
\| `"agent"`
\| `"tool"`
\| `"user"`
\| `"assistant"`
\| `"developer"`
\| `"system"`;
`tool_call_id?`: `null` | `string`;
`tool_calls?`: `null` | `object`\[];
}
\| `string`\[]
\| [`Document`](/sdk-api/typescript/reference/types/classes/Document)
\| `Record`\<`string`, `string`>
\| [`Document`](/sdk-api/typescript/reference/types/classes/Document)\[]
\| `Record`\<`string`, `string`>\[]
\| `object`\[]
\| `Record`\<`string`, `string`>\[]

#### Parameters

##### val

`T`

#### Returns

`T`

#### Inherited from

[`StepWithChildSpans`](/sdk-api/typescript/reference/types/classes/StepWithChildSpans).[`validateInputOutputSerializable`](/sdk-api/typescript/reference/types/classes/StepWithChildSpans.mdx#validateinputoutputserializable)
