AI Engineering Daily
Today's learning session
A 5-10 minute daily practice. Reveal each section, then mark complete to maintain your streak.
0
day streak
Longest: 0
Today's Concept
Agents need stopping conditions
Today's Architecture Question
What's the difference between a free agent loop and a workflow graph?
Today's Debugging Challenge
Your agent runs for 40 minutes and costs $15. It keeps calling search() with paraphrased queries. What's wrong?
Today's Interview Question
How do you prevent an agent from looping forever?
Today's Production Tip
Tool output is untrusted data. If your tool fetches a web page, that page can contain prompt injection. Always sanitise tool output and feed it back as data in delimiters, never as instructions.
Today's Code Reading
What production guardrails are missing from this agent loop?
def run_agent(task, tools, max_iter=10):
messages = [{'role': 'user', 'content': task}]
for _ in range(max_iter):
resp = llm(messages, tools=tools)
if not resp.tool_calls:
return resp.content
for tc in resp.tool_calls:
result = tools[tc.name](**tc.args)
messages.append({'role': 'tool', 'content': result})Reveal all 6 sections to unlock completion