oasfgenerator

package
v1.0.0-alpha.51 Latest Latest
Warning

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

Go to latest
Published: Mar 17, 2026 License: MIT Imports: 17 Imported by: 0

README

OASF Generator

A SemStreams processor component that generates OASF (Open Agent Specification Framework) records from agent entity capabilities stored in the knowledge graph. OASF is the standard format for describing agent capabilities in the AGNTCY (Internet of Agents) ecosystem.

Overview

The OASF generator bridges SemStreams' semantic knowledge graph to the AGNTCY directory infrastructure. It watches for agent entity changes in the ENTITY_STATES KV bucket and automatically generates OASF records that can be used for agent discovery and registration in federated agent directories.

Key Features
  • Automatic Generation: Watches entity state changes and generates OASF records on-demand
  • Debouncing: Configurable debounce period prevents excessive regeneration during rapid updates
  • Semantic Mapping: Maps SemStreams predicates to OASF fields using predefined mapping rules
  • Standards Compliance: Generates OASF 1.0.0 compliant records with validation
  • Extensions Support: Optional SemStreams-specific metadata for provenance tracking

Architecture

flowchart LR
    subgraph Input
        KV[ENTITY_STATES KV]
        REQ[oasf.generate.request]
    end

    subgraph Processor["OASF Generator"]
        WATCH[KV Watcher]
        DEBOUNCE[Debounce Queue]
        MAPPER[Triple Mapper]
        VALIDATOR[OASF Validator]

        WATCH --> DEBOUNCE
        DEBOUNCE --> MAPPER
        MAPPER --> VALIDATOR
    end

    subgraph Output
        OASFKV[OASF_RECORDS KV]
        EVENT[oasf.record.generated.*]
    end

    KV -.watch.-> WATCH
    REQ --> DEBOUNCE
    VALIDATOR --> OASFKV
    VALIDATOR --> EVENT

    style Processor fill:#e1f5ff,stroke:#0066cc
    style MAPPER fill:#fff3cd,stroke:#856404
Component Flow
  1. Watch Phase: Monitors ENTITY_STATES KV bucket for agent entity changes
  2. Debounce Phase: Queues entities for generation with configurable delay to batch rapid updates
  3. Fetch Phase: Retrieves entity triples from KV storage
  4. Filter Phase: Skips entities without capability predicates (non-agent entities)
  5. Map Phase: Converts SemStreams triples to OASF record structure
  6. Validate Phase: Ensures generated record meets OASF schema requirements
  7. Store Phase: Writes record to OASF_RECORDS KV bucket
  8. Publish Phase: Emits generation event on oasf.record.generated.* subject

Configuration

Configuration Schema
{
  "entity_kv_bucket": "ENTITY_STATES",
  "oasf_kv_bucket": "OASF_RECORDS",
  "watch_pattern": "*.agent.*",
  "generation_debounce": "1s",
  "default_agent_version": "1.0.0",
  "default_authors": ["system"],
  "include_extensions": true,
  "ports": {
    "inputs": [
      {
        "name": "entity_changes",
        "subject": "entity.state.>",
        "type": "kv-watch",
        "required": true,
        "description": "Watch for entity state changes via KV watch"
      },
      {
        "name": "generate_request",
        "subject": "oasf.generate.request",
        "type": "nats",
        "required": false,
        "description": "On-demand OASF generation requests"
      }
    ],
    "outputs": [
      {
        "name": "oasf_records",
        "subject": "oasf.record.generated.*",
        "type": "jetstream",
        "required": true,
        "description": "Generated OASF records"
      }
    ]
  }
}
Configuration Options
Option Type Default Description
entity_kv_bucket string ENTITY_STATES KV bucket to watch for entity state changes
oasf_kv_bucket string OASF_RECORDS KV bucket to store generated OASF records
watch_pattern string * Key pattern to watch (e.g., *.agent.* for agents only)
generation_debounce duration 1s Debounce period before generating after entity change
default_agent_version string 1.0.0 Default semantic version when agent doesn't specify
default_authors []string ["system"] Default authors when not specified in entity metadata
include_extensions bool true Include SemStreams-specific extensions in output

NATS Topology

Input Resources
Resource Type Pattern Description
ENTITY_STATES KV Bucket * or custom Watches for agent entity state changes
oasf.generate.request Subject - Optional on-demand generation requests
Output Resources
Resource Type Pattern Description
OASF_RECORDS KV Bucket <entity-id> Stores generated OASF records by entity ID
oasf.record.generated.* Subject oasf.record.generated.<entity-id> Events published when records are generated
KV Storage Format

ENTITY_STATES Bucket (Input)

{
  "id": "acme.ops.agentic.system.agent.architect",
  "triples": [
    {
      "subject": "acme.ops.agentic.system.agent.architect",
      "predicate": "agent.capability.name",
      "object": "Software Design",
      "context": "software-design",
      "source": "registration",
      "timestamp": "2024-01-15T10:30:00Z"
    }
  ],
  "updated_at": "2024-01-15T10:30:00Z"
}

OASF_RECORDS Bucket (Output)

{
  "name": "agent-architect",
  "version": "1.0.0",
  "schema_version": "1.0.0",
  "authors": ["system"],
  "created_at": "2024-01-15T10:30:00Z",
  "description": "Designs software architecture",
  "skills": [
    {
      "id": "software-design",
      "name": "Software Design",
      "description": "Creates software architecture diagrams",
      "confidence": 0.95,
      "permissions": ["file_system_read"]
    }
  ],
  "domains": [
    {
      "name": "software-architecture"
    }
  ],
  "extensions": {
    "semstreams_entity_id": "acme.ops.agentic.system.agent.architect",
    "source": "semstreams"
  }
}

Predicate Mapping

The generator maps SemStreams agentic vocabulary predicates to OASF fields using a two-pass algorithm that groups related triples by context.

Mapping Table
SemStreams Predicate OASF Field Type Notes
agent.capability.name skills[].name string Human-readable skill name
agent.capability.description skills[].description string Detailed skill description
agent.capability.expression skills[].id string Unique skill identifier
agent.capability.confidence skills[].confidence float64 Self-assessed confidence (0.0-1.0)
agent.capability.permission skills[].permissions[] []string Required permissions (can appear multiple times)
agent.intent.goal description string Agent's primary purpose
agent.intent.type domains[].name string Domain of operation
agent.action.type extensions.action_types[] []string Action types (extension)
Context Grouping

Triples with the same context field are grouped together to form a single OASF skill. For example:

// These triples share context "software-design" and form one skill
Triple{Predicate: "agent.capability.name", Object: "Software Design", Context: "software-design"}
Triple{Predicate: "agent.capability.expression", Object: "sw-design", Context: "software-design"}
Triple{Predicate: "agent.capability.confidence", Object: 0.95, Context: "software-design"}

Results in:

{
  "id": "sw-design",
  "name": "Software Design",
  "confidence": 0.95
}
Entity ID to Agent Name

The generator extracts a human-readable agent name from the 6-part federated entity ID:

org.platform.domain.system.type.instance → type-instance

Example:
acme.ops.agentic.system.agent.architect → agent-architect

Usage

Flow Configuration
components:
  - name: oasf-gen
    type: oasf-generator
    config:
      entity_kv_bucket: ENTITY_STATES
      oasf_kv_bucket: OASF_RECORDS
      watch_pattern: "*.agent.*"
      generation_debounce: "1s"
      include_extensions: true
Programmatic Usage
import (
    "context"
    "encoding/json"

    "github.com/c360studio/semstreams/component"
    oasfgen "github.com/c360studio/semstreams/processor/oasf-generator"
)

// Create component
config := oasfgen.DefaultConfig()
config.EntityKVBucket = "ENTITY_STATES"
config.OASFKVBucket = "OASF_RECORDS"

rawConfig, _ := json.Marshal(config)
comp, err := oasfgen.NewComponent(rawConfig, deps)
if err != nil {
    log.Fatal(err)
}

// Initialize and start
if err := comp.Initialize(); err != nil {
    log.Fatal(err)
}

ctx := context.Background()
if err := comp.Start(ctx); err != nil {
    log.Fatal(err)
}

// Component now watches for entity changes and generates OASF records
On-Demand Generation
// Manually trigger generation for a specific entity
entityID := "acme.ops.agentic.system.agent.architect"
if err := comp.GenerateForEntity(ctx, entityID); err != nil {
    log.Printf("Generation failed: %v", err)
}

Testing

Unit Tests
# Run unit tests
task test

# Run with race detection
task test:race

# Run specific package
go test ./processor/oasf-generator/...
Integration Tests

The package includes integration tests that use testcontainers to spin up a real NATS JetStream instance:

# Run integration tests (requires Docker)
task test:integration

# Run only oasf-generator integration tests
go test -tags=integration ./processor/oasf-generator/... -v
Test Coverage

Key test scenarios include:

  • Basic Capability Mapping: Single skill with all fields
  • Multiple Skills: Entities with multiple capabilities
  • Permission Aggregation: Multiple permission triples grouped by context
  • Intent Mapping: Goals and types to description and domains
  • Extension Handling: SemStreams-specific metadata
  • Edge Cases: Missing fields, invalid data, empty entities
Example Test
func TestMapper_MapTriplesToOASF_BasicCapability(t *testing.T) {
    mapper := NewMapper("1.0.0", []string{"system"}, true)

    agentID := "acme.ops.agentic.system.agent.architect"
    triples := []message.Triple{
        {
            Subject:   agentID,
            Predicate: agentic.CapabilityName,
            Object:    "Software Design",
            Context:   "software-design",
        },
        {
            Subject:   agentID,
            Predicate: agentic.CapabilityExpression,
            Object:    "software-design",
            Context:   "software-design",
        },
    }

    record, err := mapper.MapTriplesToOASF(agentID, triples)
    if err != nil {
        t.Fatalf("MapTriplesToOASF() error = %v", err)
    }

    if len(record.Skills) != 1 {
        t.Errorf("expected 1 skill, got %d", len(record.Skills))
    }
}

OASF Record Structure

Schema Version

The generator produces OASF 1.0.0 compliant records. The schema version is set automatically.

Required Fields
  • name: Agent name (extracted from entity ID)
  • version: Semantic version (from config or entity metadata)
  • schema_version: Always "1.0.0"
  • authors: List of creators (from config or entity metadata)
  • created_at: RFC-3339 timestamp
  • skills[].id: Unique skill identifier
  • skills[].name: Human-readable skill name
Optional Fields
  • description: Agent's purpose (from agent.intent.goal)
  • skills[].description: Skill details
  • skills[].confidence: Self-assessed confidence (0.0-1.0)
  • skills[].permissions[]: Required permissions
  • domains[]: Operating domains
  • extensions: Provider-specific metadata
Validation Rules

The generator validates all records before storage:

  1. Name: Non-empty string
  2. Version: Valid semantic version
  3. Skills: At least one skill with ID and name
  4. Confidence: Between 0.0 and 1.0 if specified
  5. Timestamps: Valid RFC-3339 format

Integration Points

Upstream Components
  • Graph Ingest: Writes entity states that trigger OASF generation
  • Agentic Loop: Updates agent capabilities through graph operations
  • Rule Engine: Can trigger entity state changes
Downstream Components
  • Directory Bridge: Consumes OASF records for AGNTCY directory registration
  • Identity Bridge: Associates OASF records with DID identities
  • SLIM Gateway: Includes OASF metadata in inter-agent messages
Data Flow Example
sequenceDiagram
    participant Agent as Agentic Loop
    participant Graph as Graph Ingest
    participant KV as ENTITY_STATES KV
    participant Gen as OASF Generator
    participant OASF as OASF_RECORDS KV
    participant Dir as Directory Bridge

    Agent->>Graph: Update agent capability
    Graph->>KV: Write entity state
    KV-->>Gen: KV watch notification
    Gen->>Gen: Debounce (1s)
    Gen->>KV: Fetch entity triples
    Gen->>Gen: Map to OASF
    Gen->>Gen: Validate
    Gen->>OASF: Store OASF record
    Gen->>Dir: Publish oasf.record.generated event
    Dir->>OASF: Fetch OASF record
    Dir->>Dir: Register with AGNTCY directory

Performance Characteristics

Debouncing

The generator uses time-based debouncing to batch rapid entity updates:

  • Default: 1 second debounce
  • Behavior: Multiple updates within debounce period trigger single generation
  • Trade-off: Reduces processing load at cost of slight delay in record updates
Concurrency
  • KV Watcher: Single goroutine per component instance
  • Generation: Sequential processing of queued entities
  • Thread-Safe: All state access protected by mutexes
Memory Usage
  • Pending Queue: Minimal (map of entity IDs to timestamps)
  • Triples Cache: No caching, fetched on-demand from KV
  • Record Size: Typically < 5KB per OASF record

Error Handling

Non-Agent Entities

Entities without agent.capability.* predicates are silently skipped:

// Logs debug message, does not generate OASF record
if !hasCapabilityPredicates(triples) {
    logger.Debug("Entity has no capability predicates, skipping")
    return nil
}
Missing Entity States

If an entity is deleted between watch notification and fetch:

// Returns nil error, does not block processing
if IsKVNotFoundError(err) {
    return nil
}
Validation Failures

Invalid OASF records fail with detailed error:

if err := record.Validate(); err != nil {
    return fmt.Errorf("validate OASF record: %w", err)
}
Publication Failures

Event publication failures are logged but don't fail generation:

if err := publishEvent(ctx, eventSubject, eventData); err != nil {
    logger.Warn("Failed to publish event", slog.Any("error", err))
    // Record still stored in KV, considered success
}

Metrics

The component exposes Prometheus metrics through the SemStreams metrics registry:

  • semstreams_oasf_generator_entities_changed_total: Counter of entity change notifications
  • semstreams_oasf_generator_records_generated_total: Counter of successfully generated records
  • semstreams_oasf_generator_errors_total: Counter of generation errors
  • semstreams_oasf_generator_generation_duration_seconds: Histogram of generation time

References

See Also

  • Directory Bridge: Component that registers OASF records with AGNTCY directories
  • Graph Ingest: Upstream component that creates entity states
  • Payload Registry: Pattern documentation for message serialization

Documentation

Overview

Package oasfgenerator provides an OASF (Open Agent Specification Framework) record generator processor component for SemStreams.

Overview

The OASF generator watches for agent entity changes in the ENTITY_STATES KV bucket and generates OASF records that can be used for AGNTCY directory registration. OASF is the standard format for describing agent capabilities in the AGNTCY (Internet of Agents) ecosystem.

NATS Topology

The component uses the following NATS resources:

Input:
  - ENTITY_STATES KV Watch: Monitors for agent entity changes
  - oasf.generate.request: On-demand generation requests (optional)

Output:
  - OASF_RECORDS KV Write: Stores generated OASF records
  - oasf.record.generated.*: Publishes generation events

Predicate Mapping

The generator maps SemStreams predicates to OASF fields:

SemStreams Predicate         -> OASF Field
agent.capability.name        -> skills[].name
agent.capability.description -> skills[].description
agent.capability.expression  -> skills[].id
agent.capability.confidence  -> skills[].confidence
agent.capability.permission  -> skills[].permissions[]
agent.intent.goal            -> description
agent.intent.type            -> domains[].name
agent.action.type            -> extensions.action_types[]

Configuration

Example configuration:

{
  "entity_kv_bucket": "ENTITY_STATES",
  "oasf_kv_bucket": "OASF_RECORDS",
  "watch_pattern": "*.agent.*",
  "generation_debounce": "1s",
  "default_agent_version": "1.0.0",
  "include_extensions": true
}

Usage

The component is typically used as part of a flow configuration:

components:
  - name: oasf-gen
    type: oasf-generator
    config:
      entity_kv_bucket: ENTITY_STATES
      oasf_kv_bucket: OASF_RECORDS

The generated OASF records can then be used by the directory-bridge component to register agents with AGNTCY directories.

OASF Record Structure

Generated records follow the OASF schema:

{
  "name": "agent-architect",
  "version": "1.0.0",
  "schema_version": "1.0.0",
  "authors": ["system"],
  "created_at": "2024-01-15T10:30:00Z",
  "description": "Designs software architecture",
  "skills": [
    {
      "id": "software-design",
      "name": "Software Design",
      "description": "Creates software architecture diagrams",
      "confidence": 0.95,
      "permissions": ["file_system_read"]
    }
  ],
  "domains": [
    {
      "name": "software-architecture"
    }
  ],
  "extensions": {
    "semstreams_entity_id": "acme.ops.agentic.system.agent.architect",
    "source": "semstreams"
  }
}

See Also

- ADR-019: AGNTCY Integration - docs/concepts/20-oasf-integration.md - https://docs.agntcy.org/pages/syntaxes/oasf

Package oasfgenerator provides an OASF (Open Agent Specification Framework) record generator that serializes SemStreams agent capabilities to the AGNTCY standard format.

Index

Constants

View Source
const CurrentSchemaVersion = "1.0.0"

CurrentSchemaVersion is the OASF schema version this implementation supports.

Variables

View Source
var PredicateMapping = map[string]string{

	agentic.CapabilityName:        "skills[].name",
	agentic.CapabilityDescription: "skills[].description",
	agentic.CapabilityExpression:  "skills[].id",
	agentic.CapabilityConfidence:  "skills[].confidence",
	agentic.CapabilityPermission:  "skills[].permissions[]",

	agentic.IntentGoal: "description",
	agentic.IntentType: "domains[].name",

	agentic.ActionType: "extensions.action_types[]",
}

PredicateMapping defines how SemStreams predicates map to OASF fields. This table is for documentation and validation purposes.

Functions

func NewComponent

func NewComponent(rawConfig json.RawMessage, deps component.Dependencies) (component.Discoverable, error)

NewComponent creates a new OASF generator component.

func Register

func Register(registry RegistryInterface) error

Register registers the OASF generator processor component with the given registry.

func SupportedPredicates

func SupportedPredicates() []string

SupportedPredicates returns the list of predicates this mapper handles.

Types

type Component

type Component struct {
	// contains filtered or unexported fields
}

Component implements the OASF generator processor.

func (*Component) ConfigSchema

func (c *Component) ConfigSchema() component.ConfigSchema

ConfigSchema returns the configuration schema.

func (*Component) DataFlow

func (c *Component) DataFlow() component.FlowMetrics

DataFlow returns current data flow metrics.

func (*Component) GenerateForEntity

func (c *Component) GenerateForEntity(ctx context.Context, entityID string) error

GenerateForEntity manually triggers OASF generation for an entity. This is useful for testing and on-demand generation.

func (*Component) Health

func (c *Component) Health() component.HealthStatus

Health returns the current health status.

func (*Component) Initialize

func (c *Component) Initialize() error

Initialize prepares the component.

func (*Component) InputPorts

func (c *Component) InputPorts() []component.Port

InputPorts returns configured input port definitions.

func (*Component) Meta

func (c *Component) Meta() component.Metadata

Meta returns component metadata.

func (*Component) OutputPorts

func (c *Component) OutputPorts() []component.Port

OutputPorts returns configured output port definitions.

func (*Component) Start

func (c *Component) Start(ctx context.Context) error

Start begins watching for entity changes and generating OASF records.

func (*Component) Stop

func (c *Component) Stop(_ time.Duration) error

Stop gracefully stops the component.

type Config

type Config struct {
	// Ports defines the input/output port configuration.
	Ports *component.PortConfig `json:"ports" schema:"type:ports,description:Port configuration,category:basic"`

	// StreamName is the JetStream stream to subscribe to for entity changes.
	StreamName string `json:"stream_name" schema:"type:string,description:JetStream stream name for entity events,category:basic,default:ENTITY"`

	// EntityKVBucket is the KV bucket to watch for entity state changes.
	EntityKVBucket string `json:"entity_kv_bucket" schema:"type:string,description:KV bucket for entity states,category:basic,default:ENTITY_STATES"`

	// OASFKVBucket is the KV bucket to store generated OASF records.
	OASFKVBucket string `json:"oasf_kv_bucket" schema:"type:string,description:KV bucket for OASF records,category:basic,default:OASF_RECORDS"`

	// WatchPattern is the key pattern to watch in the entity KV bucket.
	// Use ">" for all keys (including those with dots) or a specific pattern.
	// Note: "*" only matches single tokens without dots, ">" matches any depth.
	WatchPattern string `json:"watch_pattern" schema:"type:string,description:Key pattern to watch for entity changes,category:advanced,default:>"`

	// GenerationDebounce is the debounce duration for OASF generation after entity changes.
	GenerationDebounce string `json:"generation_debounce" schema:"type:string,description:Debounce duration for generation,category:advanced,default:1s"`

	// ConsumerNameSuffix adds a suffix to consumer names for uniqueness in tests.
	ConsumerNameSuffix string `json:"consumer_name_suffix" schema:"type:string,description:Suffix for consumer names,category:advanced"`

	// DeleteConsumerOnStop enables consumer cleanup on stop (for testing).
	DeleteConsumerOnStop bool `` /* 128-byte string literal not displayed */

	// DefaultAgentVersion is used when an agent doesn't specify its version.
	DefaultAgentVersion string `` /* 132-byte string literal not displayed */

	// DefaultAuthors is used when authors aren't specified in entity metadata.
	DefaultAuthors []string `json:"default_authors" schema:"type:array,description:Default authors for OASF records,category:advanced"`

	// IncludeExtensions enables SemStreams-specific extensions in OASF output.
	IncludeExtensions bool `json:"include_extensions" schema:"type:bool,description:Include SemStreams extensions,category:advanced,default:true"`
}

Config defines the configuration for the OASF generator component.

func DefaultConfig

func DefaultConfig() Config

DefaultConfig returns the default configuration.

func (*Config) GetGenerationDebounce

func (c *Config) GetGenerationDebounce() time.Duration

GetGenerationDebounce returns the debounce duration.

func (*Config) Validate

func (c *Config) Validate() error

Validate validates the configuration.

type EntityState

type EntityState struct {
	ID        string           `json:"id"`
	Triples   []message.Triple `json:"triples"`
	UpdatedAt time.Time        `json:"updated_at"`
}

EntityState represents the stored state of an entity in KV.

type Generator

type Generator struct {
	// contains filtered or unexported fields
}

Generator handles the core OASF record generation logic. It maintains state for pending generations and handles debouncing.

func NewGenerator

func NewGenerator(mapper *Mapper, natsClient *natsclient.Client, config Config, logger *slog.Logger) *Generator

NewGenerator creates a new OASF generator.

func (*Generator) GenerateForEntity

func (g *Generator) GenerateForEntity(ctx context.Context, entityID string) error

GenerateForEntity generates an OASF record for a specific entity.

func (*Generator) Initialize

func (g *Generator) Initialize(ctx context.Context) error

Initialize sets up KV stores for the generator.

func (*Generator) QueueGeneration

func (g *Generator) QueueGeneration(entityID string)

QueueGeneration queues an entity for OASF generation. The actual generation happens after the debounce period.

func (*Generator) Stop

func (g *Generator) Stop()

Stop cleans up the generator resources.

type Mapper

type Mapper struct {
	// contains filtered or unexported fields
}

Mapper converts SemStreams triples to OASF records. It maps agent.capability.*, agent.intent.*, and agent.action.* predicates to the OASF skills and domains format.

func NewMapper

func NewMapper(defaultVersion string, defaultAuthors []string, includeExtensions bool) *Mapper

NewMapper creates a new OASF mapper.

func (*Mapper) MapTriplesToOASF

func (m *Mapper) MapTriplesToOASF(agentID string, triples []message.Triple) (*OASFRecord, error)

MapTriplesToOASF converts a set of triples for an agent entity into an OASF record. The triples should all be about the same agent entity (same subject).

type Metrics

type Metrics struct {
	// contains filtered or unexported fields
}

Metrics holds the Prometheus metrics for the OASF generator.

func (*Metrics) EntityChanged

func (m *Metrics) EntityChanged()

EntityChanged records an entity change event.

func (*Metrics) KVWatchError

func (m *Metrics) KVWatchError()

KVWatchError records a KV watch error.

func (*Metrics) RecordFailed

func (m *Metrics) RecordFailed()

RecordFailed records a failed OASF record generation.

func (*Metrics) RecordGenerated

func (m *Metrics) RecordGenerated(skillCount, domainCount int, duration float64)

RecordGenerated records a successful OASF record generation.

type OASFDomain

type OASFDomain struct {
	// Name is the domain identifier.
	Name string `json:"name"`

	// Description provides details about the domain.
	Description string `json:"description,omitempty"`

	// Priority indicates the agent's focus on this domain (higher = more focused).
	Priority int `json:"priority,omitempty"`
}

OASFDomain represents a domain the agent operates in.

func (*OASFDomain) Validate

func (d *OASFDomain) Validate() error

Validate checks if the OASF domain is valid.

type OASFGeneratedEvent

type OASFGeneratedEvent struct {
	EntityID  string      `json:"entity_id"`
	Record    *OASFRecord `json:"record"`
	Timestamp time.Time   `json:"timestamp"`
}

OASFGeneratedEvent is published when an OASF record is generated.

type OASFRecord

type OASFRecord struct {
	// Name is the human-readable name of the agent.
	Name string `json:"name"`

	// Version is the semantic version of the agent (e.g., "1.0.0").
	Version string `json:"version"`

	// SchemaVersion is the OASF schema version this record conforms to.
	// Currently "1.0.0" is the supported version.
	SchemaVersion string `json:"schema_version"`

	// Authors lists the creators/maintainers of the agent.
	Authors []string `json:"authors"`

	// CreatedAt is when this OASF record was generated (RFC-3339 format).
	CreatedAt string `json:"created_at"`

	// Description provides a human-readable description of the agent's purpose.
	Description string `json:"description"`

	// Skills lists the capabilities the agent possesses.
	Skills []OASFSkill `json:"skills"`

	// Domains lists the domains this agent operates in.
	Domains []OASFDomain `json:"domains,omitempty"`

	// Extensions holds provider-specific metadata.
	Extensions map[string]any `json:"extensions,omitempty"`
}

OASFRecord represents an OASF (Open Agent Specification Framework) record. This is the standard format for describing agent capabilities in the AGNTCY ecosystem. See: https://docs.agntcy.org/pages/syntaxes/oasf

func NewOASFRecord

func NewOASFRecord(name, version, description string) *OASFRecord

NewOASFRecord creates a new OASF record with required fields.

func (*OASFRecord) AddAuthor

func (r *OASFRecord) AddAuthor(author string)

AddAuthor adds an author to the OASF record.

func (*OASFRecord) AddDomain

func (r *OASFRecord) AddDomain(domain OASFDomain)

AddDomain adds a domain to the OASF record.

func (*OASFRecord) AddSkill

func (r *OASFRecord) AddSkill(skill OASFSkill)

AddSkill adds a skill to the OASF record.

func (*OASFRecord) MarshalJSON

func (r *OASFRecord) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler.

func (*OASFRecord) SetExtension

func (r *OASFRecord) SetExtension(key string, value any)

SetExtension sets an extension value.

func (*OASFRecord) Validate

func (r *OASFRecord) Validate() error

Validate checks if the OASF record is valid.

type OASFSkill

type OASFSkill struct {
	// ID is a unique identifier for this skill.
	ID string `json:"id"`

	// Name is the human-readable name of the skill.
	Name string `json:"name"`

	// Description provides details about what this skill does.
	Description string `json:"description,omitempty"`

	// Confidence is the agent's self-assessed confidence in this skill (0.0-1.0).
	Confidence float64 `json:"confidence,omitempty"`

	// Permissions lists the permissions required to execute this skill.
	Permissions []string `json:"permissions,omitempty"`

	// Tags provide categorical labels for skill discovery.
	Tags []string `json:"tags,omitempty"`

	// InputSchema describes the expected input format (JSON Schema).
	InputSchema map[string]any `json:"input_schema,omitempty"`

	// OutputSchema describes the expected output format (JSON Schema).
	OutputSchema map[string]any `json:"output_schema,omitempty"`
}

OASFSkill represents a single capability/skill in an OASF record.

func (*OASFSkill) SkillKey

func (s *OASFSkill) SkillKey() string

SkillKey generates a unique key for a skill for deduplication.

func (*OASFSkill) Validate

func (s *OASFSkill) Validate() error

Validate checks if the OASF skill is valid.

type RegistryInterface

type RegistryInterface interface {
	RegisterWithConfig(component.RegistrationConfig) error
}

RegistryInterface defines the minimal interface needed for registration.

Jump to

Keyboard shortcuts

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