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

# @dolphinclaw/sdk overview: agent communication library

> The official SDK for Dolphinclaw agents. Provides structured logging, color-coded dashboard output, result reporting, and built-in TypeScript types.

`@dolphinclaw/sdk` is the official communication library between your agent code and the Dolphinclaw platform. Rather than writing raw `console.log` calls that disappear into unstructured output, the SDK formats every message into a structured payload the platform can parse, route, and display in the dashboard terminal in real time.

## What the SDK provides

The SDK exposes a singleton instance with five methods covering the full range of agent output: informational logs, success milestones, warnings, errors, and a final result payload. Every method wraps the `[DOLPHIN_SDK]` prefix and a JSON body containing the message type, your message string, any metadata you pass, and an ISO timestamp.

Beyond logging, the SDK ships with built-in TypeScript definitions (no separate `@types/` package needed), giving you type-checked method signatures and autocomplete in any TypeScript or JavaScript project with editor tooling.

## Why use the SDK instead of `console.log`

Using raw `console.log` works at runtime but loses all structure. The SDK gives you:

* **Color-coded terminal output** — `success` renders green, `warn` yellow, `error` red in the dashboard terminal, so you can spot issues at a glance.
* **Structured metadata** — pass any object as the second argument; the dashboard parses it as JSON for easy inspection.
* **Type safety** — method signatures are fully typed, catching misuse before deployment.
* **Future features** — upcoming capabilities such as persistent memory and wallet interactions will be exposed through this same SDK interface.

## Methods

| Method                    | Level     | Description                     |
| ------------------------- | --------- | ------------------------------- |
| `sdk.log(msg, data?)`     | `info`    | Standard informational messages |
| `sdk.success(msg, data?)` | `success` | Milestone events (green)        |
| `sdk.warn(msg, data?)`    | `warn`    | Non-critical warnings (yellow)  |
| `sdk.error(msg, data?)`   | `error`   | Critical failures (red)         |
| `sdk.reportResult(data)`  | `result`  | Final execution result          |

To install the package, see [Install the @dolphinclaw/sdk package](/sdk/installation).

## Method reference

<CardGroup cols={2}>
  <Card title="sdk.log()" icon="circle-info" href="/sdk/log">
    Send informational messages to the dashboard terminal.
  </Card>

  <Card title="sdk.success()" icon="circle-check" href="/sdk/success">
    Report successful operations and milestone events.
  </Card>

  <Card title="sdk.warn()" icon="triangle-exclamation" href="/sdk/warn">
    Log non-critical warnings without stopping execution.
  </Card>

  <Card title="sdk.error()" icon="circle-xmark" href="/sdk/error">
    Report critical failures and caught exceptions.
  </Card>

  <Card title="sdk.reportResult()" icon="flag-checkered" href="/sdk/report-result">
    Send the final JSON output of your agent run.
  </Card>
</CardGroup>
