[AmazonTranslate]ターミナルで動作するOpenAIのコーディングエージェントCodexを試してみた

[AmazonTranslate]ターミナルで動作するOpenAIのコーディングエージェントCodexを試してみた

This is Kokura from the Osaka office.

It seems that a coding agent that works on a terminal has appeared in the OpenAI repository.

https://github.com/openai/codex https://github.com/openai/codex

If I had to say it works in a terminal, would it be like Claude Code? I gave it a quick try.

OpenAI Codex

The README explains it as follows.

  • No setup required, can only be used with an OpenAI API key
  • Safe and secure execution with full automatic authorization, network disabling, and directory sandboxing
  • Multimodal support. Diagrams and screenshots can be handed over

Also, the operation modes are as follows,

  • Suggest (suggestion: default)
    • Authorization is required when writing a file or running a shell
  • Auto Edit (Auto Edit)
    • Requires approval when running the shell
  • Full Auto (fully automatic)
    • No approval required

It seems that it has become.

Also, there is a description that execution is designed to work in a sandbox.

I'll try

Follow the README to install it.

npm install -g @openai /codex 

Open a terminal and set the OpenAI API Key below. This time, I set it to the current session, but it seems that it's OK to write it in.zshrc, etc.

export OPENAI_API_KEY="your-api-key-here” 

Start it in the appropriate repository. I started it in the AWS generative-ai-use-cases repository I had at hand.
Note that when starting up in the home directory, Warning! IT CAN BE DANGEROUS TO RUN A CODING AGENT OUTSIDE OF A GIT REPO IN CASE THERE ARE CHANGES THAT YOU WANT TO REVERT. Do you want to continue? I was warned, so I turned back...

https://github.com/aws-samples/generative-ai-use-cases https://github.com/aws-samples/generative-ai-use-cases

It starts up.

codex 

vscode-drop-1744839224758-a8hnbdl1gs4.png
An interactive interface has been launched.
Looking at the help command, it was stated that o4-mini is used by default. (Can be changed with the -m option) We'll use it as is now.

The README is in English, but I'll ask “Please explain this code base.”
After waiting for a while, the following appeared

vscode-drop-1744839284736-z1cgm14ixpr.png

I'll also try creating a file. Since it's in Suggest mode, it should be confirmed when creating a file.
Now I entered the command in one line without opening interactive mode.

codex “Please create a markdown file describing this code base” 

vscode-drop-1744839255973-5aldhd7chq.png

After the description was displayed, a command to create a file was displayed.

vscode-drop-1744839262233-nywtyntov7k.png
I was asked if I wanted to execute the command, so when I chose YES, the file was successfully created!

summary

I did a quick test of the agent Codex that can be used in the terminal.
Since it works with a terminal, it has a wide range of applications, and usage examples with GitHub Actions and sample input content are also written in the README, so I'd like to try these out as well.

There is a description that Codex itself is still under development, so I would like to keep a close eye on it from now on.

References

GitHub - openai/codex: Lightweight coding agent that runs in your terminal

Share this article

facebook logohatena logotwitter logo

© Classmethod, Inc. All rights reserved.