GenX Agent Configuration

Configuration parsing and serialization for agents and tools.

Note: This package is Go-only. No Rust implementation exists.

Design Goals

  1. Declarative Configuration: Define agents/tools in YAML/JSON
  2. Reference System: Support $ref for reusable components
  3. Validation: Validate configuration at parse time
  4. Serialization: Support JSON, YAML, and MessagePack

Configuration Types

Agent Types

TypeDescriptionConfiguration
reactReAct pattern agentReActAgent
matchRouter/matcher agentMatchAgent

Tool Types

TypeDescriptionConfiguration
httpHTTP API toolHTTPTool
generatorLLM generation toolGeneratorTool
compositeTool pipelineCompositeTool
text_processorText manipulationTextProcessorTool

Reference System

The $ref system allows reusing components:

# Reference an agent
agent:
  $ref: agent:weather_assistant

# Reference a tool
tools:
  - $ref: tool:search
  - $ref: tool:calculator

Reference format: {type}:{name}

TypeDescription
agent:{name}Reference to registered agent
tool:{name}Reference to registered tool
rule:{name}Reference to match rule
prompt:{name}Reference to prompt template

Configuration Structure

ReActAgent

type: react
name: assistant
prompt: |
  You are a helpful assistant.
generator:
  model: gpt-4
  temperature: 0.7
context_layers:
  - type: env
    vars: ["USER_NAME"]
  - type: mem
    limit: 10
tools:
  - $ref: tool:search
    quit: false
  - $ref: tool:goodbye
    quit: true

MatchAgent

type: match
name: router
rules:
  - $ref: rule:weather
  - $ref: rule:music
route:
  - rules: [weather]
    agent:
      $ref: agent:weather_assistant
  - rules: [music]
    agent:
      type: react
      name: music_inline
      prompt: |
        You are a music assistant.
default:
  $ref: agent:chat

HTTPTool

type: http
name: weather_api
description: Get weather data
url: https://api.weather.com/v1/current
method: GET
headers:
  Authorization: "Bearer {{.api_key}}"
params:
  - name: city
    in: query
    required: true
  - name: units
    in: query
    default: "metric"
extract: .data.temperature

GeneratorTool

type: generator
name: summarize
description: Summarize text
prompt: |
  Summarize the following text in 2-3 sentences:
  {{.text}}
generator:
  model: gpt-3.5-turbo

CompositeTool

type: composite
name: search_and_summarize
description: Search and summarize
steps:
  - tool: search
    output_var: results
  - tool: summarize
    input_vars:
      text: results

Validation

Configuration is validated during parsing:

  • Required fields checked
  • Type consistency verified
  • References validated (at runtime)
  • Enum values validated