How to Move Independent Work Through an asyncio Pipeline
A practical asyncio workflow for moving independent work through typed events, queues, concurrent tasks, and awaited API calls. Learn where validation and fallback belong.
Loading…
Topic
251 posts about Python. Every summary links to the original.
See the idea
A practical asyncio workflow for moving independent work through typed events, queues, concurrent tasks, and awaited API calls. Learn where validation and fallback belong.
The Good Stuff
Paid picks we use ourselves. Links carry a referral code — a subscription through one earns us a commission at no extra cost to you.
Newest first
Running competitive models like RedNote's 3B parameter dots.ocr on-device provides zero-cost, network-free optical character recognition while leveraging power-efficient hardware like Apple's Neural Engine. Because the Neural Engine requires Core ML, converting the 1.2B parameter NaViT vision encoder from PyTorch requires resolving multiple graph tracing incompatibilities. The initial conversion pipeline targets FLOAT32 execution on GPU by capturing the execution graph with torch.jit.trace and compiling it via coremltools. Simplifying the model for single-image inference eliminates dynamic sequence masking, dynamic tensor iteration, and multi-attention complexity. Although the resulting Core ML model accurately matches PyTorch baseline numerical precision, the unoptimized artifact spans over 5GB and takes over one second per forward pass.
Local agentic AI workflows generate multi-step reasoning traces that increase token counts and strain real-time inference on personal computers. To accelerate execution, researchers implemented speculative decoding using OpenVINO.GenAI on an Intel Lunar Lake integrated GPU, pairing a 4-bit Qwen3-8B target model with a smaller Qwen3-0.6B draft model. By measuring angular distance across layers, the team pruned six of the draft model's twenty-eight layers to minimize draft latency and fine-tuned it on synthetic data generated from 500,000 prompts. This depth-pruned draft elevated speculative decoding throughput from a 1.3x speedup to a 1.4x speedup over the standalone baseline. Finally, deploying the optimized model alongside the Hugging Face smolagents framework allowed local agents to perform tool invocation and code generation tasks efficiently.
Training and aligning large language models and small language models requires datasets tailored for complex reasoning, preference tuning, multi-turn questioning, and format conversion. To eliminate the need for bespoke data preparation scripts, SyGra provides a low-code and no-code Python framework for automated dataset creation, transformation, and alignment. The library integrates with diverse inference backends, including vLLM, Hugging Face TGI, Triton, and Ollama, allowing teams to focus on prompt engineering rather than pipeline infrastructure. It supports data workflows ranging from converting PDFs and knowledge bases into question-answering pairs to filtering low-quality samples and generating Direct Preference Optimization datasets. These plug-and-play workflows reduce manual curation effort while accelerating model fine-tuning and retrieval-augmented generation pipelines.
The Okta Open Source MCP Server connects large language model agents to Okta’s Admin Management APIs for identity and access management workflows. It translates natural-language requests into structured API calls, supporting user and group management, group membership and application operations, system-log retrieval, and additional application and policy actions. The server uses Okta’s official SDK and supports interactive Device Authorization Grant authentication or browserless Private Key JWT, with scoped API access and credentials supplied through environment variables. The guide explains setup with Python 3.9 or later and uv, Okta application configuration, and VS Code’s MCP client settings, then shows examples including user administration and audit-report generation. Its stated purpose is to automate organization-management tasks while respecting Okta’s security model.
Existing AI agent evaluation environments are often tightly coupled to specific tasks and fail to model real-world challenges such as API failures, spontaneous events, and asynchronous conditions. To address this limitation, the Gaia2 benchmark and the Meta Agents Research Environments (ARE) framework introduce interactive read-and-write evaluation. Gaia2 incorporates 1,000 human-created scenarios spanning multi-step execution, cross-source search, ambiguity handling, adaptability, temporal reasoning, agent collaboration, and noise tolerance. Using a simulated smartphone interface equipped with 101 tools, evaluations showed that GPT-5 with high reasoning scored highest overall, while Kimi K2 was the leading open-source model. The results demonstrated that instruction following and search do not reliably predict performance on closer-to-real-world tasks.
Scaleway is integrated as a supported serverless Inference Provider on the Hugging Face Hub, expanding model deployment options across Hub model pages and official client SDKs for JavaScript and Python. Operating out of European data centers located in Paris, France, Scaleway Generative APIs host open-weight models including gpt-oss, Qwen3, DeepSeek R1, and Gemma 3 with structured outputs, function calling, multimodal processing, and sub-200ms first-token response times. Developers can route inference requests using their Hugging Face tokens or supply direct Scaleway API keys. Billing for routed requests charges standard provider rates starting at €0.20 per million tokens without markups, while direct requests bill to Scaleway accounts. Hugging Face PRO subscribers receive two dollars of monthly inference credits applicable across providers.
Hugging Face has integrated Public AI as a supported Inference Provider on the Hugging Face Hub. Public AI operates as a nonprofit, open-source project providing access to sovereign and public models from institutions such as the Swiss AI Initiative and AI Singapore. Its distributed infrastructure combines a vLLM-powered backend serving OpenAI-compatible APIs across partner-donated clusters with a global load-balancing routing layer. Users can access these models through the Hugging Face web UI, Python client SDK, and JavaScript SDK using either direct provider API keys or routed Hugging Face tokens. At the time of announcement, inference through the Public AI provider is free of charge, supported by donated GPU time and advertising subsidies.
Generative artificial intelligence tools produce images, video, audio, and text that have become increasingly difficult to distinguish from real-world media captures. To improve synthetic media transparency, Hugging Face introduced visible watermarking capabilities directly into the Gradio web application framework. Developers can now overlay visual watermarks on image and video outputs by specifying a single watermark parameter using file paths, open image objects, or NumPy arrays. The implementation also supports QR code watermarks, which can match the visual style of generated media while conveying detailed background information. Furthermore, the Gradio Chatbot component accepts a text watermark parameter that automatically attaches attribution metadata whenever users copy generated responses to their clipboards.
To support OpenAI's GPT-OSS series of models, the transformers library introduced several performance upgrades that apply across supported architectures. The release integrates zero-build custom kernels downloadable directly from the Hub, reducing external dependency bloat and compilation friction for operations like Liger RMSNorm and MegaBlocks MoE. Native support for MXFP4 quantization groups vector elements into 32-value blocks with shared scales, allowing GPT-OSS 20B to fit in roughly 16 GB of VRAM and GPT-OSS 120B in roughly 80 GB. In addition, transformers incorporates Flash Attention 3 with attention sinks, continuous batching via the generate_batch API for experimentation, and automatic memory pre-allocation to speed up model loading on GPUs.
Small language models often struggle to compete with large frontier models on complex, agentic data science tasks. To improve notebook-based reasoning, researchers simplified agent scaffolding down to roughly two hundred lines of code with dedicated execution and final answer tools, boosting baseline easy accuracy on the DABStep benchmark from 44.4 percent to 59.7 percent. They constructed a curated training dataset by deduplicating two terabytes of Kaggle notebooks, automatically fetching five terabytes of linked datasets, and scoring educational value and relevance using Qwen3-32B. Question-answer pairs grounded in verified execution traces were generated to fine-tune compact Qwen3-4B thinking and instruct models. The team released the trained models alongside the dataset and execution sandboxes, establishing a foundation for reinforcement learning and distillation on notebook workflows.
Google DeepMind released EmbeddingGemma, a multilingual embedding model with 308 million parameters and a 2048-token context window designed for on-device applications. Based on the Gemma3 transformer backbone, the architecture replaces causal attention with bidirectional attention to function as an encoder, followed by mean pooling and two dense layers producing 768-dimensional vectors. The model incorporates Matryoshka Representation Learning, allowing outputs to be truncated down to 512, 256, or 128 dimensions for reduced memory and storage footprints. Trained on approximately 320 billion multilingual tokens across more than 100 languages, the quantized model operates under 200 MB of RAM. In domain-specific evaluations on the MIRIAD dataset, fine-tuning increased NDCG@10 from 0.8340 to 0.8862, outperforming larger baselines.
SandboxAQ released the Structurally Augmented IC50 Repository (SAIR), an open-source dataset containing 5.24 million computationally co-folded 3D protein-ligand structures paired with empirical IC50 binding potency data. The repository addresses training data scarcity in structure-based drug discovery, where over 40 percent of the included target proteins lack experimental structures in the Protein Data Bank. To construct the dataset, engineers executed over 130,000 GPU hours of the Boltz1 co-folding model on 760 NVIDIA H100 processors hosted via NVIDIA DGX Cloud on Google Cloud Platform. Infrastructure optimizations maintained over 95 percent GPU compute utilization, compressing the generation timeline from three months to three weeks. Quality validation using PoseBusters confirmed that 97 percent of the predicted complexes met physical plausibility and chemical sanity standards.
Organizations building AI applications over private data must connect large language models with proprietary datasets without managing every infrastructure component. The post presents Heroku Managed Inference and Agents with LlamaIndex as a stack for retrieval-augmented generation (RAG), combining LlamaHub connectors, indexing, retrieval, and managed model services. The implementation provisions Heroku Postgres with pgvector, Claude 4 Sonnet for inference, and Cohere Embed Multilingual embeddings, then uses Python and LlamaIndex to load documents, store 1,024-dimensional vectors, and query them through an OpenAI-compatible embedding endpoint. PGVectorStore supplies the vector store, while Heroku environment variables provide service credentials and connection details. The result is a deployable pattern for querying private documents, with examples spanning financial analysis, insurance claims, customer support, and internal knowledge.
Portia AI presents a customer-refund agent that combines its guardrails with Stripe’s official Model Context Protocol server. The agent reads a refund request, compares it with a policy file, identifies the relevant Stripe customer and payment intent, and evaluates whether the request should be approved. Portia’s planner produces a multi-agent plan, while execution agents run it and persist outputs in plan state; an execution hook pauses before the Stripe create-refund call. A clarification presents the request and the agent’s rationale to a human, who can approve it in the CLI; approval allows the refund to proceed, while rejection exits without creating one. The example also handles Gmail OAuth and can send the customer an email describing the outcome.
Heroku AppLink is now generally available from the Salesforce Setup menu, extending Salesforce with Heroku applications and code written in virtually any programming language. The initial release provides SDK support for Node.js and Python, while Java examples and direct AppLink API access demonstrate how other languages can integrate; the APIs provide authentication, authorization, connection pooling, and access to Salesforce and Data Cloud data. AppLink combines an add-on, service-mesh buildpack, dashboard, CLI, API, SDK, OpenAPI integration, and Salesforce API integration to provision connections, restrict and authenticate requests, publish services, and monitor org integrations. The add-on is free, with normal Heroku billing for compute and data resources, and published applications can extend Flow, Apex, and Agentforce while user mode is enabled by default.
DispatchGym is a research framework for reinforcement learning (RL) studies in dispatch systems that match bookings with drivers. It combines an RL algorithm, a dispatch-process simulation, and a Gymnasium API interface, allowing data scientists with basic RL and Python skills to modify and test ideas independently. The simulated environment models booking creation, driver dispatch and movement, and booking completion, prioritizing directional accuracy over exact metric matching; its modular Python architecture uses Numba to reduce runtime overhead. A command-line upload launches the modified code on internal infrastructure as a Spark job, avoiding infrastructure management while preserving flexibility across simulation and optimization components. The framework supported experiments with contextual bandits, including linear, neural-linear, and Gaussian-process variants alongside several action-sampling strategies, to identify combinations of levers and reward functions for dispatch hyperparameter tuning and improved fulfilment efficiency and reliability.
Heroku now natively supports uv, a Rust-written Python package manager presented as a faster alternative to pip for dependency resolution, installation, and virtual-environment management. The post connects this support to recurring problems in modern Python projects, including slow installs, complex dependency trees, version pinning, and tooling that may struggle to keep pace with current standards. It walks through installing uv, running uv init, adding Flask and Gunicorn with uv add, and deploying a basic Flask application using a Procfile, pyproject.toml, uv.lock, and .python-version. Heroku detects the Python app, installs dependencies from these project files, and starts it with gunicorn main:app after a Git push. The stated outcome is faster local development, more consistent environments, reduced onboarding time, fewer flaky builds, and improved pipeline performance, while uv remains relatively new.
Ramp built an open-source MCP server that exposes its developer API to LLMs through tools and a SQL interface, enabling natural-language access to business spend data. Using FastMCP in Python and Claude Desktop, the prototype could run analyses, generate visualizations, and issue cards on demand, but pagination struggled beyond a few hundred transactions because of miscalculations, context limits, input sizes, and token use. The team replaced bulk responses with an in-memory ETL that flattens API JSON into SQLite, then exposes load, transformation, and query tools; an OLAP-powered API was added for reporting workloads that caused timeouts. This let Claude analyze tens of thousands of spend events with aggregate and window functions while reducing token usage, although API latency, occasional reliability problems, tool-selection errors, and security risks remain; audit logs, OAuth scopes, and constrained tools provide mitigations, while write actions await a safety framework.
As businesses scale, the post addresses the need to move Stripe revenue data into BigQuery for recurring reporting and analysis. It describes configuring Stripe Data Pipeline to export transactions, invoices, subscriptions, and payments to Google Cloud Storage, then using a Python-based Google Cloud Run Job to discover the latest snapshot through data_load_times.json and enumerate each table’s Parquet files. The loader sends those files to BigQuery with the Google Cloud clients, creates missing tables, uses WRITE_TRUNCATE to retain the latest snapshot, and parallelizes table loads with ThreadPoolExecutor while collecting errors. After deployment and a test execution, the workflow is verified in BigQuery and scheduled to run every six hours, providing an automated path to refreshed Stripe data for analytics.
Look-aside caching with object byte serialization can cause critical compatibility failures when application versions, dependencies, or database schemas change. Serialized cache entries bound to specific runtimes risk deserialization errors during deployments, triggering thundering herd queries against the underlying datastore. To resolve this, Nextdoor replaced runtime-bound serialization like Python pickle with MessagePack to serialize Django model objects. The team achieved forward compatibility by letting MessagePack ignore unrecognized new fields in older application code, while backward compatibility relies on mandatory default values for newly added model attributes. Nextdoor prepends a ten-byte header containing format metadata and version information before writing the serialized payload to cache stores.
The best engineering reads, once a week.