agent-protocols

module
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2026 License: MIT

README

Agent Protocols

Go CI Go Lint Go SAST Go Report Card Docs Visualization License

Go implementation of agent-to-agent communication protocols, starting with ID-JAG (Identity Assertion JWT Authorization Grant).

EXPERIMENTAL: This library implements draft specifications that are subject to change.

Overview

This repository provides Go libraries for emerging agent-to-agent protocols:

Installation

go get github.com/grokify/agent-protocols

Quick Start

ID-JAG Token Exchange
package main

import (
    "context"
    "fmt"
    "time"

    "github.com/grokify/agent-protocols/idjag"
)

func main() {
    // Create an assertion for token exchange
    assertion := &idjag.Assertion{
        Issuer:    "https://issuer.example.com",
        Subject:   "agent:my-agent",
        Audience:  []string{"https://auth.example.com"},
        IssuedAt:  time.Now(),
        ExpiresAt: time.Now().Add(5 * time.Minute),
    }

    // Exchange assertion for access token
    client := &idjag.TokenExchangeClient{
        TokenURL: "https://auth.example.com/token",
    }

    resp, err := client.Exchange(context.Background(), signedAssertion)
    if err != nil {
        panic(err)
    }

    fmt.Printf("Access Token: %s\n", resp.AccessToken)
}
Human-to-Agent Delegation
// Create assertion with delegation chain
assertion := &idjag.Assertion{
    Issuer:    "https://issuer.example.com",
    Subject:   "user:alice",  // Human identity
    Audience:  []string{"https://auth.example.com"},
    IssuedAt:  time.Now(),
    ExpiresAt: time.Now().Add(5 * time.Minute),
    Actor: &idjag.Actor{
        Subject: "agent:calendar-bot",  // Acting agent
    },
}

Examples

See the idjag/examples directory for complete working demos:

  • simple - Agent-only flow without human delegation
  • delegation - Human-to-agent delegation flow

Run an example:

go run ./idjag/examples/simple

Documentation

License

MIT License - see LICENSE for details.

Directories

Path Synopsis
Package aims implements the Agent Identity Management System (AIMS) framework based on draft-klrc-aiagent-auth-00.
Package aims implements the Agent Identity Management System (AIMS) framework based on draft-klrc-aiagent-auth-00.
examples/mtls command
Package main demonstrates AIMS agent authentication using mTLS with X.509 SVID.
Package main demonstrates AIMS agent authentication using mTLS with X.509 SVID.
examples/simple command
Package main demonstrates basic AIMS agent authentication with SPIFFE ID.
Package main demonstrates basic AIMS agent authentication with SPIFFE ID.
Package idjag implements Identity Assertion JWT Authorization Grant (ID-JAG) based on draft-ietf-oauth-identity-assertion-authz-grant.
Package idjag implements Identity Assertion JWT Authorization Grant (ID-JAG) based on draft-ietf-oauth-identity-assertion-authz-grant.
examples/delegation command
Package main demonstrates ID-JAG with human-to-agent delegation.
Package main demonstrates ID-JAG with human-to-agent delegation.
examples/simple command
Package main demonstrates a simple ID-JAG token exchange flow without delegation.
Package main demonstrates a simple ID-JAG token exchange flow without delegation.

Jump to

Keyboard shortcuts

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