# Subagent

Package: `@threadplane/chat` · 0.3.4

Reference: /docs/api/chat/Subagent

```typescript
import type { Subagent } from '@threadplane/chat';
```

## Subagent

Reactive messages, state, and execution status for a subagent spawned by a tool call.

```typescript
export interface Subagent  {
  messages: Signal<Message[]>;
  name?: string;
  state: Signal<Record<string, unknown>>;
  status: Signal<SubagentStatus>;
  toolCallId: string;
  toolCalls?: Signal<ToolCall[]>;
}
```

### messages

```typescript
messages: Signal<Message[]>;
```

### name

Optional human-readable name.

```typescript
name?: string;
```

### state

```typescript
state: Signal<Record<string, unknown>>;
```

### status

```typescript
status: Signal<SubagentStatus>;
```

### toolCallId

Tool call ID that spawned this subagent.

```typescript
toolCallId: string;
```

### toolCalls

The subagent's own tool calls (name/args/result), referenced by
`Message.toolCallIds` in `messages`. Optional: adapters that don't surface
subagent tool calls omit it; consumers default to `[]`.

```typescript
toolCalls?: Signal<ToolCall[]>;
```