devin

package module
v0.0.0-...-44cdfe6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 18, 2026 License: MIT Imports: 11 Imported by: 0

README

go-devin

Go SDK for the Devin API v1. It exposes first-class packages for each domain (sessions, secrets, knowledge, playbooks) and a root devin package for client creation.

Features

  • Ergonomic devin.NewClient with pluggable HTTP client, logger, user agent, and retry configuration.
  • Strongly typed request/response structs per endpoint under pkg/<domain>, aligned with the official docs.
  • Shared HTTP executor (internal/httpclient) with automatic retries (408/425/429/5xx), request logging, and bearer authentication.
  • Gin-compatible validation and go-querystring-based query encoding.
  • Complete runnable samples under examples/<domain>/<endpoint> that consume DEVIN_API_KEY.

Installation

go get github.com/gassara-kys/go-devin

Quick Start

package main

import (
    "context"
    "fmt"
    "os"

    devin "github.com/gassara-kys/go-devin"
    "github.com/gassara-kys/go-devin/pkg/sessions"
)

func main() {
    apiKey := os.Getenv("DEVIN_API_KEY")
    if apiKey == "" {
        panic("DEVIN_API_KEY is not set")
    }

    client, err := devin.NewClient(apiKey)
    if err != nil {
        panic(err)
    }

    ctx := context.Background()
    summaries, err := client.Sessions.List(ctx, &sessions.ListSessionsRequest{Limit: 5})
    if err != nil {
        panic(err)
    }

    for _, sess := range summaries.Sessions {
        fmt.Println(sess.SessionID)
    }
}

Session Details

SessionDetail.Messages is populated by Sessions.Get and includes the transcript metadata (event_id, message, timestamp, type, origin, user_id, username).

detail, err := client.Sessions.Get(ctx, "devin-123")
if err != nil {
    panic(err)
}
for _, msg := range detail.Messages {
    fmt.Printf("%s %s\n", msg.Timestamp, msg.Message)
}

Examples

Each endpoint has an executable sample. For instance:

DEVIN_API_KEY=xxx go run ./examples/sessions/list
DEVIN_API_KEY=xxx DEVIN_SESSION_ID=devin-123 go run ./examples/sessions/get
DEVIN_API_KEY=xxx DEVIN_SESSION_ID=devin-123 go run ./examples/sessions/send_message

Development

make lint   # golangci-lint run ./...
make test   # go test ./...
make build  # go build ./...

License

MIT

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	Sessions  *sessions.Service
	Secrets   *secrets.Service
	Knowledge *knowledge.Service
	Playbooks *playbooks.Service
	// contains filtered or unexported fields
}

Client wraps access to all Devin services.

func NewClient

func NewClient(apiKey string, opts ...Option) (*Client, error)

NewClient builds a Client using the provided API key and options.

type HTTPDoer

type HTTPDoer = httpclient.Doer

HTTPDoer mirrors httpclient.Doer so callers can provide custom clients.

type Option

type Option func(*Client)

Option configures a Client during construction.

func WithBaseURL

func WithBaseURL(baseURL string) Option

WithBaseURL overrides the default API base URL.

func WithHTTPClient

func WithHTTPClient(h HTTPDoer) Option

WithHTTPClient injects a custom HTTP client implementation.

func WithLogger

func WithLogger(logger *slog.Logger) Option

WithLogger replaces the default slog.Logger.

func WithRetry

func WithRetry(cfg RetryConfig) Option

WithRetry customizes the retry behavior when calling Devin.

func WithTimeout

func WithTimeout(timeout time.Duration) Option

WithTimeout overrides the timeout on the underlying *http.Client.

func WithUserAgent

func WithUserAgent(ua string) Option

WithUserAgent overrides the default User-Agent header value.

type RetryConfig

type RetryConfig = httpclient.RetryConfig

RetryConfig mirrors httpclient.RetryConfig for SDK options.

Directories

Path Synopsis
examples
knowledge/list command
playbooks/list command
secrets/create command
secrets/delete command
secrets/list command
sessions/create command
sessions/get command
sessions/list command
sessions/tags command
internal
pkg
knowledge
Package knowledge provides client helpers for Devin's knowledge base, including listing folders, creating entries, and updating or deleting stored documents.
Package knowledge provides client helpers for Devin's knowledge base, including listing folders, creating entries, and updating or deleting stored documents.
playbooks
Package playbooks offers CRUD helpers for Devin automation playbooks, allowing clients to list, retrieve, create, update, and delete scripts.
Package playbooks offers CRUD helpers for Devin automation playbooks, allowing clients to list, retrieve, create, update, and delete scripts.
secrets
Package secrets manages credential storage within Devin by listing existing secrets and creating or deleting secure entries.
Package secrets manages credential storage within Devin by listing existing secrets and creating or deleting secure entries.
sessions
Package sessions manages Devin session lifecycles, from creation and message exchange to attachments, tagging, and termination helpers.
Package sessions manages Devin session lifecycles, from creation and message exchange to attachments, tagging, and termination helpers.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL