Skip to content

Repository files navigation

@tangle-network/agent-client

Consumer SDK for calling agent endpoints published through @tangle-network/agent-gateway. OpenAI-compatible chat shape, supports API key, x402 SpendAuth, and MPP credential authentication.

Install

npm install @tangle-network/agent-client

Usage

import{AgentClient}from'@tangle-network/agent-client'constclient=newAgentClient('https://gtm.tangle.tools')// Discover agent metadata (no auth)constinfo=awaitclient.discover('my-agent')// Chat (API key)constresponse=awaitclient.chat('my-agent',[{role: 'user',content: 'Hello'}],{apiKey: 'ak_...'})// Chat (streaming)forawait(constchunkofclient.chatStream('my-agent',messages,{apiKey: 'ak_...'})){process.stdout.write(chunk.content??'')}// Chat (x402 SpendAuth — no account needed)constresponse=awaitclient.chat('my-agent',messages,{x402Signature: signedSpendAuthJson,})

When to use this vs @tangle-network/tcloud

  • Use tcloud to call Tangle platform services (router.tangle.tools — 671+ models, sandbox, browser, evals).
  • Use agent-client to call a specific published agent app at its own URL (gtm.tangle.tools, taxes.tangle.tools, etc.).

Related

License

MIT

About

Consumer SDK for calling Tangle agent apps (OpenAI-compatible, x402/MPP/API-key auth)

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages