Skip to content

Migrating OpenAGI to AgentSpec

OpenAGI is an open-source AGI research platform that orchestrates multiple specialized task-solving agents with LLMs. This guide shows how to represent it as an agent.yaml manifest.

What OpenAGI Has

ComponentOpenAGIAgentSpec field
ModelOpenAI GPT-4 (configurable)spec.model.provider: openai
ToolsTask-specific expert models (CV, NLP, Audio)spec.tools[]
PlanningLLM-based task decompositionspec.subagents[]
MemoryIn-memory conversation historyspec.memory.shortTerm
EvaluationBuilt-in task success metricsspec.evaluation

The Manifest

yaml
apiVersion: agentspec.io/v1
kind: AgentSpec

metadata:
  name: openagi-orchestrator
  version: 1.0.0
  description: "AGI research platform — orchestrates specialized task-solving agents via LLM planning"
  tags: [research, agi, multi-agent, task-solving]
  license: Apache-2.0

spec:
  model:
    provider: openai
    id: gpt-4-0125-preview
    apiKey: $env:OPENAI_API_KEY
    parameters:
      temperature: 0.0
      maxTokens: 2000
    fallback:
      provider: openai
      id: gpt-3.5-turbo
      apiKey: $env:OPENAI_API_KEY
      triggerOn: [rate_limit, timeout]
      maxRetries: 3
    costControls:
      maxMonthlyUSD: 500
      alertAtUSD: 400

  prompts:
    system: $file:prompts/task_planning.md
    fallback: "Task planning temporarily unavailable. Please retry."

  tools:
    - name: image-classification
      type: function
      description: "Classify images using ResNet/ViT expert model"
      module: $file:openagi/expert_models/vision.py
      function: classify_image
      annotations:
        readOnlyHint: true
        destructiveHint: false
        idempotentHint: true

    - name: text-summarization
      type: function
      description: "Summarize documents using fine-tuned T5"
      module: $file:openagi/expert_models/nlp.py
      function: summarize_text
      annotations:
        readOnlyHint: true
        destructiveHint: false
        idempotentHint: true

    - name: audio-transcription
      type: function
      description: "Transcribe audio using Whisper"
      module: $file:openagi/expert_models/audio.py
      function: transcribe_audio
      annotations:
        readOnlyHint: true
        destructiveHint: false
        idempotentHint: true

    - name: task-decomposer
      type: function
      description: "Decompose a complex task into subtasks"
      module: $file:openagi/planner.py
      function: decompose_task
      annotations:
        readOnlyHint: false
        destructiveHint: false

  memory:
    shortTerm:
      backend: in-memory
      maxTurns: 50
      maxTokens: 16000
    hygiene:
      piiScrubFields: []
      auditLog: false

  evaluation:
    framework: custom
    metrics:
      - faithfulness
      - answer_relevancy
    thresholds:
      faithfulness: 0.75
    ciGate: false

  observability:
    tracing:
      backend: langsmith
      sampleRate: 0.1
    logging:
      level: info
      structured: true

  guardrails:
    input:
      - type: prompt-injection
        action: reject
        sensitivity: medium
    output:
      - type: toxicity-filter
        threshold: 0.8
        action: reject

  compliance:
    packs:
      - owasp-llm-top10
      - model-resilience

  requires:
    envVars:
      - OPENAI_API_KEY
    minimumMemoryMB: 2048

Running the Migration

bash
# 1. Write the manifest
agentspec validate agent.yaml

# 2. Health check (with OPENAI_API_KEY set)
agentspec health agent.yaml

# 3. Audit
agentspec audit agent.yaml
# Expected: ~72/100 (C) — no long-term memory, no CI gate, $env not $secret

Audit Results

RuleStatusReason
MODEL-01Fallback GPT-3.5 configured
MODEL-03Cost controls set
SEC-LLM-01Prompt injection guard
SEC-LLM-06No long-term memory (N/A)
SEC-LLM-09CI gate not enabled
SEC-LLM-10Uses $env: not $secret:
EVAL-02CI gate disabled

Generating LangGraph Code

bash
export ANTHROPIC_API_KEY=your-api-key-here
agentspec generate agent.yaml --framework langgraph --output ./generated/

This produces agent.py with:

  • GPT-4 + GPT-3.5 fallback via llm.with_fallbacks()
  • All 4 tool functions bound to the model
  • In-memory MemorySaver checkpointer
  • LangSmith tracing enabled
  • Prompt injection guard in guardrails.py

Export as A2A AgentCard

bash
agentspec export agent.yaml --format agentcard
json
{
  "name": "openagi-orchestrator",
  "description": "AGI research platform — orchestrates specialized task-solving agents via LLM planning",
  "version": "1.0.0",
  "capabilities": {
    "streaming": false,
    "stateTransitionHistory": false
  },
  "skills": []
}

Released under the Apache 2.0 License.