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

# Ruby SDK

> Generated EvalGate REST operations, validated models, and RBS types for Ruby.

The official Ruby package uses Ruby's standard/default libraries and covers the
public OpenAPI operations. Requires Ruby 3.2 or newer.

Install the official [RubyGems package](https://rubygems.org/gems/evalgate-sdk/versions/3.17.0):

```sh theme={null}
gem install evalgate-sdk --version 3.17.0
ruby -revalgate -e 'puts EvalGate::VERSION'
```

For Bundler, add `gem "evalgate-sdk", "3.17.0"` to your Gemfile and run
`bundle install`.

A person must approve an organization-scoped API key with `eval:read` for this
first request. Store it as `EVALGATE_API_KEY`; `EVALGATE_ORGANIZATION_ID` is an
optional explicit organization selector. See [authentication](https://evalgate.com/docs/authentication.md) for the
supported credential handoff. Save this as `evalgate_check.rb` and run
`ruby evalgate_check.rb` (or `bundle exec ruby evalgate_check.rb`):

```ruby theme={null}
require "evalgate"

client = EvalGate::Client.new(
  api_key: ENV.fetch("EVALGATE_API_KEY"),
  organization_id: ENV["EVALGATE_ORGANIZATION_ID"]
)
response = client.get_evaluations(query: { limit: 1 })
puts "HTTP #{response.status}"
```

The SDK base origin is `https://www.evalgate.com`; generated operation paths
already include `/api`. Set `base_url:` for your own qualified instance. The
organization selector must match the credential's authorization.

Create an API key scoped to the intended actions. The example requires
`eval:read`. `EvalGate::OPERATIONS` exposes every method's scope and parameter
contract. Pass required path fields with `path:`, filters with `query:`, and
JSON request payloads with `body:`.

```ruby theme={null}
body = EvalGate::Models::PostApiEvaluationsRequest.new(name: "Release checks")
response = client.post_evaluations(body: body, idempotency_key: "release-checks-001")
```

The mutation requires `eval:write`. Use a disposable local EvalGate instance
through `base_url:` while testing writes. Object models validate required fields
and documented primitive types; unions retain ordinary JSON values. RBS signatures
ship in the gem's `sig/` directory.

Nullable collection fields accept `nil` and serialize it as JSON `null`.
Pass `[]` or `{}` to send an explicit empty collection, or leave out an optional
keyword to omit it. Nonnullable collections reject `nil`; generated RBS types
preserve these same distinctions.

Successful responses expose `data`, `status`, and `headers`. Rescue
`EvalGate::APIError` to inspect `status`, `code`, `request_id`, structured `data`,
and rate-limit headers. Honor `headers["retry-after"]` when rescheduling a 429.
The client does not follow redirects or retry mutations automatically.

`client.paginate("get_evaluations", query: { limit: 50 }, max_pages: 100)` returns
a lazy enumerator of responses with repeated-cursor and no-progress protection.
It raises when the explicit page bound is exhausted.

This gem is a generated REST client with RBS types. For trace ingestion, follow
the [OpenTelemetry/OpenInference and collector guide](https://evalgate.com/docs/help/telemetry/first-trace.md)
with a compatible exporter. Native local runners and framework wrappers retain
their [documented language support](https://evalgate.com/docs/guides/agent-framework-integrations.md).
Explore public documentation and assertion test mode over HTTP without a key;
the Ruby SDK constructor requires an approved API key.

[RubyGems package](https://rubygems.org/gems/evalgate-sdk) ·
[API authentication](https://evalgate.com/docs/authentication.md) · [Contact](mailto:hello@evalgate.com)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.