Ruby SDK
The Ruby gem starts the Autohand Code CLI in RPC mode and gives Ruby apps streaming events, run lifecycle helpers, permissions, skills, sessions, hooks, and Rails-friendly configuration.
Repository: autohandai/code-agent-sdk-ruby. This SDK is in beta while the Agent SDK APIs stabilize. Pin commits or package versions in production.
Requirements
- Ruby 3.2 or newer.
- Bundler.
- Autohand Code CLI installed through `bundle exec autohand-sdk install-cli` or supplied with `cli_path:`.
Install
Run your first agent
Start with the high-level agent API when you want the SDK to own the run lifecycle and final result collection.
API shape
- `AutohandSDK::Agent` and `Run` for host application code.
- `AutohandSDK::Client` for direct session control.
- Ruby enumerators for streaming message, tool, permission, and error events.
- Optional Railtie support without making Rails a runtime dependency.
Rails configuration
When Rails is loaded, configure the SDK in an initializer and keep CLI path and environment overrides explicit.
Next steps
- Use Quickstart for the cross-language setup flow.
- Open Ruby API for the reference surface.
- Read Stream responses in real-time and Handle approvals and user input for shared runtime behavior.