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
| Flag | Description | Default |
|---|---|---|
-o, --output <path> | Output file path | ./agent.yaml |
-f, --format <format> | Force source format: crewai, openai, langchain | Auto-detect |
--force | Overwrite existing output file | Off |
Format auto-detection
When you don’t specify --format, the CLI inspects the source file to determine its format:
| Format | Detected when |
|---|---|
| CrewAI | File is .yaml or .yml and contains role, goal, and backstory fields |
| OpenAI | File is .json and contains instructions and model fields |
| LangChain | File 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 field | Automagent field |
|---|---|
role | name |
goal + backstory | instructions |
llm | model |
tools | tools |
| Other fields | extensions.crewai |
OpenAI Agents SDK
| OpenAI field | Automagent field |
|---|---|
name | name |
instructions | instructions |
model | model |
tools | tools |
handoffs | dependencies.agents |
| Other fields | extensions.openai |
LangChain
| LangChain field | Automagent field |
|---|---|
name or metadata.name or agent_type | name |
prompt or system_message | instructions |
llm (string or object with model/model_name) | model |
llm.temperature, llm.max_tokens | model.settings |
tools | tools (with args_schema mapped to inputSchema) |
tags | metadata.tags |
| Other fields | extensions.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: Reviewcomments in the output. These mark auto-generated fields (likedescription) and unmapped values that may need adjustment. - The
namefield is automatically slugified from the source (lowercased, spaces replaced with hyphens, invalid characters removed). - The command will not overwrite an existing output file unless
--forceis passed. - Unmapped fields are preserved in
extensions.<framework>so you can reference the original values.
See also
- Import guide — Step-by-step walkthrough with more detail
- automagent validate — Review warnings after import
- Field reference — Understand the target format