{"id":62209,"date":"2026-03-22T09:50:00","date_gmt":"2026-03-22T06:50:00","guid":{"rendered":"https:\/\/saudishopper.com.sa\/en\/how-openai-codex-works-agent-loop-architecture\/"},"modified":"2026-03-22T09:50:00","modified_gmt":"2026-03-22T06:50:00","slug":"how-openai-codex-works-agent-loop-architecture","status":"publish","type":"post","link":"https:\/\/saudishopper.com.sa\/en\/how-openai-codex-works-agent-loop-architecture\/","title":{"rendered":"How OpenAI Codex Works: Agent Loop, Memory Management, and Multi-Surface Architecture"},"content":{"rendered":"<p class=\"wp-block-paragraph\"><a href=\"\/category\/ai\/\">OpenAI Codex<\/a>, the cloud-based coding agent released by OpenAI, relies on a layered system architecture that extends well beyond its underlying AI model. The core model, codex-1, is a version of OpenAI&#8217;s o3 fine-tuned for software engineering tasks. However, the engineering team said the most complex challenges involved building the orchestration layer around that model.<\/p><h2 class=\"wp-block-heading\">The Agent Loop at the Core of OpenAI Codex<\/h2><p class=\"wp-block-paragraph\">At the center of Codex is an agent loop. The agent takes user input, constructs a prompt, sends it to the model, and receives a response. That response is often a tool call rather than a final answer. The agent then executes the tool call, appends the output to the prompt, and queries the model again. This cycle repeats until the model produces a message for the user.<\/p><p class=\"wp-block-paragraph\">A single request such as &#8220;fix the bug in the auth module&#8221; may trigger the agent to read multiple files, run tests, edit code, resolve linting errors, and run tests again before producing a final commit. The model handles reasoning at each step, while the harness manages command execution, output collection, permission handling, and loop termination.<\/p><h2 class=\"wp-block-heading\">Prompt Construction and Context Window Management<\/h2><p class=\"wp-block-paragraph\">Each user message sits at the bottom of a layered prompt. Above it, the system stacks environment context, AGENTS.md file contents, sandbox permission rules, developer configuration instructions, tool definitions, and a system message. Each layer carries a role \u2014 system, developer, or user \u2014 that signals its priority to the model.<\/p><p class=\"wp-block-paragraph\">The total JSON sent to the <a href=\"\/category\/apps\/\">API<\/a> grows quadratically across a conversation. OpenAI chose not to use server-side state storage, because doing so would break request statelessness and prevent support for customers requiring Zero Data Retention. As a result, every request carries the full conversation history.<\/p><p class=\"wp-block-paragraph\">The primary mitigation is prompt caching. Because Codex always appends new content to the end of the existing prompt, the old prompt is always an exact prefix of the new one. This prefix property allows OpenAI to reuse computation from previous inference calls. However, the prefix is fragile. Changing models, tools, or sandbox configuration breaks the cache. When OpenAI added support for MCP tools, a bug caused tools to list in inconsistent order between requests, which alone destroyed cache hits.<\/p><p class=\"wp-block-paragraph\">When conversations exceed the context window limit, Codex compacts the conversation. It replaces the full history with a smaller representative version that preserves the model&#8217;s understanding through an encrypted payload carrying the model&#8217;s latent state. The OpenAI engineering team stated that managing the context window is a first-class engineering problem, not an afterthought.<\/p><h2 class=\"wp-block-heading\">AGENTS.md Files and Project-Specific Context<\/h2><p class=\"wp-block-paragraph\">AGENTS.md files allow developers to place project-specific instructions directly in their repositories. These files tell Codex how to navigate the codebase, which commands to run for testing, and how to follow project conventions. The model performs better with them but also functions without them. This design keeps project knowledge in the repository rather than hardcoded into the system.<\/p><h2 class=\"wp-block-heading\">The App Server: Enabling Multi-Surface Deployment<\/h2><p class=\"wp-block-paragraph\">Codex started as a command-line tool. OpenAI subsequently needed it to operate inside VS Code, a web application, a macOS desktop app, and third-party IDEs including JetBrains and Xcode. The team first attempted to expose Codex as an MCP server. However, MCP&#8217;s semantics could not support the full interaction patterns the agent required, including streaming progress, mid-task approval pauses, and structured diff output.<\/p><p class=\"wp-block-paragraph\">Consequently, OpenAI built the App Server. All core agent logic \u2014 the agent loop, thread management, tool execution, configuration, and authentication \u2014 lives in a single codebase called &#8220;Codex core.&#8221; The App Server wraps this core in a JSON-RPC protocol that any client can use over standard input\/output. The protocol is fully bidirectional. The client can send requests to the server, and the server can send requests back to the client, such as asking for approval before executing a shell command.<\/p><p class=\"wp-block-paragraph\">The VS Code extension and the desktop app bundle the App Server binary and launch it as a child process. The web app runs the App Server inside a cloud container, streaming events to the browser over HTTP. State lives on the server, so work continues even if the user closes the browser tab. Partners such as Xcode decouple their release cycles from OpenAI&#8217;s by pointing their stable clients at newer App Server binaries as they become available.<\/p><h2 class=\"wp-block-heading\">Current Limitations and Future Direction<\/h2><p class=\"wp-block-paragraph\">OpenAI Codex currently cannot accept image inputs for frontend work. Users cannot course-correct the agent mid-task. Moreover, delegating to a remote <a href=\"\/category\/ai\/\">AI<\/a> agent takes longer than interactive editing, and that workflow shift requires adjustment. OpenAI said the team is working toward a model where interacting with Codex resembles asynchronous collaboration, though the gap between that vision and the current product remains significant.<\/p><blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\"><p>&#8220;The model is a component and the agent is the system. Most of the engineering is in the system.&#8221;<\/p><cite>OpenAI Engineering Team<\/cite><\/blockquote><p class=\"wp-block-paragraph\">The App Server architecture was not planned from the start. It evolved from a CLI, through a failed MCP attempt, to the protocol that now underpins every <a href=\"\/category\/apps\/\">Codex<\/a> surface. OpenAI&#8217;s engineering team said this trajectory illustrates a broader principle in system design: the right abstraction usually does not exist until developers have tried the wrong one.<\/p>","protected":false},"excerpt":{"rendered":"<p>OpenAI Codex uses a three-layer architecture \u2014 an agent loop, layered prompt management, and a multi-surface App Server \u2014 to deliver a cloud-based coding agent across terminals, browsers, and IDEs.<\/p>\n","protected":false},"author":2,"featured_media":62208,"comment_status":"","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_yoast_wpseo_meta-robots-noindex":"","_et_pb_use_builder":"","_et_pb_old_content":"","_et_gb_content_width":"","_pr_autopilot_social_copy":"{\"x_hook\":\"OpenAI Codex is more than an AI model \u2014 it's a three-layer system built around an agent loop, quadratic prompt management, and a custom App Server protocol that powers every surface from VS Code to the web.\",\"x_takeaways\":\"Key Highlights:\\n\ud83d\udd39 The agent loop repeats inference and tool calls until the model produces a final user message\\n\ud83d\udd39 Conversation history grows quadratically, mitigated by prompt caching with a strict prefix property\\n\ud83d\udd39 A custom App Server replaced a failed MCP attempt to enable multi-surface deployment across IDEs and web\"}","_yoast_wpseo_opengraph_title":"","_yoast_wpseo_opengraph_description":"","_yoast_wpseo_opengraph_image":"","_yoast_wpseo_opengraph_image_id":0,"_yoast_wpseo_twitter_title":"","_yoast_wpseo_twitter_description":"","_yoast_wpseo_twitter_image":"","_yoast_wpseo_twitter_image_id":0,"_yoast_wpseo_primary_category":0,"_extra_hide_author_box":"1","_extra_featured_post":"","_partner_post_id":83983,"footnotes":""},"categories":[442,449],"tags":[2732,2731,2734,2730,2733],"class_list":["post-62209","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-apps","category-ai","tag-agent-loop","tag-ai-coding-agent","tag-app-server","tag-openai-codex","tag-prompt-engineering","et-has-post-format-content","et_post_format-et-post-format-standard"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v28.7 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>OpenAI Codex Architecture Explained | Saudi Shopper<\/title>\n<meta name=\"description\" content=\"OpenAI Codex relies on an agent loop, layered prompt management, and a custom App Server protocol to operate across VS Code, web, and third-party IDEs.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/saudishopper.com.sa\/en\/how-openai-codex-works-agent-loop-architecture\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"OpenAI Codex Architecture Explained | Saudi Shopper\" \/>\n<meta property=\"og:description\" content=\"OpenAI Codex relies on an agent loop, layered prompt management, and a custom App Server protocol to operate across VS Code, web, and third-party IDEs.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/saudishopper.com.sa\/en\/how-openai-codex-works-agent-loop-architecture\/\" \/>\n<meta property=\"og:site_name\" content=\"Saudishopper\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/SaudiShopper\" \/>\n<meta property=\"article:published_time\" content=\"2026-03-22T06:50:00+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/saudishopper.com.sa\/en\/wp-content\/uploads\/2026\/03\/openai-codex-agent-loop-architecture-diagram.webp\" \/>\n\t<meta property=\"og:image:width\" content=\"1200\" \/>\n\t<meta property=\"og:image:height\" content=\"628\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/webp\" \/>\n<meta name=\"author\" content=\"saudishopper\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@ssict\" \/>\n<meta name=\"twitter:site\" content=\"@ssict\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"saudishopper\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"4 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/saudishopper.com.sa\\\/en\\\/how-openai-codex-works-agent-loop-architecture\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/saudishopper.com.sa\\\/en\\\/how-openai-codex-works-agent-loop-architecture\\\/\"},\"author\":{\"name\":\"saudishopper\",\"@id\":\"https:\\\/\\\/saudishopper.com.sa\\\/en\\\/#\\\/schema\\\/person\\\/75f95b68a450c611a56cdd18d6b2c667\"},\"headline\":\"How OpenAI Codex Works: Agent Loop, Memory Management, and Multi-Surface Architecture\",\"datePublished\":\"2026-03-22T06:50:00+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/saudishopper.com.sa\\\/en\\\/how-openai-codex-works-agent-loop-architecture\\\/\"},\"wordCount\":877,\"publisher\":{\"@id\":\"https:\\\/\\\/saudishopper.com.sa\\\/en\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/saudishopper.com.sa\\\/en\\\/how-openai-codex-works-agent-loop-architecture\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/saudishopper.com.sa\\\/en\\\/wp-content\\\/uploads\\\/2026\\\/03\\\/openai-codex-agent-loop-architecture-diagram.webp\",\"keywords\":[\"Agent Loop\",\"AI Coding Agent\",\"App Server\",\"OpenAI Codex\",\"Prompt Engineering\"],\"articleSection\":[\"Apps &amp; Software\",\"Artificial Intelligence\"],\"inLanguage\":\"en-US\",\"copyrightYear\":\"2026\",\"copyrightHolder\":{\"@id\":\"https:\\\/\\\/saudishopper.com.sa\\\/en\\\/#organization\"}},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/saudishopper.com.sa\\\/en\\\/how-openai-codex-works-agent-loop-architecture\\\/\",\"url\":\"https:\\\/\\\/saudishopper.com.sa\\\/en\\\/how-openai-codex-works-agent-loop-architecture\\\/\",\"name\":\"OpenAI Codex Architecture Explained | Saudi Shopper\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/saudishopper.com.sa\\\/en\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/saudishopper.com.sa\\\/en\\\/how-openai-codex-works-agent-loop-architecture\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/saudishopper.com.sa\\\/en\\\/how-openai-codex-works-agent-loop-architecture\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/saudishopper.com.sa\\\/en\\\/wp-content\\\/uploads\\\/2026\\\/03\\\/openai-codex-agent-loop-architecture-diagram.webp\",\"datePublished\":\"2026-03-22T06:50:00+00:00\",\"description\":\"OpenAI Codex relies on an agent loop, layered prompt management, and a custom App Server protocol to operate across VS Code, web, and third-party IDEs.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/saudishopper.com.sa\\\/en\\\/how-openai-codex-works-agent-loop-architecture\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/saudishopper.com.sa\\\/en\\\/how-openai-codex-works-agent-loop-architecture\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/saudishopper.com.sa\\\/en\\\/how-openai-codex-works-agent-loop-architecture\\\/#primaryimage\",\"url\":\"https:\\\/\\\/saudishopper.com.sa\\\/en\\\/wp-content\\\/uploads\\\/2026\\\/03\\\/openai-codex-agent-loop-architecture-diagram.webp\",\"contentUrl\":\"https:\\\/\\\/saudishopper.com.sa\\\/en\\\/wp-content\\\/uploads\\\/2026\\\/03\\\/openai-codex-agent-loop-architecture-diagram.webp\",\"width\":1200,\"height\":628,\"caption\":\"OpenAI Codex system architecture diagram showing agent loop, prompt management, and App Server layers\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/saudishopper.com.sa\\\/en\\\/how-openai-codex-works-agent-loop-architecture\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/saudishopper.com.sa\\\/en\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How OpenAI Codex Works: Agent Loop, Memory Management, and Multi-Surface Architecture\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/saudishopper.com.sa\\\/en\\\/#website\",\"url\":\"https:\\\/\\\/saudishopper.com.sa\\\/en\\\/\",\"name\":\"Saudishopper\",\"description\":\"Saudi ICT Shopper News\",\"publisher\":{\"@id\":\"https:\\\/\\\/saudishopper.com.sa\\\/en\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/saudishopper.com.sa\\\/en\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/saudishopper.com.sa\\\/en\\\/#organization\",\"name\":\"Saudi ICT News\",\"alternateName\":\"Saudi ICT Shopper News\",\"url\":\"https:\\\/\\\/saudishopper.com.sa\\\/en\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/saudishopper.com.sa\\\/en\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/saudishopper.com.sa\\\/en\\\/wp-content\\\/uploads\\\/2020\\\/08\\\/SSTrans.png\",\"contentUrl\":\"https:\\\/\\\/saudishopper.com.sa\\\/en\\\/wp-content\\\/uploads\\\/2020\\\/08\\\/SSTrans.png\",\"width\":423,\"height\":165,\"caption\":\"Saudi ICT News\"},\"image\":{\"@id\":\"https:\\\/\\\/saudishopper.com.sa\\\/en\\\/#\\\/schema\\\/logo\\\/image\\\/\"},\"sameAs\":[\"https:\\\/\\\/www.facebook.com\\\/SaudiShopper\",\"https:\\\/\\\/x.com\\\/ssict\"]},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/saudishopper.com.sa\\\/en\\\/#\\\/schema\\\/person\\\/75f95b68a450c611a56cdd18d6b2c667\",\"name\":\"saudishopper\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/6b02621f0881cdcf27f6e1ea0dd3fac1d5934209dcb8becac4f4fffe5abf17ea?s=96&d=https%3A%2F%2Fsaudishopper.com.sa%2Fen%2Fwp-content%2Fuploads%2F2020%2F12%2Fcropped-ss-icon--150x150.png&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/6b02621f0881cdcf27f6e1ea0dd3fac1d5934209dcb8becac4f4fffe5abf17ea?s=96&d=https%3A%2F%2Fsaudishopper.com.sa%2Fen%2Fwp-content%2Fuploads%2F2020%2F12%2Fcropped-ss-icon--150x150.png&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/6b02621f0881cdcf27f6e1ea0dd3fac1d5934209dcb8becac4f4fffe5abf17ea?s=96&d=https%3A%2F%2Fsaudishopper.com.sa%2Fen%2Fwp-content%2Fuploads%2F2020%2F12%2Fcropped-ss-icon--150x150.png&r=g\",\"caption\":\"saudishopper\"},\"url\":\"https:\\\/\\\/saudishopper.com.sa\\\/en\\\/author\\\/saudishopper\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"OpenAI Codex Architecture Explained | Saudi Shopper","description":"OpenAI Codex relies on an agent loop, layered prompt management, and a custom App Server protocol to operate across VS Code, web, and third-party IDEs.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/saudishopper.com.sa\/en\/how-openai-codex-works-agent-loop-architecture\/","og_locale":"en_US","og_type":"article","og_title":"OpenAI Codex Architecture Explained | Saudi Shopper","og_description":"OpenAI Codex relies on an agent loop, layered prompt management, and a custom App Server protocol to operate across VS Code, web, and third-party IDEs.","og_url":"https:\/\/saudishopper.com.sa\/en\/how-openai-codex-works-agent-loop-architecture\/","og_site_name":"Saudishopper","article_publisher":"https:\/\/www.facebook.com\/SaudiShopper","article_published_time":"2026-03-22T06:50:00+00:00","og_image":[{"width":1200,"height":628,"url":"https:\/\/saudishopper.com.sa\/en\/wp-content\/uploads\/2026\/03\/openai-codex-agent-loop-architecture-diagram.webp","type":"image\/webp"}],"author":"saudishopper","twitter_card":"summary_large_image","twitter_creator":"@ssict","twitter_site":"@ssict","twitter_misc":{"Written by":"saudishopper","Est. reading time":"4 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/saudishopper.com.sa\/en\/how-openai-codex-works-agent-loop-architecture\/#article","isPartOf":{"@id":"https:\/\/saudishopper.com.sa\/en\/how-openai-codex-works-agent-loop-architecture\/"},"author":{"name":"saudishopper","@id":"https:\/\/saudishopper.com.sa\/en\/#\/schema\/person\/75f95b68a450c611a56cdd18d6b2c667"},"headline":"How OpenAI Codex Works: Agent Loop, Memory Management, and Multi-Surface Architecture","datePublished":"2026-03-22T06:50:00+00:00","mainEntityOfPage":{"@id":"https:\/\/saudishopper.com.sa\/en\/how-openai-codex-works-agent-loop-architecture\/"},"wordCount":877,"publisher":{"@id":"https:\/\/saudishopper.com.sa\/en\/#organization"},"image":{"@id":"https:\/\/saudishopper.com.sa\/en\/how-openai-codex-works-agent-loop-architecture\/#primaryimage"},"thumbnailUrl":"https:\/\/saudishopper.com.sa\/en\/wp-content\/uploads\/2026\/03\/openai-codex-agent-loop-architecture-diagram.webp","keywords":["Agent Loop","AI Coding Agent","App Server","OpenAI Codex","Prompt Engineering"],"articleSection":["Apps &amp; Software","Artificial Intelligence"],"inLanguage":"en-US","copyrightYear":"2026","copyrightHolder":{"@id":"https:\/\/saudishopper.com.sa\/en\/#organization"}},{"@type":"WebPage","@id":"https:\/\/saudishopper.com.sa\/en\/how-openai-codex-works-agent-loop-architecture\/","url":"https:\/\/saudishopper.com.sa\/en\/how-openai-codex-works-agent-loop-architecture\/","name":"OpenAI Codex Architecture Explained | Saudi Shopper","isPartOf":{"@id":"https:\/\/saudishopper.com.sa\/en\/#website"},"primaryImageOfPage":{"@id":"https:\/\/saudishopper.com.sa\/en\/how-openai-codex-works-agent-loop-architecture\/#primaryimage"},"image":{"@id":"https:\/\/saudishopper.com.sa\/en\/how-openai-codex-works-agent-loop-architecture\/#primaryimage"},"thumbnailUrl":"https:\/\/saudishopper.com.sa\/en\/wp-content\/uploads\/2026\/03\/openai-codex-agent-loop-architecture-diagram.webp","datePublished":"2026-03-22T06:50:00+00:00","description":"OpenAI Codex relies on an agent loop, layered prompt management, and a custom App Server protocol to operate across VS Code, web, and third-party IDEs.","breadcrumb":{"@id":"https:\/\/saudishopper.com.sa\/en\/how-openai-codex-works-agent-loop-architecture\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/saudishopper.com.sa\/en\/how-openai-codex-works-agent-loop-architecture\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/saudishopper.com.sa\/en\/how-openai-codex-works-agent-loop-architecture\/#primaryimage","url":"https:\/\/saudishopper.com.sa\/en\/wp-content\/uploads\/2026\/03\/openai-codex-agent-loop-architecture-diagram.webp","contentUrl":"https:\/\/saudishopper.com.sa\/en\/wp-content\/uploads\/2026\/03\/openai-codex-agent-loop-architecture-diagram.webp","width":1200,"height":628,"caption":"OpenAI Codex system architecture diagram showing agent loop, prompt management, and App Server layers"},{"@type":"BreadcrumbList","@id":"https:\/\/saudishopper.com.sa\/en\/how-openai-codex-works-agent-loop-architecture\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/saudishopper.com.sa\/en\/"},{"@type":"ListItem","position":2,"name":"How OpenAI Codex Works: Agent Loop, Memory Management, and Multi-Surface Architecture"}]},{"@type":"WebSite","@id":"https:\/\/saudishopper.com.sa\/en\/#website","url":"https:\/\/saudishopper.com.sa\/en\/","name":"Saudishopper","description":"Saudi ICT Shopper News","publisher":{"@id":"https:\/\/saudishopper.com.sa\/en\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/saudishopper.com.sa\/en\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/saudishopper.com.sa\/en\/#organization","name":"Saudi ICT News","alternateName":"Saudi ICT Shopper News","url":"https:\/\/saudishopper.com.sa\/en\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/saudishopper.com.sa\/en\/#\/schema\/logo\/image\/","url":"https:\/\/saudishopper.com.sa\/en\/wp-content\/uploads\/2020\/08\/SSTrans.png","contentUrl":"https:\/\/saudishopper.com.sa\/en\/wp-content\/uploads\/2020\/08\/SSTrans.png","width":423,"height":165,"caption":"Saudi ICT News"},"image":{"@id":"https:\/\/saudishopper.com.sa\/en\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/SaudiShopper","https:\/\/x.com\/ssict"]},{"@type":"Person","@id":"https:\/\/saudishopper.com.sa\/en\/#\/schema\/person\/75f95b68a450c611a56cdd18d6b2c667","name":"saudishopper","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/6b02621f0881cdcf27f6e1ea0dd3fac1d5934209dcb8becac4f4fffe5abf17ea?s=96&d=https%3A%2F%2Fsaudishopper.com.sa%2Fen%2Fwp-content%2Fuploads%2F2020%2F12%2Fcropped-ss-icon--150x150.png&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/6b02621f0881cdcf27f6e1ea0dd3fac1d5934209dcb8becac4f4fffe5abf17ea?s=96&d=https%3A%2F%2Fsaudishopper.com.sa%2Fen%2Fwp-content%2Fuploads%2F2020%2F12%2Fcropped-ss-icon--150x150.png&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/6b02621f0881cdcf27f6e1ea0dd3fac1d5934209dcb8becac4f4fffe5abf17ea?s=96&d=https%3A%2F%2Fsaudishopper.com.sa%2Fen%2Fwp-content%2Fuploads%2F2020%2F12%2Fcropped-ss-icon--150x150.png&r=g","caption":"saudishopper"},"url":"https:\/\/saudishopper.com.sa\/en\/author\/saudishopper\/"}]}},"_links":{"self":[{"href":"https:\/\/saudishopper.com.sa\/en\/wp-json\/wp\/v2\/posts\/62209","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/saudishopper.com.sa\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/saudishopper.com.sa\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/saudishopper.com.sa\/en\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/saudishopper.com.sa\/en\/wp-json\/wp\/v2\/comments?post=62209"}],"version-history":[{"count":0,"href":"https:\/\/saudishopper.com.sa\/en\/wp-json\/wp\/v2\/posts\/62209\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/saudishopper.com.sa\/en\/wp-json\/wp\/v2\/media\/62208"}],"wp:attachment":[{"href":"https:\/\/saudishopper.com.sa\/en\/wp-json\/wp\/v2\/media?parent=62209"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/saudishopper.com.sa\/en\/wp-json\/wp\/v2\/categories?post=62209"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/saudishopper.com.sa\/en\/wp-json\/wp\/v2\/tags?post=62209"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}