Skip to content

About

The public SDK of runyard

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

30 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 

Repository files navigation

runyard SDKs

Clients for runyard's agents API, in Go and TypeScript: start sessions, talk to them, follow what they do.

Start a session, and read its answer

With a key of your application's, on your backend:

c, err := ry.New("https://agents.example.com", os.Getenv("RUNYARD_KEY"))
s, err := c.Start(ctx, ry.Start{Profile: "support", Text: "Summarize ticket #42"})
answer, err := s.Reply(ctx)
answer, err = s.Send(ctx, "Now draft a reply")
const ry = new Runyard({ url: 'https://agents.example.com', key: process.env.RUNYARD_KEY! });
const s = await ry.start({ profile: 'support', text: 'Summarize ticket #42' });
const answer = await s.reply();
const next = await s.send('Now draft a reply');

Add a chat to your web app

A chat page served by runyard

Each of your users gets sessions of their own: start one for them (endUser, your own id for them), and have your backend mint a session token for it. The page talks to runyard directly with the token, which reaches that one session and nothing else, and draws the chat with @runyard-ai/runyard-react. Your key never leaves your backend.

s, err := c.Start(ctx, ry.Start{Profile: "support", EndUser: &ry.EndUser{ID: user.ID}})
tok, err := s.Token(ctx, ry.TokenOptions{EndUser: &ry.EndUser{ID: user.ID, Email: user.Email}})
// Hand the page s.ID(), tok.Value and https://agents.example.com/v1.

examples/ is that page, with its backend in Node or Go. Start there.

Install

Go go get github.com/runyard-ai/runyard-sdk/go
TypeScript npm install @runyard-ai/runyard-sdk

The npm packages are in runyard's registry, which needs no key. Add it to .npmrc:

@runyard-ai:registry=https://releases.runyard.ai/npm/runyard-public/

Every call needs a key: your application's (ryak_…, with sessions.read and sessions.write), which an admin makes for it (POST /v1/keys with its app, or the console) or which it is given when it connects — or, in a browser, a session token.

More

SDK vX.Y.Z is the client of server vX.Y.Z. This repository is generated from runyard-agents at each release. Report issues here.

About

The public SDK of runyard

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages