Dev.to
How I Fixed OpenAI Assistants API Timeout Errors in Production
It was during a live client demo. The AI was mid-session. The user was answering questions. Everything was going perfectly. Then — this: "Sorry, there was an error processing your request. Please try again." The client looked at us. My manager looked at me. I looked at my laptop and wanted to disappear. The Investigation First thing I checked: OpenAI dashboard. No failed runs. Nothing. I checked our server logs. There it was: run_timeout — after exactly 60 seconds But here's the thing — the run wasn't failing. It was just slow. OpenAI was still processing. Our backend gave up at 60s. OpenAI finished at 87s. We quit too early. Why Does This Happen? The longer a session gets, the more history OpenAI has to process. Early in a session: 3–5 seconds. Mid-session (10+ messages): 30–50 seconds. Long sessions: 60–90+ seconds. Our hardcoded limit of 60 seconds wasn't matching reality. The Fix Step 1: Made the timeout configurable via environment variable. # .env OPENAI_RUN_TIMEOUT_MS=150000 Step 2: Updated the polling loop to use it. const TIMEOUT_MS = parseInt ( process . env . OPENAI_RUN_TIMEOUT_MS ) || 150000 ; const TERMINAL = [ ' completed ' , ' failed ' , ' cancelled ' , ' expired ' , ' requires_action ' ]; while ( ! TERMINAL . includes ( runStatus . status )) { if ( Date . now () - startTime >= TIMEOUT_MS ) throw new Error ( ' run_timeout ' ); await new Promise ( r => setTimeout ( r , 1000 )); runStatus = await openai . beta . threads . runs . retrieve ( threadId , run . id ); } Step 3: Deployed. No more errors. Lessons Learned Always handle ALL 5 terminal states — not just "completed" Never hardcode timeouts for AI workloads — they vary by session length Your error logs and OpenAI dashboard together tell the full story What's Next I'm exploring runs.stream() — streaming responses in real time, no polling, no timeouts. Will write a follow-up once it's in production. Have you hit this before? How did you handle it? Drop it in the comments.
Admin Test
2026-06-30 14:55
👁 8
查看原文 →
Dev.to
Hardcoding LLM prompts is fine until it isn't. Here's what we built instead.
I had a bug last month that took most of a Saturday to find. A support bot we shipped started promising refund timelines that didn't match policy. Customer complaints, frantic Slack messages, the usual. The prompt had changed three weeks earlier. Nobody could remember why. Git blame pointed to a one-line edit inside a 200-line SYSTEM_PROMPT constant. No PR description, no diff worth reading. That's when I knew I'd been writing prompts wrong for the last two years. PromptOT - Prompt Management Platform Compose prompts from typed blocks, version safely, and deliver to your apps via API. The prompt management platform built for AI engineering teams. promptot.com Prompts are code, but we treat them like Notion docs A typical system prompt for anything useful crams five things into one string: You are a friendly support agent for Acme. Use this knowledge: {{kb}}. Follow escalation rules. Never share internal ticket IDs. Reply in plain text, two to four paragraphs. That's a role, context, instructions, guardrails, and an output format all jammed together. When the PM wants to soften the tone, they're editing the same string an engineer uses to update the knowledge base. When security adds a guardrail, it lands inches from the response format. One bad edit and every reply ships broken. We wouldn't write code this way. So why are prompts always a 200-line const somewhere in lib/ ? What I built PromptOT is a prompt management platform. The core idea is small: typed blocks instead of flat strings. You break a prompt into pieces. Each piece has a type — role, context, instructions, guardrails, output_format, custom. Each one is independently editable, can be toggled on or off, and has its own version history. The compiler joins them into a single prompt string at delivery time. Block 1 — role : " You are a support agent for Acme..." Block 2 — context : " Knowledge base: {{kb}}..." Block 3 — instructions : " 1. Acknowledge the issue..." Block 4 — guardrails : " Never share inte
PromptOT
2026-06-30 14:53
👁 9
查看原文 →
Dev.to
I checked my OpenAI and Anthropic dashboards every morning for a month. Then I stopped.
OpenAI usage page, check spend. Anthropic console, check spend. Add it up in my head. Close both...
Lolo
2026-06-30 14:53
👁 5
查看原文 →
Dev.to
Hackathon Winners Scoop $35,000 In Cash And Credits
After a marathon 48 hours of coding, the winners of the AI Engineer World's Fair Hackathon have been...
Iain Thomson
2026-06-30 14:52
👁 11
查看原文 →
Dev.to
The Workflow is the Product: Why Enterprise AI Must Move Beyond Copilots
For the last few years, many enterprise AI conversations have started with the same question: “Where can we add an AI copilot?” It is an understandable starting point. Copilots are familiar. They sit inside existing tools, help users draft content, summarize information, search documents, write code, or answer questions. For teams experimenting with AI, they feel safe. But after 10 years of building mobile apps, web platforms, AI systems, internal tools, and enterprise-grade products, I have learned something that sounds simple but changes the whole strategy: The workflow is the product. Not the chatbot. Not the prompt box. Not the model. Not the dashboard. The workflow. Enterprise AI only becomes valuable when it changes how work actually moves across people, systems, approvals, decisions, and data. That is why companies now need to move beyond standalone copilots and toward AI workflow automation, enterprise AI agents, and agentic workflows that are designed around real operational outcomes. Copilots Help. Workflows Transform. An AI copilot is useful when a person needs assistance inside a task. It can draft an email, summarize a meeting, search policy documents, or help an engineer understand code. These are valuable use cases. But they usually improve a single moment of work, not the complete business process. A workflow, on the other hand, connects the full chain. For example, consider enterprise customer onboarding. A copilot may summarize the sales call. A workflow system can take that summary, extract requirements, identify missing information, create onboarding tasks, notify customer success, update the CRM, generate a kickoff plan, check billing setup, and flag delivery risks. That is a very different level of impact. AI Copilot AI Workflow Automation Assists one user Coordinates work across teams Responds when asked Triggers actions automatically Works inside a tool Connects multiple systems Improves productivity Improves operating performance Helps with
Dhruv Joshi
2026-06-30 14:49
👁 8
查看原文 →
Dev.to
Who decides an AI agent's trade is 'complete'? Escrow needs a judge. Atomic settlement doesn't.
A new standard for autonomous-agent commerce now has a live implementation, and it's worth reading closely - not because it competes with atomic settlement, but because it draws the line between two settlement philosophies more clearly than anything I've seen so far. The standard is ERC-8183 , the Agentic Commerce Protocol, launched earlier this year by the Ethereum Foundation's dAI team and Virtuals Protocol. The implementation is BNB Chain's BNBAgent SDK , which the team describes as the first live build of the spec (shipped on testnet in March 2026, mainnet pending). If you build for AI agents, both are worth understanding on their own terms. They're also the clearest mirror I've found for explaining what "atomic settlement" actually means. What ERC-8183 does ERC-8183 models commerce as a job with an escrowed budget . There are three roles: a Client who posts the job and funds it, a Provider who performs the work, an Evaluator - a designated third party who decides whether the work was completed. The job moves through four states: Open → Funded → Submitted → Terminal . The client funds the budget into escrow. The provider submits a deliverable. Then the evaluator - and only the evaluator - attests that the job is complete (or rejects it), and the escrow releases accordingly. If the job expires, the client gets refunded. This is a sensible design for a real class of problems. A lot of agent "commerce" is genuinely work-for-hire: do a task, produce a deliverable, get paid if it's acceptable. Acceptability is subjective, so you need someone to judge it. ERC-8183 makes that judge a first-class role and standardizes the lifecycle around it. BNBAgent SDK goes further and routes disputes through UMA's data-verification mechanism, adding an arbitration layer the base spec deliberately leaves out. So far, so reasonable. The interesting part is the assumption baked into the shape of it: someone has to decide that the deal is done. What atomic settlement removes Now hold th
Baris Sozen
2026-06-30 14:48
👁 10
查看原文 →
Dev.to
The Future Of AI Is Local And Open
There’s a specific moment that happens at every single hackathon. It’s usually around 2 or 3 a.m.,...
Paige Bailey
2026-06-30 14:47
👁 8
查看原文 →
Dev.to
I Replaced Image AI for Technical Diagrams with an 8-Tool Code-First Matrix
I needed faster edits for technical diagrams, and a lower recurring overhead for recurring visuals. I stopped asking for new images for everything. That change started the moment I replaced "generate now, tweak later" with a fixed 8-tool matrix. TL;DR: I moved recurring illustration work into seven scriptable stacks + one 3D stack and kept image-generation AI only as a fallback. Why I rewrote this workflow When I edited an article recently, I was spending too much time redoing the same visual shape in slightly different versions. The same chart logic should not need prompt guessing each time. I asked myself: Can this be represented as text or code? Can I regenerate it exactly when requirements change? Do I need raw design freedom, or do I need deterministic structure? If the answer was mostly "text/code + deterministic output," I did not open an image-generation model first. I also kept one practical boundary: this was not an academic tool roundup. This is a log of what I actually used and in what context. The number that changed my mind: an 8-tool decision matrix The number I now defend is exactly 8 . Instead of inventing synthetic savings, I evaluate every new illustration request against this matrix. Tool Best fit Why I pick it Mermaid flow, sequence, architecture notes fastest in markdown-native writing PlantUML UML-heavy docs strict structure when Mermaid gets too loose Markmap map-style summaries converts headings directly Graphviz dependency and direction graphs compact graph semantics matplotlib numeric visualizations source-of-truth from data tables Pillow labels, badges, annotations deterministic pixel edits in Python D3.js node/link or hierarchy interactions data-driven relationship rendering Blender 3D explanatory graphics stronger structural clarity for complex scenes This is the exact set I now reach for before any image-generation request. What happened first: practical snippets I am including small runnable snippets I can reuse. 1. Mermaid for determ
Sho Naka
2026-06-30 14:45
👁 9
查看原文 →
Dev.to
Scientists On AI: It’s Still Experimental
As the AI Engineer World's Fair Expo kicked off, a group of scientists gathered for an informal...
Iain Thomson
2026-06-30 14:39
👁 8
查看原文 →
Dev.to
Gemma, the Epstein Files, and sandboxing cause a stir at the World's Fair
As the AI Engineer World’s Fair kicked off officially on Monday, the halls were filled for the...
Iain Thomson
2026-06-30 14:37
👁 8
查看原文 →
Dev.to
Why Organizations Need an AI Gateway
An AI gateway is the control point between your applications and the LLMs they call. It’s where cost, security, reliability, and governance get managed across every model and provider at once. Skip it, and AI sprawl quietly turns into runaway spend, security gaps, and outages you didn’t see coming. Here’s why a gateway has become core infrastructure. Almost nobody adopts AI in a tidy, planned way. One team ships a support chatbot on OpenAI. Another prototypes on Anthropic. A third fine-tunes an open model on its own GPUs because the latency was better. A year later you’ve got dozens of applications, several providers, API keys scattered across repos, and no single answer to a simple question: what are we spending, and what data are we sending where? That’s the gap an AI gateway fills. It sits between your applications and the models, and it turns fragmented, ungoverned access into something you can actually manage. The reason organizations end up needing one is straightforward — production AI creates problems that application code was never designed to solve. Let’s walk through them. The problems an AI gateway solves Cost that’s invisible until the invoice arrives LLM spend is uniquely easy to blow up. A retry bug, an agent stuck in a loop, an unbounded batch job — any of these can multiply tokens overnight. And when every team holds its own provider key, finance gets one large number with no story behind it. A gateway changes that. It enforces budgets and rate limits per user, team, and application, tracks token spend as it happens, and attributes every dollar to a cost center. TrueFoundry, for instance, lets platform teams set hard caps so a single bad deploy can’t drain the AI budget. The detail matters because cost control only works if it’s enforced before the spend, not discovered after it. Security and credential sprawl Without a gateway, provider keys end up hardcoded in notebooks, committed to repos, and copied onto laptops. There’s no clean way to rotate t
TrueFoundry
2026-06-30 14:33
👁 6
查看原文 →
Dev.to
🚦 Meet Kueue: Smart Job Queueing for Kubernetes 🧠⚙️
Hey everyone 👋 If you run batch jobs, data pipelines, or any kind of AI and ML training on Kubernetes, you have probably hit this wall. Kubernetes is fantastic at deciding WHERE a pod should run, but it is surprisingly clueless about WHEN a job should start. 😅 You submit ten jobs, the cluster fills up, and the rest just sit there as Pending. No real queue, no priority, no fairness between teams. One noisy team can eat all your expensive nodes while everyone else waits. 🥲 That is exactly the gap Kueue fills, and today I want to walk you through it with a pile of hands on examples you can run on any cluster, even your homelab. 🏡 👉 Key takeaway up front: Kueue is a job level manager that holds your jobs in a real queue and only admits them when there is enough quota to actually run them. 🧪 Everything in this guide was tested against Kueue v0.18.1 using the v1beta2 API. I pinned every command and manifest to that version so you do not get surprised by API drift. 📋 What we will cover ✅ Why Kubernetes needs a queue ✅ The building blocks in plain language ✅ Installing Kueue ✅ Setting up quota with a ResourceFlavor, a ClusterQueue, and a LocalQueue ✅ Submitting a Job and watching it get queued and admitted ✅ Priority based admission ✅ Partial admission and elastic jobs ✅ Multiple resource flavors for x86 and arm ✅ Fair sharing between teams with cohorts ✅ Dedicated quota with a shared fallback ✅ Queueing a plain Pod ✅ Why this matters a lot for GPUs and your cloud bill 🤔 Why Kubernetes needs a queue Native Kubernetes scheduling is pod centric. The scheduler looks at one pod at a time and tries to place it. That works great for long running services. Batch workloads are different. They have a beginning and an end, they often need a fixed chunk of capacity, and they compete with other teams for the same nodes. Without a queueing layer you get: ✅ Jobs that fail or stay Pending when resources are tight ✅ No quota governance, so one team can starve the others ✅ No admission prio
Hamdi (KHELIL) LION
2026-06-30 14:32
👁 10
查看原文 →
Dev.to
The Illusion of the Clean Slate
Every engineer has fantasized about it: starting over. Throwing out the old system and building something clean. No legacy constraints. No accumulated compromises. Just pure, intentional design. It never works that way. You can delete all the code. You can architect from scratch. You can make the best technical decisions possible. But you can't delete the organizational memory. You can't unlearn what the last system taught you. You can't escape the patterns that already run through the business, the workflows people have shaped themselves around, the problems you've already paid the cost of understanding. The new system will look clean. But it will be haunted. What rewrites actually inherit A rewrite isn't a fresh start. It's archaeology pretending to be innovation. The constraints don't go away. The old system wasn't overcomplicated because engineers were bad. It was overcomplicated because of customer requirements, regulatory expectations, performance demands, and edge cases that took years to discover. A fresh rewrite finds all those edge cases again. Slower this time, because you don't have documentation—you have broken customers and escalations. The system gets layers of protection again, but now it looks like paranoia instead of learned caution. The organizational memory becomes invisible. Someone fought for that data model three years ago. There was a reason. A business rule that couldn't be violated. A data consistency requirement that cost a quarter to figure out. The new system doesn't have the battle scars that explain why things are the way they are. So they get rebuilt differently, until they hit the same requirement at 2am on a Saturday. The workflow is already baked in. Users have shaped their behavior around the old system. Sales has built their pitch around certain capabilities. Support has written documentation and runbooks. Customers have automation that depends on specific behaviors. The new system is technically cleaner, but it forces change on
Adam - The Developer
2026-06-30 14:28
👁 6
查看原文 →
Dev.to
A Prompt Is a Wish. A Tool Is a Law.
How I let non-engineers ship AI tools to production — and the boring infrastructure that made it safe. A product manager described a workflow in plain English — "every morning, pull yesterday's failed payments, group them by error code, and post a summary to our channel." Twenty minutes later it was running in production. She never opened an editor. She never saw a line of TypeScript. She talked to an agent, the agent wrote the code, and — once a human had reviewed the pull request — it shipped. That sentence should make you nervous. It made me nervous, and I'm the one who built the thing. The demo is "look, it wrote the code." The operation is "a marketer's tool now has a path to the payments database and nobody reviewed it." The interesting engineering isn't the part where an LLM writes code — that's the easy, demo-able part. It's the guardrails that decide whether the code it writes is allowed to exist. Here's the platform, and the five problems I had to solve to make it safe to hand to people who can't read the code that runs. The shape of the thing The platform is a place where anyone — engineers, PMs, designers, QA — can publish a reusable AI tool, and everyone else can use it. Write once, available to all. A few terms up front, because the whole design leans on them: MCP (Model Context Protocol) is a standard way for an AI client to discover and call your functions. The key detail: there's a step where the client asks the server "what tools do you have?" and the server answers with a list. Hold onto that — half the design hangs off that one list. Cloudflare Workers is code that runs on Cloudflare's servers at the network edge instead of your own. Durable Objects is per-session server-side storage that lives outside the model's context — the finite, token-costing window of everything the model can currently see. None of this is exotic; what matters is where each piece of state lives. Under the hood it's three small Workers speaking MCP: a gateway (auth, routin
Olexandr Uvarov
2026-06-30 14:25
👁 7
查看原文 →
Dev.to
AI Chunking Changes How We Should Build Content Pages
Traditional content pages are often designed for a linear reader. The introduction sets context, the middle develops the idea, and the conclusion ties everything together. AI retrieval does not always work that way. A system may identify smaller content units, pull the most relevant section, compare it with other sources, and use that fragment to support an answer. The full page still matters, but the retrievable blocks inside the page matter just as much. A useful Tumblr post explains the idea in simple terms: https://www.tumblr.com/digitalisedsoul/820825642809573376/ai-does-not-read-your-content-like-a-human?source=share For Dev Community readers, the pattern is familiar. Poorly structured inputs lead to weaker outputs. If content is dense, vague, or dependent on surrounding paragraphs, it becomes harder to extract and reuse. If content is modular, clear, and properly scoped, retrieval becomes easier. Marketing teams can learn a lot from this. A strong content page should behave like a set of well labelled components. Each section should answer a specific question. Headings should be descriptive, not decorative. Paragraphs should avoid vague references such as the above point or this approach when the section may be read independently. Definitions should appear close to the terms they explain. Examples should include enough context to stand alone. Proof should be written as text, not only displayed as graphics. Internal links should connect related concepts in a way that helps both readers and systems understand the topic map. A page about AI search visibility, for example, should not only include one broad explanation. It should break the topic into useful blocks: what AI visibility means, why AI systems retrieve passages, how source trust works, what makes content reusable, and how brands should measure answer presence. Each block becomes a possible answer unit. That structure does not weaken the reader experience. It improves it. Developers, marketers, and busi
harini work
2026-06-30 14:24
👁 8
查看原文 →
Reddit r/programming
Learning Neural Networking and making a one of my own
hey guys i'm a student of class 12 not expert but just interested to learn neural networking as today is my day second so i think to post my progress with you all as i can find the answer of question that i'm facing with. yesterday i have learn the basic of a neuron z=∑(w ⋅x )+b and today i'm learning about Batches, Layers, and Objects. despite =this it's hard to know what weight and bias really are if someone can explain me what they are please explain. that for today (>__<) submitted by /u/Vegetable_Cry_854 [link] [留言]
/u/Vegetable_Cry_854
2026-06-30 13:48
👁 7
查看原文 →
HackerNews
A Berkeley AI professor makes provocative argument for decelerating AI research
1vuio0pswjnm7
2026-06-30 13:11
👁 5
查看原文 →
Product Hunt
Livinity
Open-source homeserver OS with a built-in AI agent Discussion | Link
Livinity IO
2026-06-30 12:36
👁 3
查看原文 →
Product Hunt
Brain2Qwerty v2
Decode sentences directly from non-invasive brain signals Discussion | Link
2026-06-30 12:22
👁 5
查看原文 →
TechCrunch
The AI jobs debate just got messier
A new report finds "high-intensity AI adopters” saw headcount increase 10.2%. Among those companies, entry-level headcount rose by 12%, countering the rhetoric that AI kills junior jobs.
Rebecca Bellan
2026-06-30 12:01
👁 9
查看原文 →