Module: ForceDream::A2A
- Defined in:
- lib/force_dream/a2a.rb
Overview
Real A2A (agent-to-agent) bindings -- lets a developer register their own agent on the real A2A network (making it discoverable and invokable by others, earning them revenue when invoked) and invoke other registered agents. Endpoint shapes confirmed directly against the real backend source (api/server.ts) earlier tonight, ported here from that same verified source -- not re-guessed for Ruby.
Uses a real, different credential from FD_LIVE_KEY/invoke(): these four endpoints all authenticate via the backend's resolveUserId(), which requires an sk_fd_... account key specifically -- confirmed directly, not assumed (the same class of key-type mismatch already caught and fixed once elsewhere tonight). Passing an fd_live_ key here will fail auth.
Class Method Summary collapse
- .delete_agent(api_base:, account_key:, agent_slug:) ⇒ Object
- .invoke(api_base:, account_key:, target_agent:, payload:, task_type: 'general', amount_pence: nil, idempotency_key: nil, fx_quote_id: nil) ⇒ Object
- .poll_result(api_base:, account_key:, invoke_id:) ⇒ Object
- .register_agent(api_base:, account_key:, agent_slug:, capabilities:, price_per_call_pence: nil, name: nil, description: nil, version: nil, recommends: nil) ⇒ Object
Class Method Details
.delete_agent(api_base:, account_key:, agent_slug:) ⇒ Object
30 31 32 |
# File 'lib/force_dream/a2a.rb', line 30 def delete_agent(api_base:, account_key:, agent_slug:) Http.post("#{api_base}/v1/a2a/delete-agent", body: { agent_slug: agent_slug }, bearer: account_key) end |
.invoke(api_base:, account_key:, target_agent:, payload:, task_type: 'general', amount_pence: nil, idempotency_key: nil, fx_quote_id: nil) ⇒ Object
34 35 36 37 38 39 40 41 42 |
# File 'lib/force_dream/a2a.rb', line 34 def invoke(api_base:, account_key:, target_agent:, payload:, task_type: 'general', amount_pence: nil, idempotency_key: nil, fx_quote_id: nil) body = { target_agent: target_agent, payload: payload, task_type: task_type } body[:amount_pence] = amount_pence if amount_pence body[:idempotency_key] = idempotency_key if idempotency_key body[:fx_quote_id] = fx_quote_id if fx_quote_id Http.post("#{api_base}/v1/a2a/invoke", body: body, bearer: account_key) end |
.poll_result(api_base:, account_key:, invoke_id:) ⇒ Object
44 45 46 |
# File 'lib/force_dream/a2a.rb', line 44 def poll_result(api_base:, account_key:, invoke_id:) Http.get("#{api_base}/v1/a2a/result/#{invoke_id}", bearer: account_key) end |
.register_agent(api_base:, account_key:, agent_slug:, capabilities:, price_per_call_pence: nil, name: nil, description: nil, version: nil, recommends: nil) ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/force_dream/a2a.rb', line 18 def register_agent(api_base:, account_key:, agent_slug:, capabilities:, price_per_call_pence: nil, name: nil, description: nil, version: nil, recommends: nil) body = { agent_slug: agent_slug, capabilities: capabilities } body[:price_per_call_pence] = price_per_call_pence if price_per_call_pence body[:name] = name if name body[:description] = description if description body[:version] = version if version body[:recommends] = recommends if recommends Http.post("#{api_base}/v1/a2a/register-agent", body: body, bearer: account_key) end |