Skip to content

Podcast

ChatGPT Codex- The Missing Manual

Latent Space: The AI Engineer Podcast

Source ↗ ← All highlights
  • Origin Story of ChatGPT Codex
    • Alexander Embiricos shared how his prior work on a pair programming tool evolved into building an AI software engineer with reasoning models and tool access.
    • Their early experiments led to Codex, giving an agent access to a computer to safely perform software engineering tasks autonomously. Transcript: Alexander Embiricos Yeah, maybe I can go first because then we have a fun story about how we started working together. Okay, so actually before working at OpenAI, I was working on a native macOS software called Multi, which is like about, it was kind of like a pair programming tool, but we thought of ourselves As working on human-to collaboration, and then basically as Chatapiti and stuff came around, we started thinking about, oh, what if instead of a human pair programming with a human, It was like a human pair programming with an AI? So I’ll skip this whole journey, but that was this whole journey, and then we all ended up joining OpenAI. And I was mostly working on desktop software. And then we shipped reasoning models. And, you know, I’m sure you guys were like head of the curve in terms of understanding the value of reasoning models. But for me, like, it’s kind of like, starts off as better chat, but then when you can give it tools, you can actually like make it an agent, right? Like an agent is like a reasoning model with tools and environment, guardrails, and then maybe training on specific tasks. So anyways, we got super interested in that, and we were just starting to think about, okay, how do we bring reasoning models into desktop? And at the same time here at OpenAI, there was a lot of experiments going on with giving these reasoning models access to terminals. I wasn’t working on those first experiments, to be clear, but that was like the first true like, wow, I really feel the AGI moment that I had. It was actually while I was talking to David Kay, a designer who was working on this thing called Scientist, and he showed me this demo of it updating itself. And like nowadays, like, I don’t know if anyone of us would be like, the most impressed to like change the background color modifying its own code. Swyx Yeah. Alexander Embiricos And then you know, it was like, it had hot reloading setup. So I was just like, mind blown at the time. And I was still a super cool demo. And so we kind of were experimenting with a bunch of these. And I sort of joined one of the teams that was like tinkering with this. And, you know, we kind of realized like, hey, it’s just like super valuable to figure out how to give a reasoning model access to a terminal. And then now we have to figure out like how to make that like a useful product and how to make it safe, right? Like you can’t just let it go loose on your local file system, but that’s where people were initially trying to use it. So a lot of those learnings ended up becoming the Codex CLI, which shipped recently. A lot of the work there, the thinking that I’m most proud of is enabling things like full auto mode. And when you do that, we actually increase the amount of sandboxing so that’s still safe for you. And then so you know we were working on these types of things and then we started realizing uh we want to let the model think for longer we want to have a bigger model um we want to let the model Like do more things safely like without having to do any approvals um and so we thought um you know maybe we should give the model its own computer, the agent its own computer. And then at the same time, we were also experimenting with, like, putting the CLI in, like, our CI so it could automatically fix tests. We did this, like, crazy hack to, like, get it to automatically fix, like, linear tickets in our issue tracker. And so then we ended up sort of, like, creating this project that is Codex, which is basically, like really the concept of giving the agent access to a computer. Actually, I realized that. I don’t know if you were asking. Well, I personally did. But anyways, I told the story. I hope (Time 0:01:58)
  • Josh Ma’s Path to Codex
    • Josh Ma described his journey from founding Airplane to joining OpenAI and contributing to ChatGPT Codex.
    • He highlighted the similarity in themes between internal tools and AI-driven software engineering agents. Transcript: Swyx Two. Josh Ma Yeah. Yeah. So my story is somewhat different. Had OpenEdge for two months here, and it’s been one of the most fun, chaotic two months of my life. But maybe I’ll start back at the company I had founded a few years back called Airplane. We were building an internal tool platform. The idea is to let you build internal tools but really lean into developers and make that really easy. And it sounds unrelated but in many ways like the similar themes started coming up. What’s the right form factor for doing local development? How do you deploy tooling to the cloud? How do you run code in the cloud? How do you compose all these primitives of storage and compute and UI to let developers build software really quickly. I like to joke that we were just, I don’t know, two years too early. Towards the end, we were playing around with, like, GPT 3.5 and, you know, trying to really make… It was really cool. It could actually build, like, a React view really quickly, right? And I think, you know, if we had kept going on it, maybe it would have turned into some of the AI builders that you see today but that company ended up getting acquired by Airtable where I ran some of the the AI engineering teams there and for me personally towards the beginning of this year I saw the progress we’re making in software, agentic software development. And for me, it was a bit like my own moon landing kind of moment that I suspected was about to happen, right? Whether or not I was involved in the next two years, I think we are going to build an agentic software engineer. And so I talked to my friend over here. I was like, hey, are you guys working on something like this? And, you know, you can see a wide-eyed look. He’s like, I’m not allowed to tell you anything, but maybe you could talk to the team. And so very fortunately, this was right when, you know, Alex and folks were spinning up things. And I remember actually, you know, in our interview, we riffed on the form factor, right? Should it be CLI? The issues with that, waiting for it to finish and not being able to interrupt all the time, wanting to run it four times, ten times in parallel. And, you know, at that point I said maybe it should be both. And we sort of are, you know, going for that right now. But, yeah, I don’t know. I’ll just say, like, I was very excited and still very excited to just be pushing this forward. (Time 0:05:27)
  • Use agents.md and Linting
    • Use an agents.md file to instruct AI agents with hierarchical and prioritized instructions.
    • Gradually invest in linting and formatting to help agents generate consistent and testable code. Transcript: Swyx No but yeah if you could list uh some things out that’s that’s like best practices you know i i noted from the live stream that uh they mentioned pro users install linters and formatters So that basically these are in the loop verifiers that the agent can kind of use. Right. So which, like, you know, it turns out to be dev best practices as well. But now the agents can also auto use it. Commit hooks have always been a tricky thing for humans, because I’ve been on teams that are like, no, everyone, everything has to have a commit hook. And then I’ve also been on teams that were like, no, like this thing gets in the way of committing. So let’s rip everything out. But actually for agents, it’s actually really good to have commit hooks. Josh Ma Yeah, I mean, you took the words out of my mouth. I think the three I was going to say would be, one, agents.md. And we put a lot of effort into making sure the agent understand this hierarchy of instructions, right? You can put them in subdirectories, and it’ll understand which ones take precedence over which others so over time right like I mean we also have like O3 and Fora writing our agents empty Files for us. Swyx I love these I love the tips you actually open source this the the prompt descriptions here yeah yeah yeah anything to highlight yeah Um, I mean, I think I would start simple and not try Josh Ma To overdo it. And like a simple agents IMD will get you a long way rather than no agents IMD. Um, and then it’s more of like you learn over time, right? And what we really like to do is auto generate this at some point for you based on the PRs you create and the feedback you give. But, know, we figured we ship faster rather than later. Swyx So you mentioned you have 03, 04 writing HSMD for you as well. Josh Ma Yeah, like, I’ll, like, give it my entire directory, right, and just say, like, hey, produce an HSMD. Well, actually, these days I’m using Codex1 to do it because it can traverse, Codex1, sorry, to traverse, like, your directory tree and generate those things for you. So yeah, I would recommend slowly, gradually investing in AgentsMD. And then, you know, you took the words out of my mouth, like getting very basic linting, formatting up, that’s your really big wins because it’s similar to how like if you open a new project In VS Code, right? You get some out-of checking. The agent’s starting. As a human, you’re starting without that advantage. And so this is trying to give that back to the… And, yeah, I don’t know. Did you add anything else? (Time 0:14:20)
  • AI Agent as Junior Engineer
    • AI agents resemble knowledgeable, spikily intelligent college grads gaining first-day job experience at your company.
    • agents.md helps compress their learning curve and helps the agent perform tasks better on your codebase. Transcript: Alexander Embiricos Yeah, so one analogy there. And then actually I have just some thoughts we’ve observed of even using other coding agents, just any you know, how to prepare for that. But like, you know, the analogy I kind of like is like you. So if you start with like a base reasoning model, actually, you basically have this like really precocious, like incredibly intelligent, incredibly knowledgeable and like weirdly Spikily intelligent, you know, college grad, you know. But we all know if you hire, like, that person and put them, like, ask them to do software engineering work, like, independently, like, there’s just a lot of practices that they’re not Going to know about. And so kind of a lot of what we’ve done with Codex I is basically give it its first few years of job experience. And, like, that’s effectively what the training is, right? So that it just, it kind of knows more of these things. And like, if you think about it, like a PR description is a classic example of that, like writing a good PR description, right? And possibly knowing what not to put in it, actually, right? And then, so that’s what you get there. So now you have this like, this like, weirdly, weirdly knowledgeable, spikily intelligent college grad with a few years of job experience. And then every time you kick off a task, it’s kind of like their first day at your company. Right. And so agents.md is basically a method for you to kind of compress that test time exploration that it has to do so it can know more. And as Josh said, obviously we want to like right now it’s research preview. So you have to update it yourself. But there’s like lot of ideas we have for how to make that automatic. So that’s just a fun analogy. Josh Ma Yeah, maybe the last one I’ll say is make your code base discoverable. It’s the equivalent of maintaining good engineering practices for new hires that you make, letting them understand your code base faster. A lot of my prompts start with, I’m working in this subdirectory. Here’s what I’d like to accomplish, right? Can you please do it for me? And so giving that guidance at scoping helps. Yeah. (Time 0:16:47)
  • Language and Architecture Matter
    • Choose modern, typed languages like TypeScript for better AI agent support.
    • Design modular and testable architecture to maximize AI assistance effectiveness. Transcript: Alexander Embiricos Okay, I’ll give you three, sorry, three things for like generally. So first, like language choice. I was hanging out with a friend the other day, who’s a bit of a latecomer to AI, and he was like, oh yeah, I want to try building like an agent’s product. Like, should I build it in JavaScript? And I was like, you’re still using JavaScript? Like, no wonder. Like, you just like, you know, you use at least TypeScript, like give it some types. So, I mean, I think that’s a basic one. I don’t think anyone listening to us now needs to be told this. Another one is like, you just make your code modular, right? The more modular and testable it is, the better. But you don’t even have to write the test. Like an agent can write the test, but you kind of need to design the architecture to be modular, right? I saw this presentation recently by someone here who was like, they weren’t vibe coding. It was like professional software engineer, but using like tools like Codex to like build a new system. And they got to build a system from scratch. And there was kind of this graph of like their commit velocity. And then their system had some traction, so then it was like, okay, now we’re going to port it into the monolith that is the overall Chatshapiti code base that has seen ridiculous hypergrowth, And so maybe is not the most architecturally pre-planned. And their commit rate, the same engineer, same tooling, actually the AI tooling continues to improve, their commit rate just plummets. And so I think the other thing is just like, yeah, architecture, like good architecture is like even more important than ever. And like, I guess the fun thing is like, for now, that’s the thing that humans are really good at. So like, you know, kind of good, you know, important for the software engineers to do their job. I don’t know, just don’t look at my code base. Swyx Yeah, well, definitely don’t look at mine. The (Time 0:18:41)
  • Balancing Agent and Human Readability
    • Human-AI collaboration requires keeping code readable and understandable by humans despite aiming for agent efficiency.
    • Communication with agents remains rooted in human language and understanding to support code reviews and deployments. Transcript: Alessio Fanelli Would you name, would you start naming things less for humans readability and more for agent readability? Like what’s kind of the trade off in your mind? Josh Ma Yeah, I, it’s interesting, because I definitely had different priors coming into OpenAI. I currently believe that the systems are actually very convergent. Like, there’s a lot of… Maybe it’s because as long as you see humans and AI writing it, like maybe there’s a world where it’s only AI is maintaining a code base and the assumptions change. But the moment you sort of had to break that fourth wall and a human is coming in, doing code review, deploying the code, it has human fingerprints all over it. And so how humans communicate to AI, where to make the change, how humans communicate a bug that needs to be done, or communicate business requirements, all those things aren’t going To go away immediately. And so I think the whole system still feels actually very human. I think there’s a cooler answer I could say that it’s like oh no it’s like this alien thing it’s completely different but I don’t know I think it’s like these are started off as large language Models there’s a lot rooted in human communication. (Time 0:21:19)
  • Flexible Context and Reasoning
    • Design AI agents to actively search and grep for instructions like agents.md rather than preloading everything in context.
    • Allow models to reason flexibly rather than hardcoding all guardrails, enabling emergent planning and adaptation. Transcript: Swyx What if I just have a super long HSMD? In your live stream, you had it demoing on the OpenAI monorepo, which is just giant, right? So how do you manage caching and context windows and all that? Josh Ma Yeah. I mean, would you believe me if I told you right now that it all fits in the context window? Not the OpenAI repo. No, sorry. Everything that the agent needs. Swyx Right. So you reify the agent’s MD, put it at the top, right? It’s just like another system prompt. Josh Ma No, actually, it’s a file that the agent knows how to, like, grep and set for, right? Okay. Because there might be multiple ones. And so you can actually see it in the work log, right? It’s, like, going to look for, it very aggressively looks for an agent’s ID. It’s been trained to do that. I’ll say it’s been really interesting joining OpenAI and seeing how when you’re thinking about where models are going and what AI products will look like years from now, you design Products in a different way. Before OpenAI, especially when you don’t have access to a team of researchers and many main GPUs, you’re building these deterministic programs, right? A lot of scaffolding around how this operates. But you don’t really let the model operate as full capacity, right? A lot of, it was interesting one I just joined actually, I got a lot of pushback saying like, hey, why don’t we just like hard code, like, listen, you keep using this tool wrong, let’s just Say in our prompt don’t do that and then the researchers will be like no no no we don’t do that we’re like we’re gonna do it the right way we’re gonna teach the model why this is the right way To do it um and I think that’s like related to this overall thought like where do you put the deterministic guardrails in and where do you really let the model think, right? Similar conversation around planning. Should we just have an explicit planning stage where it’s like think out loud first, write down what you’re going to do, and then go do it? Sure, but what if the task is really easy, right? Do you really want to think of this whole time? What if it needs to like replan as it goes? Like do you have all these like if-else conditions, heuristics to do that? Or do you train a really good model that knows how to switch between those modes of thinking? And so it’s tough. Like, I definitely have advocated for, like, little guardrails here and there until, like, the next training run’s done. But I think that’s really, like, we’re really building for this future where the model is able to make all these decisions. What’s really important is that you give it the right tool, right? You give it ways to manage context, manage memory, manage, you know, ways to explore the code base. (Time 0:26:30)
  • Delegating Complexity To Models
    • Balancing roles among user, developer, and model is critical to managing decisions in AI-driven software development.
    • Pushing complexity from developers into models enables solving increasingly complex tasks and cooperative agent teams. Transcript: Alexander Embiricos The model isn’t all the product, but the model is the product. And you kind of need to have this kind of humility in terms of thinking about, okay, well, what are the things that we… There’s three parties, right? There’s the user, the developer, and the model maybe, right? What are the things that the user just needs to decide up front? And then what are the things that we, the developer, are going to be able to decide better than the model? And then what are the things that the model can just decide best? And every decision just has to be one of those three. And it’s not like everything is the model. For instance, we have two buttons in the UI right now, like ask and code. And those probably could get inlined into the decisions the model makes. But, you know, right now it was just really like it made sense to kind of just give the user choice up front because we spawn a different container for the model first based on what button You press. So like if you ask for code, we put all the dependencies in. I’m going to oversimplify here. But if you don’t ask for code, if you’re just asking a question, we do a much quicker container setup before the model gets any choice. And so that’s maybe a user decision. There’s some places where user and developer decisions kind of come together around the environment. But ultimately, a lot of agents that I see are really impressive, but it’s basically part of what’s impressive is it’s like a bunch of developers building this like really bespoke state Machine around a bunch of like short model calls. And so then the upper bound of like complexity of problem that the model can tackle is kind of actually just what can fit in the developer’s brain. Right. And over time, we want these models to capture like or to solve for much more complex problems uh you know like just by themselves on like more and more complex individual tasks and then Eventually you could really imagine that you get like a team of agents working together maybe with like one agent that’s kind of managing those agents and you know the complexity just Explodes and so we really want to like get as much of that complexity as much of that state machine as possible like pushed into the model and so you end up with these kind of two modes of Building like in one place you’re like building product UI and rules. And in the other case, you’re, you still have to do work to get the model to learn something. (Time 0:29:17)
  • Improve Scope Guidance for Agents
    • Help AI agents understand code scoping by instructing them explicitly about directories or files to focus on.
    • Implement architectural indexing and search to improve agent efficiency in large codebases. Transcript: Alessio Fanelli But how do you build the product to get those signals? So if you think about the code in Ask, it’s almost you’re basically getting the user to label the prompt in a way, right? Because they say, Ask, this is an Ask prompt, code, this is a code prompt. Are there any other kind of like fun product designs, like as you built this, of like, okay, we think the model can learn this, but we don’t have the data. This is how we architect codecs to kind of help us collect that data. Josh Ma I think file context and scoping is, we don’t have great built-in things like that right now, but it’s like one of the obvious things that we need to add is another example of this, right? Like you could have, we’re often usually pleasantly surprised as, oh, it was able to find the exact file that I was thinking about, but it takes some time, right? And so a lot of times you’ll shortcut a bunch of chain of thought by just saying, hey, I’m looking at this directory. (Time 0:31:44)
  • Transfer from Specialized Models
    • Training specialized models for specific coding tasks helps improve mainline generalized models.
    • Transfer learning provides outsized benefits across domains from focused research efforts. Transcript: Alexander Embiricos You know, like another example, we do do this on occasion. Like, for example, recently we released GPT 4.1, like, really good coding model. And again, that was like, based on like, working, we were like, hey, we want to invest better in this area. Let’s hang out with a bunch of developers, understand their feedback, how things work, you know, create some evals. And, you know, like you said, this is like, it’s a lot of work to do that. But then we end up with a great model. And even more exciting, we can then like take those learnings and like put them into our mainline models and then everything benefits. (Time 0:35:43)
  • Long-Running Agent Task Times
    • Currently, tasks run up to 30 minutes typically, with a hard cutoff at one hour.
    • Complex tasks often require lengthy autonomous agent operation to iterate and test effectively. Transcript: Alexander Embiricos Actually when you bring that and you bring it into the generalized model, you might even get outsized returns on that because there’s transfer from all these different domains. Swyx Okay, cool. I think we had a couple factual things to wrap up on just like Codex itself, and then we wanted to double click on the compute platform stuff, which I think Josh, you wanted to cover more On. So I noticed in the details, it was between one to 30 minutes in length. Is that a hard cutoff? Have you had it go for longer? Any comment on the task time? Josh Ma Yeah, I mean, I just checked the code base before this. Someone else has a similar question. Our hard cutoffs an hour right now, although don’t hold us to that. It may change over time. The longest is I’ve seen two hours when in development mode and the model went off the rails. So, you know, but I think 30 minutes is a ballpark for the kind of tasks that we’re trying to solve, right? (Time 0:36:26)
  • Adopt an Abundance Mindset
    • Use an abundance mindset by rapidly delegating many prompts to agents without overthinking.
    • Running multiple tasks in parallel improves productivity and user satisfaction. Transcript: Alexander Embiricos But in the near term, like, yeah, this is a tool you delegate to. And the way to use it that we see, like, you know, going back to, I guess, maybe the title of this podcast of, like, best practices, it’s like you must have an abundance mindset and you must Think of it as, like, not using your time to explore things. And so, like, you know, often when something, a model is going to work on your computer and it’s going to work on your computer, you’ll like really craft the prompt because you know, then It’s going to use your computer for a while and maybe you can’t. But the way we see people who like love Codex the most using it is they think for like maybe 30 seconds max about their prompt. It’s just like, oh, I have this idea like boom. Oh, there’s this thing I want to do like boom. Oh, like I just saw this bug or like this customer feedback thing like and you just send it off. And so, yeah, like, the more you’re running in parallel, actually, I think the, I mean, the happier we are and, like, the happier we think, like, users are when they see it. (Time 0:39:19)
  • Manage Agent Environment Access
    • Provide your AI agents scripted environment setups to install dependencies and prepare tooling.
    • Currently, the agents run without internet access for safety, but environment interactivity is evolving. Transcript: Alessio Fanelli They can only instruct the model to do it. Any other things people should keep in mind? Josh Ma Yeah, so, and I’ll say it’s an evolving discussion as we figure out what parts we can give folks access to and the agent and what we need to hold back for now, right? And so we’re learning and we would like to give humans and agents alike as much access as possible within safety and security constraints. What you can do today is, as a human, set up an environment, set up scripts that get them run. These scripts typically will be installing dependencies. I expect that to be maybe 95% of the use case there. And just really get all the right binaries in place for your agent to use. We actually do have like a bit of an environment editing experience where as a human you can drop into a REPL, try things out. So, you know, please don’t abuse it. But there’s definitely ways for you to interact with the environment there. Alexander Embiricos We laugh about that because earlier I mentioned scope creep. We weren’t planning on having a REPL to interactively update your environment, but anyway, Josh was like, oh man, we need this. And so that was an example. Josh Ma Scope creep. Alexander Embiricos Thanks for doing it. Josh Ma We do have rate limits in place, and we do monitor that very carefully. But there’s interactive bits of there to, like, to get that going. But once the agent starts running, right, what we actually do today, and we’re hoping to, like, evolve on this, is we’ll cut off internet access because we still don’t fully understand What letting loose an agent in its own environment is going to do, right? You know, for now, the safety tests all have come back very sturdily, like, you know, it’s not susceptible to sorts of certain exfiltration attempts on prompt injection. But there’s still a lot of risk to this category, so we don’t know. And that’s why to start, we’re being more conservative there. And when the agent’s running, it doesn’t have full network access. But, you know, I’d love to be able to change that, right, allow it to give limited access to certain domains or certain repositories. And so all that’s to say, it’s like something we’re evolving as we build out the right systems to support that. Not sure that quite touches on your original question. The last thing, though, that I do want to mention is like, there’s an interactivity element with like, you know, as the agent’s running, sometimes you’re just like, oh, I want to like Correct it, tell it to like go somewhere else. Or, you know, let me maybe fill this part out and then you can take back over. Right. We haven’t quite solved those problems either. What we really wanted to start was to like shoot for the fully independent, just like deliver massive value in one shot kind of approach. (Time 0:41:43)
  • Customize Your AI Environment
    • Customize your AI development environment for high fidelity to improve agent performance.
    • Share preferences on environment setup like dev containers to help OpenAI tailor better support. Transcript: Alessio Fanelli Call to action? Are you growing the team? Do you want specific feedback from the community? Yeah. Josh Ma I think for me, the one thing that, you know, is really on my mind for getting better at over the next few months is really helping you customize your environment more in a more high fidelity Manner. It turns out the good news is the agent can do a lot of really good work with only the basics, right? It’s much like if your dev machine is borked and you’re sort of looking at your editor, but none of the type checks are working. A lot of folks can still actually do a lot of good work. But how do you get close at last, you know, 30%, 40% And it’s really hard because there’s such a wide variety of environments out there, but especially would love feedback from folks On how they would like to see their environment customized. Do they want to just ship us a darker image? Would they rather have us support dev containers, right? So the form factor of how you do, the DX of how you do environment customization, still very much an open question that we need to improve on. (Time 0:49:50)
  • Explore and Provide Feedback
    • Experiment with ChatGPT Codex to discover your most effective workflows and prompting methods.
    • Take advantage of the current generous rate limits to provide feedback and guide product improvement. Transcript: Alexander Embiricos Yeah, big plus one to that. And I think for me, maybe the thing that I’m most interested in is, hey, this is like a new shape of tool to collaborate with. And I’m just really interested for people to try working with it in as many different ways as possible and kind of figure out where does it work well in your workflow? Like you mentioned earlier, you were trying to use it kind of like your IDE and then you realized it was different. So I would just love for people to take advantage, especially now. We’re very intentionally just providing very generous rate limits so people can try it. We just want you to try it and figure out what sticks, what works, what doesn’t, how do you prompt it, and then we want to learn from that and use that to lean in. (Time 0:50:53)