Interactive Sandboxes
Direct access to live in-browser testing consoles and code simulation visualizers.
AI Agent Playgrounds
BPE Tokenizer calculators, multi-agent supervisor workflow simulators, vector database search, and cosine similarity charts.
Python WASM Sandbox
Write, run, and modify custom agent scripts in real-time inside your browser using a Monaco editor and Pyodide console.
Developer Tool Suite
JSON formatting/diff/schema suite, PEM key newline helpers, Regex tokenizers, Cron triggers, and cryptographic utilities.
SQL Code Sandbox
Run and visualizes SQL database schemas, interactive joins (Inner, Left, Right, Full Outer), and set unions live.
Algorithms Workspace
Interactive code visualizer for Dynamic Programming (LCS), line-diffing (Myers Diff), and advanced search algorithms.
System Design Blueprints
Interactive high-level architecture designs for 10 top system scale questions (Uber, WhatsApp, Instagram, YouTube, etc.) with dynamic Mermaid flowcharts.
AI Engineer Interview Preparation Sheet
Target concepts, system interview topics, and code implementations expected in AI Engineer loops.
Q1: Implement a Basic Single-Agent Tool Execution Loop (ReAct)
How do you implement a robust single-agent execution cycle where the LLM decides to call tools, executes them locally, and feeds results back until it reaches a final answer?
import os
from google import genai
from google.genai import types
# 1. Define local executable tools
def get_weather(location: str) -> str:
return f"The weather in {location} is currently 72°F and sunny."
tools_map = {"get_weather": get_weather}
# 2. Call model with function declarations
client = genai.Client(api_key=os.environ["GEMINI_API_KEY"])
response = client.models.generate_content(
model="gemini-2.5-flash",
contents="What is the weather in New York?",
config=types.GenerateContentConfig(
tools=[get_weather] # Auto-generates schema
)
)
# 3. Handle model function calls and feed execution outputs back
if response.function_calls:
for call in response.function_calls:
tool_func = tools_map[call.name]
# Execute tool locally
tool_output = tool_func(**call.args)
# Feed back response
follow_up = client.models.generate_content(
model="gemini-2.5-flash",
contents=[
types.Part.from_function_response(
name=call.name,
response={"result": tool_output}
)
]
)
print("Final Answer:", follow_up.text)
Q2: Explain Token Arithmetic and sliding context management
How do you handle context window overflow when building recursive agent workflows that ingest large codebases or logs?
1. Truncation vs. Summary: Instead of simple truncation, use a **Dual-Agent summary pipeline**. Prior system messages and user chats are condensed into semantic summary memories while preserving system prompts intact.
2. Sliding Window: Keep a fixed buffer of recent messages (`max_messages = 10`) while pushing older conversation cycles to a vector retrieval (long-term memory) module to pull in on-demand.
3. Token Calculation: In production, count tokens using libraries like `tiktoken` (for OpenAI) or model specific APIs before making calls, warning the system or triggering compression if the token count exceeds 80% of context size.
Q3: How do you optimize Vector RAG search latency and accuracy?
What strategies do you implement to resolve search queries that return irrelevant chunks due to bad similarity matching?
1. Cosine Similarity Formula: The distance metric is defined as:
cos(θ) = (A · B) / (||A|| ||B||)
2. Hybrid Search: Combine Dense Vector search (for semantic similarity) with Sparse BM25 keyword matching (for specific tags, UUIDs, or exact terms) to generate a balanced reranked results list.
3. Chunking & Overlap: Implement **Parent-Child Chunking**. Store large parent chunks (e.g. paragraphs or pages) but index smaller child chunks (e.g., sentences). Search queries match small sentences but return the larger surrounding paragraph context to the LLM to preserve continuity.