automagent import

Convert agent definitions from CrewAI, OpenAI, and other frameworks

Usage

$ automagent import <path> [options]

The <path> argument is required and points to the source file you want to convert.

Options

FlagDescriptionDefault
-o, --output <path>Output file path./agent.yaml
-f, --format <format>Force source format: crewai, openai, langchainAuto-detect
--forceOverwrite existing output fileOff

Format auto-detection

When you don’t specify --format, the CLI inspects the source file to determine its format:

FormatDetected when
CrewAIFile is .yaml or .yml and contains role, goal, and backstory fields
OpenAIFile is .json and contains instructions and model fields
LangChainFile is .json and contains prompt or system_message with llm or agent_type fields

If auto-detection fails, use --format to specify explicitly.

Field mapping

CrewAI

CrewAI fieldAutomagent field
rolename
goal + backstoryinstructions
llmmodel
toolstools
Other fieldsextensions.crewai

OpenAI Agents SDK

OpenAI fieldAutomagent field
namename
instructionsinstructions
modelmodel
toolstools
handoffsdependencies.agents
Other fieldsextensions.openai

LangChain

LangChain fieldAutomagent field
name or metadata.name or agent_typename
prompt or system_messageinstructions
llm (string or object with model/model_name)model
llm.temperature, llm.max_tokensmodel.settings
toolstools (with args_schema mapped to inputSchema)
tagsmetadata.tags
Other fieldsextensions.langchain

Fields that don’t map cleanly are preserved under the extensions namespace so nothing is lost. Auto-generated descriptions and any fields that need human review are marked with # TODO: Review comments in the output.

Examples

Import a CrewAI agent:

$ automagent import ./crewai-agent.yaml

Given a CrewAI file like:

role: Senior Data Analyst
goal: Analyze sales data and identify trends
backstory: >
  You are an experienced data analyst with 10 years
  of experience in retail analytics.
llm: gpt-4
tools:
  - search_tool
  - csv_reader

The resulting agent.yaml:

apiVersion: v1
kind: agent

name: senior-data-analyst
version: 0.1.0
description: Senior Data Analyst # TODO: Review

model: gpt-4

instructions: |
  Goal: Analyze sales data and identify trends

  Backstory: You are an experienced data analyst with 10 years
  of experience in retail analytics.

tools:
  - name: search_tool
  - name: csv_reader

extensions:
  crewai:
    role: Senior Data Analyst

Import an OpenAI assistant:

$ automagent import ./assistant.json -o research-agent.yaml

Given an OpenAI assistant JSON:

{
  "name": "research-assistant",
  "instructions": "You help researchers find and summarize academic papers.",
  "model": "gpt-4o",
  "tools": [
    { "type": "code_interpreter" },
    { "type": "file_search" }
  ]
}

The resulting agent.yaml:

apiVersion: v1
kind: agent

name: research-assistant
version: 0.1.0
description: research-assistant # TODO: Review

model: gpt-4o

instructions: |
  You help researchers find and summarize academic papers.

tools:
  - name: code_interpreter
  - name: file_search

extensions:
  openai:
    tools:
      - type: code_interpreter
      - type: file_search

Import a LangChain agent:

$ automagent import ./langchain-agent.json

Given a LangChain config like:

{
  "name": "Research Agent",
  "system_message": "You help researchers find and summarize papers.",
  "llm": {
    "model": "gpt-4",
    "temperature": 0.7
  },
  "tools": [
    { "name": "search_papers", "description": "Search academic papers" }
  ],
  "tags": ["research", "academic"]
}

The resulting agent.yaml:

apiVersion: v1
kind: agent

name: research-agent
version: 0.1.0
description: Imported from LangChain agent: Research Agent # TODO: Review

model:
  id: gpt-4
  settings:
    temperature: 0.7

instructions: |
  You help researchers find and summarize papers.

tools:
  - name: search_papers
    description: Search academic papers

metadata:
  tags:
    - research
    - academic

Force a specific format:

$ automagent import ./config.json --format openai --force

Custom output path:

$ automagent import ./legacy-agent.yaml -o agents/converted.yaml

Notes

  • Schema validation runs automatically after import. You will see any warnings or errors in the generated file immediately.
  • Review # TODO: Review comments in the output. These mark auto-generated fields (like description) and unmapped values that may need adjustment.
  • The name field is automatically slugified from the source (lowercased, spaces replaced with hyphens, invalid characters removed).
  • The command will not overwrite an existing output file unless --force is passed.
  • Unmapped fields are preserved in extensions.<framework> so you can reference the original values.

See also