DatagroutConduit.Onramp (DataGrout Conduit v0.6.0)

Copy Markdown View Source

Autonomous agent self-registration (onramp) for DataGrout.

The onramp flow lets a machine intelligence register itself with DG without a human in the loop, using only plain HTTP JSON — no MCP client required.

Flow

  1. POST to /onramp with agent identity metadata (no auth).
  2. DG returns a short-lived session_token (5 minutes).
  3. POST to /onramp/complete with Authorization: Bearer <session_token>.
  4. DG issues provisional client_id + client_secret (restricted scopes).

The two-step handshake stops fire-and-forget scripts from bulk-registering without completing the flow.

Example

alias DatagroutConduit.{Client, Onramp}

opts = %Onramp.OnrampOptions{
  gateway: "https://app.datagrout.ai",
  agent_name: "my-research-agent",
  agent_type: "claude-sonnet-4-6",
  intended_use: "Summarise documents and extract entities."
}

# One-shot: autonomous registration + mTLS bootstrap.
{:ok, client} = Client.bootstrap_onramp(opts: opts)

Summary

Functions

Perform the full onramp handshake and OAuth token exchange.

Perform the onramp handshake and return provisional OAuth credentials.

Functions

register_and_exchange(opts)

@spec register_and_exchange(DatagroutConduit.Onramp.OnrampOptions.t()) ::
  {:ok, {DatagroutConduit.Onramp.OnrampCredentials.t(), String.t()}}
  | {:error, term()}

Perform the full onramp handshake and OAuth token exchange.

Returns the provisional credentials alongside a short-lived access token ready for use with DatagroutConduit.Client.bootstrap_identity/1.

register_only(opts)

Perform the onramp handshake and return provisional OAuth credentials.

Low-level entry point. Most callers should use DatagroutConduit.Client.bootstrap_onramp/1 instead, which chains onramp → token exchange → mTLS identity bootstrap in a single call.