html
This week we'll start our journey to build advanced AI agents that can perform complex tasks autonomously.
OpenAI defines agents as "systems that intelligently accomplish tasks", ranging from executing simple workflows to pursuing complex, open-ended objectives.
Agent Orchestration Diagram
Just like a perfect burger has essential layers, every great agent needs these six core components!
The intelligence engine that powers reasoning and decision-making
Interfaces that allow agents to interact with external systems
Systems for storing and retrieving information
Capabilities for understanding and generating spoken language
Safety mechanisms to ensure proper behavior
Systems to deploy, monitor, and improve agents
Start with a smart model to prove your idea works
Look at where you're spending money and optimize the biggest costs first
Use different models for different jobs like having specialists on a team
Model Selection: best practices
Systematic evaluation methodology
| Model | Provider | Best For |
|---|---|---|
| GPT-5.2 | OpenAI | Hardest tasks; best all-round reasoning & instruction following |
| GPT-5 Mini | OpenAI | Most production agents; best balance of power & cost in GPT-5 family |
| GPT-4.1 | OpenAI | Agents needing very long context (1M tokens) at lower cost than GPT-5 |
| GPT-4.1 Mini | OpenAI | High-volume agents wanting GPT-4.1 quality without the cost |
| o4-mini | OpenAI | Coding & STEM reasoning; o-series capability at a fraction of o3's price |
| Claude Sonnet 4.6 | Anthropic | Coding & writing agents; sweet spot of speed, cost & intelligence |
| Gemini 3 Flash | High-volume agents processing images/docs on a budget | |
| Gemini 3.1 Pro | Complex multi-step agents; long-context reasoning with thinking mode |
Let's weigh the trade-offs
Complete ownership of your models and data. Deploy anywhere, anytime, however you want.
Fine-tune on your data, modify architecture, optimize for your specific use case. Total flexibility!
Not dependent on any single provider. Switch models, platforms, or infrastructure freely.
50-90% cost reduction vs cloud APIs! Perfect for high-volume use cases.
Inspect code, understand model behavior, verify security. Full transparency.
Community-driven improvements, rapid iteration, shared knowledge accelerates progress.
Steeper learning curve. Requires knowledge of deployment, optimization, and troubleshooting.
Need GPUs, servers, deployment pipelines. Initial infrastructure investment required.
Generally lag behind GPT-5.2 and Claude 4.6 on complex tasks (though gap is rapidly closing!)
You handle security, scalability, uptime, updates, and monitoring. No managed service support.
Good News: These drawbacks are rapidly diminishing due to ongoing innovation! The ecosystem is maturing fast.
Best Use Case: High-volume applications with privacy requirements where you have technical expertise. Start with cloud APIs, migrate to open source when you hit scale or privacy constraints.
Everything you need to build AI agents
Moonshot AI's 1T param MoE. Exceptional agentic abilities, 256K context, visual coding
Zhipu AI's ChatGLM series. Strong coding, tool calling, 26 languages, 128K context
Alibaba's versatile series. Strong multilingual, reasoning, and coding capabilities
Run these models locally on your machine! Download, manage, and switch between open-source models with a single command.
Open-source agents use the same components as closed-source agents, just with open models!
Models
Tools
Knowledge & Memory
Audio/Speech
Guardrails
Orchestration
Instructions are your agent's blueprint! Using this proven framework ensures your agent behaves exactly how you want it to.
Who is your agent? Define their identity and expertise
What exactly should your agent do? Be specific about the main job
What information will users provide? Set clear expectations
How should your agent respond? Define the format and style
What should your agent NEVER do? Set clear boundaries
Key capabilities and behaviors to always remember. Your agent's personality traits
ROLE: You are a [describe who your agent is]
TASK: Your main job is to [specific action/responsibility]
INPUT: Users will give you [type of information expected]
OUTPUT: You should respond with [format, style, structure]
CONSTRAINTS: Never [list forbidden behaviors]
REMINDERS: Always remember to [key personality traits and behaviors]
Context Engineering: Combining different types of information to give your agent the full picture
1. Role
You are an AI research assistant tasked with summarizing the latest news in artificial intelligence. Your style is succinct, direct, and focused on essential information.
Task
Given a search term related to AI news, perform a web search to retrieve information from the past week, and produce a concise summary of the key points.
Input
The user's input is a specific AI-related search term provided by the user.
Output
Provide only a succinct, information-dense summary capturing the essence of recent AI-related news relevant to the search term. The summary must be concise, approximately 2-3 short paragraphs, totaling no more than 300 words.
Constraints
Focus on capturing the main points succinctly; complete sentences and perfect grammar are unnecessary. Ignore fluff, background information, and commentary. Do not include your own analysis or opinions.
Capabilities & Reminders
You have access to the web search tool to find and retrieve recent news articles relevant to the search term. You must be deeply aware of the current date to ensure the relevance of news, summarizing only information published within the past 7 days.
1. Role
You are an AI research assistant focused on identifying and summarizing recent trends in AI from multiple source types. Your job is to break down a user's query into actionable subtasks and return the most relevant insights based on engagement and authority.
Task
Given a research query (delimited by <user_query></user_query>), do the following: Extract up to 10 diverse, high-priority subtasks, each targeting a different angle or source type. Prioritize by: Engagement (views, likes, reposts, citations) Authority of source (publication reputation, domain expertise) Generate JSON outputs for each subtask in the format below. Calculate the correct start_date and end_date (UTC ISO format) based on the specified time period. Summarize all findings into a single concise trend summary (~300 words max).
Input
<user_query> INSERT_SEARCH_QUERY_HERE </user_query>
Output
(You will output up to 10 subtasks in this exact format.)
{"id": "subtask_1", "query": "...", "source_type": "news | X | reddit | ...", "time_period": "1_day" | ... , "priority": 1}
Constraints
Focus on capturing the main points succinctly. Ignore fluff, background information, and commentary. Do not include your own analysis or opinions.
Capabilities & Reminders
You have access to the web search tool to find and retrieve recent news articles relevant to the search term. You must be deeply aware of the current date to ensure the relevance of news, summarizing only information published within the past 10 days.
You can build agents by connecting apps visually or by writing code. Both work great!
Use n8n to create a no-code automation that connects form submissions to an OpenAI-powered Task Generator.
On form submission node captures user goal input from a form.OpenAI - Message Model node sends the goal to OpenAI API with system instructions to break it into tasks.Form node shows the generated task list to the user as a confirmation or next steps.
Let's build a Task Generator agent that creates a clear, actionable plan from user goals.
pip install openai-agents openaiimport os
import openai
from agents import Agent, Runner
import asyncioOPENAI_API_KEY = os.environ["OPENAI_API_KEY"]
task_generator = Agent(
name="Task Generator",
instructions=\"\"\"You help users break down their goals into small, achievable tasks.
For any goal, analyze it and create a structured plan with specific actionable steps.
Each task should be concrete, time-bound when possible, and manageable.
Organize tasks in a logical sequence with dependencies clearly marked.
Ask clarifying questions when the goal is ambiguous.\"\"\",
)async def generate_tasks(goal):
result = await Runner.run(task_generator, goal)
return result.final_output
async def main():
user_goal = "Start a small online business selling handmade jewelry"
tasks = await generate_tasks(user_goal)
print(tasks)
if __name__ == "__main__":
asyncio.run(main())asyncio.run() only in standalone scripts
If you chose the code option, watch this to add a user-facing UI to your python AI Agent.
Basic single-agent setup. This is a recorded walkthrough using Python and OpenAI (Make sure you have watched the streamlit tutorial first).
Basic single-agent setup. This is a recorded walkthrough using n8n forms and OpenAI.
Advanced techniques for ensuring agent safety and reliability
Optional open source alternatives for setting up your AI Agent, available in both no-code and code options.
Learn how to self host your AI Agent infrastructure using Docker.
Time: 10 minutes | Let's practice creating agent instructions using the 6-part framework!
Now is the time to ask!
An AI agent is like a helpful assistant that:
Security isn't about choosing the "most secure" option, it's about understanding the trade-offs and picking what fits your needs and skills.
Official US government AI security guidelines
Most common AI vulnerabilities and how to prevent them
Industry best practices for safe AI agent development
US regulatory guidance on AI and data privacy
Ready to take your agent implementations to the next level?
Share your insights and bring your questions for the Thursday live Q&A session!
See you next week for Making Agents Context-Aware