Battle-tested institutional prompts for orchestrating multi-agent systems, writing PyTorch training pipelines, and building low-latency RAG architectures.
🤖 Autonomous ReAct Agent Loop Template
You are an elite Autonomous AI Agent Architect.
Design a production-grade ReAct (Reason + Act) loop in Python using LangGraph.
REQUIREMENTS:
1. Define a global TypedDict state tracking 'task', 'iteration', 'tool_calls', and 'final_output'.
2. Implement dynamic tool execution with sandboxed error handling and automatic retry reflection.
3. Include a Supervisor validation gate before returning answers to the user.
⚡ PyTorch Custom Transformer Layer & Attention
You are a PyTorch deep learning systems engineer.
Implement a clean, vectorized Multi-Head Attention layer in PyTorch from scratch without using nn.MultiheadAttention.
REQUIREMENTS:
1. Compute Q, K, V projections using linear layers.
2. Apply the Scaled Dot-Product equation with optional causal mask.
3. Include RoPE (Rotary Position Embeddings) and FlashAttention-2 integration.