Skip to main content
Use the official fetch_hive gem when you want to start a Hive Agent run from Ruby. The SDK wraps the public POST /v1/hive-agent/invoke endpoint with an idiomatic helper and handles authentication. Hive Agent invocation does not stream and does not wait for the final answer in the HTTP response. The SDK returns identifiers immediately, then Fetch Hive sends a signed callback when the run completes, fails, or is cancelled.

Installation

Add to your Gemfile:
Then run:
Or install directly:
The gem uses faraday under the hood and supports Ruby 3.0+.

Authentication

Set the FETCH_HIVE_API_KEY environment variable to your workspace API key (the client reads it automatically):
Or pass the key explicitly:
See API Keys for how to create and rotate keys.

Basic example

Start a Hive Agent run and read the accepted response:
invoke_hive_agent returns the parsed JSON body as a hash as soon as the run is queued. See the accepted response shape.

Method reference

The SDK always sends async.enabled: true with your callback_url. Hive Agent invocation is async-only.

Handling the response

Fetch Hive returns 202 Accepted when the run is queued. Store webhook_secret so your callback receiver can verify X-Fetch-Hive-Signature.
Open Logs to inspect status, trace, costs, node output, callback attempts, and the final response.

Configuration

Errors

Missing callback_url raises ArgumentError before a request is sent. Non-2xx responses raise a RuntimeError with the status code and body:
See Errors and Rate Limits for status code meanings.

Next steps