what-is-codex

What is Codex?

In the previous post, we created our first ChatGPT Project and learned how Projects can help organize conversations, files, instructions, and long-running work.

In this post, we will introduce Codex, a powerful AI coding agent designed to help developers write, understand, test, review, and modify software.

Codex is different from a normal ChatGPT conversation. While ChatGPT can explain code and help you write code, Codex is designed specifically for software development and can work with local folders, repositories, terminals, and developer tools.

What is Codex?

Codex is an AI coding agent developed by OpenAI.

It can help developers with many software-development tasks, including:

  • Writing code
  • Understanding existing code
  • Debugging problems
  • Running tests
  • Reviewing code changes
  • Modifying files
  • Working with software repositories
  • Running commands and development tools

Instead of simply giving you a piece of code in a conversation, Codex can work with an actual software project and help carry out development tasks.

OpenAI describes Codex as an AI agent that helps developers write, review, and ship code.

Codex vs ChatGPT

It is important to understand the difference between ChatGPT and Codex.

ChatGPT is a general-purpose AI assistant. You can use it for:

  • Questions and answers
  • Research
  • Writing
  • Analysis
  • Learning
  • Programming assistance
  • Brainstorming

Codex is focused on software development.

For example, in ChatGPT you might ask:

Explain this C# code and tell me what it does.

ChatGPT can analyze the code and explain it.

With Codex, you can give it a software-development task such as:

Review this project, find the authentication problem, run the tests, and propose the necessary changes.

Codex can work directly with the development environment and the files that you give it access to.

Codex is an AI Agent

This is particularly important for our AI Agents Step-by-Step series.

Codex is an example of an AI Agent designed for a specific domain.

Its domain is software development.

A traditional chatbot might answer:

How do I fix a null reference exception in C#?

An AI coding assistant might provide an example of a solution.

Codex can go further by working with your actual project, examining files, running commands or tests, reviewing the results, and making changes when you authorize it.

This is an example of an AI Agent moving from simply generating information to performing actions toward a goal.

How Codex Works

A simplified view of Codex looks like this:

Developer

Task / Goal

Codex

Understand the project

Plan the work

Read and modify files

Run commands and tests

Review the results

Provide the result to the developer

The actual workflow can be more complex, but this model helps explain why Codex is considered an AI coding agent.

What Can Codex Do?

1. Write Code

You can ask Codex to implement a new feature.

For example:

Add a REST API endpoint for creating customers.

Codex can inspect the existing project structure and implement the feature according to the project’s existing patterns.

2. Understand Existing Code

Large software projects can contain thousands or even millions of lines of code.

You can ask:

Explain how authentication works in this project.

Codex can inspect the relevant files and explain how the components work together.

3. Debug Problems

Suppose your application is producing an error.

You can provide the problem to Codex:

The application crashes when a user logs in. Find the cause and suggest a fix.

Codex can investigate the relevant code and help identify the problem.

4. Run Tests

Codex can work with development tools and run tests when appropriate.

For example:

Run the unit tests and identify any failures.

It can inspect the test results and help determine what needs to be fixed.

5. Review Code

Codex can also help review changes.

For example:

Review the changes in this feature and identify possible security or performance problems.

This can be useful before committing code or creating a pull request.

6. Modify Existing Files

Instead of simply telling you what code to change, Codex can work with the project files you provide access to.

For example:

Refactor the CustomerService class and add unit tests.

Codex can inspect the existing implementation, make appropriate changes, and run tests to verify the result.

Codex and Your Local Computer

One important difference between normal ChatGPT conversations and Codex is that Codex can work with local development environments.

In the ChatGPT desktop application, Codex can work with:

  • Local folders
  • Git repositories
  • Terminals
  • Developer tools

You give Codex access to the project or folder it needs to work with.

This means you can work with an actual software project instead of copying and pasting every file into a chat.

Example: Working With a C# Project

Imagine you have an ASP.NET Core application stored on your computer.

Your project might look like:

CustomerManagement/
│
├── Controllers/
├── Services/
├── Models/
├── Data/
├── Tests/
├── Program.cs
└── CustomerManagement.csproj

You can give Codex access to this project and ask:

Analyze this application and explain its architecture.

Codex can inspect the project and provide an overview.

You could then ask:

Add an API endpoint for updating customer information.

After that:

Create unit tests for the new endpoint.

And finally:

Run the tests and report any failures.

This is much closer to working with a software-development team member than simply asking questions in a chatbot.

Codex and Git

Codex can also work with Git-based development workflows.

For example, you might ask it to:

Review the changes in this repository.

Or:

Identify problems in the current changes and suggest improvements.

Depending on the environment and permissions, Codex can work with repositories and development tools to support your normal software-development workflow.

As always, developers should review changes before accepting or deploying them.

Permissions and Safety

Because Codex can interact with development tools and files, permissions are important.

You should not give an AI Agent unrestricted access to everything on your computer.

A good practice is to:

  • Give access only to the project it needs.
  • Review requested permissions.
  • Review changes before accepting them.
  • Avoid exposing passwords, API keys, or other secrets.
  • Use appropriate Git practices.
  • Test changes before deploying them.

AI-generated code can contain mistakes or security problems, so developers remain responsible for reviewing and validating the results.

Codex and the ChatGPT Desktop Application

In the current ChatGPT desktop application, ChatGPT and Codex are separate experiences.

From the desktop application, you can select ChatGPT or Codex from the top-level menu.

ChatGPT provides general-purpose AI capabilities, while Codex is dedicated to software development. Codex also maintains a separate history from normal ChatGPT conversations.

The exact interface may change as OpenAI continues to update the desktop application.

Do I Need an API Key?

If you are using Codex through your ChatGPT account, you can sign in with your ChatGPT account rather than manually entering an API key. Codex is currently included across ChatGPT plans, although usage limits vary by plan.

This is important because an OpenAI API key and a ChatGPT account are not the same thing.

An API key is primarily used by applications and developers to access OpenAI APIs programmatically.

Codex in the ChatGPT application can use your ChatGPT account for authentication.

Codex vs an AI Agent We Build Ourselves

Codex is an example of a specialized AI Agent that has already been developed for us.

Later in this series, we will learn how developers can build their own AI Agents.

For example, imagine building a Customer Support Agent.

It might have:

  • An LLM
  • Instructions
  • Memory
  • Customer database access
  • Knowledge base
  • Search tools
  • Email tools
  • Planning capabilities
  • Security controls

The Agent could receive a goal such as:

Help the customer solve the problem and create a support ticket if necessary.

Codex follows a similar general concept, but its specialized purpose is software development.

ChatGPT, Codex, and AI Agents

We can now make an important distinction:

ChatGPT

A general-purpose AI assistant that can help with many different tasks.

Codex

A specialized AI coding agent designed for software development.

Our own AI Agent

A system that we build for a specific business or technical purpose.

For example:

ChatGPT → General assistance

Codex → Software development

Customer Support Agent → Customer support

DevOps Agent → Infrastructure and deployment

Research Agent → Research and analysis

This is one of the most important concepts in modern AI development: AI Agents can be specialized for particular goals and domains.

What Have We Learned?

In this tutorial, we learned that:

  • Codex is an AI coding agent from OpenAI.
  • It is designed specifically for software development.
  • It can work with local folders and repositories.
  • It can inspect and modify code.
  • It can run commands and tests.
  • It can help debug and review software.
  • It can support Git-based development workflows.
  • Codex is different from the general ChatGPT experience.
  • Codex is an example of a specialized AI Agent.

Codex gives us a practical example of what an AI Agent can do when it has access to tools and a specific goal.

Conclusion

Codex is much more than a tool that generates programming code. It is an AI coding agent that can work with software projects, development tools, files, repositories, and tests.

For developers, this represents an important change in how we interact with AI. Instead of asking an AI only for information, we can give it a development goal and allow it to work through multiple steps toward that goal, while keeping the developer in control.

This concept is at the heart of AI Agent development.

In the next post, we will learn more about Using Projects and how Projects can help us organize long-running development work, files, conversations, and instructions.

Using Projects

← Back to AI Agents – Step-by-Step

← Back to Home Page