Install

`Config`

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

`AutohandSdk`

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

  • start() / stop()
  • request(method, params)
  • prompt(message, options)
  • stream_prompt(message, options)
  • interrupt()
  • set_plan_mode(enabled)
  • set_permission_mode(mode)
  • set_model(model)
  • get_state()
  • get_messages()
  • permission_response(request_id, decision)

`Agent`

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

  • Agent::create(config)
  • Agent::from_sdk(sdk)
  • send(prompt)
  • run(prompt)
  • run_json<T>(prompt, options)
  • allow_permission(request_id)
  • deny_permission(request_id)
  • set_plan_mode(enabled)
  • close()

Run

  • next(): receive the next event
  • wait(): wait until the run finishes and collect text/events
  • json<T>(): parse final output as JSON
  • 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.