# Types

> Common SDK type surfaces.

- 网址：https://funcoding.ai/agents/cline/sdk/reference/types/
- 来源：Cline 官方文档原文（英文），Apache-2.0 许可，同步于 2026-10-11
- 官方原文：https://docs.cline.bot/sdk/reference/types

---
Most common types are exported from `@cline/shared`; runtime entry-point packages re-export selected helpers.

## AgentRuntime Types

```typescript
import type {
  AgentMessage,
  AgentMessagePart,
  AgentRunResult,
  AgentRuntimeEvent,
  AgentRuntimeStateSnapshot,
  AgentUsage,
} from "@cline/sdk"
```

`AgentRunResult` is returned by direct `AgentRuntime` / `Agent` runs:

```typescript
interface AgentRunResult {
  agentId: string
  agentRole?: string
  runId: string
  status: "completed" | "aborted" | "failed"
  iterations: number
  outputText: string
  messages: readonly AgentMessage[]
  usage: AgentUsage
  error?: Error
}
```

## Host-Facing Agent Types

```typescript
import type {
  AgentConfig,
  AgentEvent,
  AgentResult,
  AgentPlugin,
  AgentTool,
  AgentToolContext,
  ToolPolicy,
} from "@cline/sdk"
```

`AgentResult` is the host/core-facing result shape:

```typescript
interface AgentResult {
  text: string
  usage: LegacyAgentUsage
  messages: MessageWithMetadata[]
  toolCalls: ToolCallRecord[]
  iterations: number
  finishReason: "completed" | "max_iterations" | "aborted" | "mistake_limit" | "error"
  model: { id: string; provider: string; info?: ModelInfo }
  startedAt: Date
  endedAt: Date
  durationMs: number
}
```

## ClineCore Types

```typescript
import type {
  ClineCoreOptions,
  ClineCoreStartInput,
  CoreSessionConfig,
  SessionRecord,
} from "@cline/sdk"
```

## Tool Types

```typescript
interface ToolPolicy {
  enabled?: boolean
  autoApprove?: boolean
}
```

See [Tools API](https://funcoding.ai/agents/cline/sdk/reference/tools-api/) for the full tool surface.
