---
title: "C++ API Reference Code Agent SDK"
source: https://docs.autohand.ai/agent-sdk/cpp-api
---

# C++ API Reference

Reference surface for the C++ SDK. These APIs wrap the Autohand CLI JSON-RPC runtime while keeping host-language lifecycle and event handling idiomatic.

**Source:** [autohandai/code-agent-sdk-cpp/docs/API\_REFERENCE.md](https://github.com/autohandai/code-agent-sdk-cpp/blob/main/docs/API_REFERENCE.md).

## Install

## \`autohand::Config\`

Configuration sets the working directory, CLI binary path, debug output, request timeout, model override, skills, system prompt additions, and execution-mode flags.

## \`autohand::AutohandSdk\`

Use the low-level wrapper when you need direct JSON-RPC control.

-   start() / stop()
-   request(method, params\_json)
-   prompt(message, options)
-   stream\_prompt(message, on\_event, options)
-   interrupt()
-   set\_plan\_mode(enabled)
-   set\_permission\_mode(mode)
-   set\_model(model)
-   get\_state()
-   get\_messages()
-   permission\_response(request\_id, decision)

## \`autohand::Agent\`

The high-level agent API is the best fit for product code that sends prompts, streams events, and waits for final results.

-   send(prompt, options)
-   run(prompt, options)
-   run\_json(prompt, schema\_json)
-   allow\_permission(request\_id)
-   deny\_permission(request\_id)
-   set\_plan\_mode(enabled)
-   close()

## Run

-   stream(on\_event): stream events and record final text
-   wait(): wait until the run finishes and collect text/events
-   json\_text(): parse final output as JSON text
-   abort(): interrupt the current run

## SDK events

All CLI-backed SDKs expose the same runtime event names, with language-specific wrappers or helper methods around the raw JSON payload.

-   `agent_start`
-   `turn_start`
-   `message_update`
-   `message_end`
-   `tool_start`
-   `tool_update`
-   `tool_end`
-   `permission_request`
-   `error`

## Structured JSON

Use the JSON helpers when the host application needs typed output from the final assistant response.