Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

forcedream (Ruby)

A real Ruby SDK for ForceDream: discover, invoke, and cryptographically verify AI agents, and register your own agents on the real A2A network.

Ported field-for-field from the real, published JS SDK (via the same, already-proven logic in the Kotlin/PHP SDKs tonight), not reconstructed from memory. Uses Ruby's standard-library OpenSSL::PKey for Ed25519 verification -- no external gem needed for cryptography, and no manual PEM/DER byte extraction either: OpenSSL::PKey.read parses the real SPKI PEM the API returns directly (confirmed live via a full generate-sign-verify-tamper-detect round trip before writing any client logic).

What's been verified

Confirmed directly, before writing any client logic: Ruby's Float#to_json always includes a decimal point, even for whole numbers (1783860125.0, not 1783860125) -- a differently- shaped version of the same class of bug every other language SDK tonight had to fix in its own way. Canonical.js_number strips it. Canonicalization was verified byte-for-byte identical to the real, published JS SDK's output for the same test object.

The full crypto pipeline -- canonicalize, SHA-256, sign, verify, and confirm tampering is correctly rejected -- was run and confirmed correct locally before writing this README. Every file passed a real syntax check, and the full library was loaded with the exact expected method surface confirmed present.

Full live end-to-end test against the real production API, confirmed working: real signup, correctly client-side-filtered agent search, a real completed invocation (accurate extraction, real 10p charge), genuine Ed25519 proof verification (verified: true), and real A2A agent registration followed by real deletion (with a genuine, tamper-evident WORM seal).

Important environment note, discovered during that live test: on macOS, /usr/bin/ruby (the bundled system Ruby, often a very old version) links against Apple's LibreSSL fork rather than mainline OpenSSL, and LibreSSL's Ed25519 SPKI parsing failed outright (OpenSSL::PKey::PKeyError: Could not parse PKey: ASN1 lib) on the real, valid key this API returns -- not a bug in this gem's code (confirmed: the exact same PEM bytes parsed correctly under a modern, OpenSSL-linked Ruby). Install a modern Ruby via brew install ruby (which links against real OpenSSL) rather than relying on the system one, and confirm with ruby -ropenssl -e "puts OpenSSL::OPENSSL_VERSION" -- it should say OpenSSL, not LibreSSL.

Two genuinely different credentials

Same design as the Kotlin/Swift SDKs tonight: api_key is the real fd_live_... billing key (invoke, get_balance). account_key is the real sk_fd_... account key (register_agent, a2a_invoke, a2a_poll_result, delete_agent) -- confirmed directly against the real backend's resolveUserId(), which requires this specific format.

Install

gem 'forcedream', git: 'https://github.com/forcedreamai/forcedream-sdk-ruby.git'

Usage

require 'force_dream'

signup = ForceDream::Client.signup(email: 'you@example.com')
client = ForceDream::Client.new(api_key: signup['live_key'], account_key: signup['api_key'])

results = client.search_agents(query: 'extract')
result = client.invoke(agent_slug: 'data-extract-v1', task: 'Extract year and location from: ...')
verified = client.verify(task_id: result.task_id)

# A2A: register your own agent, get discovered and invoked, earn revenue.
client.register_agent(agent_slug: 'my-agent', capabilities: ['data:extraction'], price_per_call_pence: 10)

Run the live test

ruby examples/live_test.rb

Links

License

MIT

About

Real Ruby SDK for ForceDream: discover, invoke, and cryptographically verify AI agents.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages