Types

This post is to cover a comprehensive, intuitive set of advanced typing primitives that show up in modern Python (≥3.9). These types enable:- Type safety without runtime overhead- Better IDE autocomplete- Self-documenting APIs- Generic/reusable code To read below codes, need to know Type hints are ignored by Python’s interpreter — they exist only for static … Continue reading Types

A Practical Guide to Building Agents by OpenAI

This is the guide provided by OpenAI to help use agents SDK. Several key points cited in the following. First, write good prompts to configure, for example use advanced models such as o3-mini to write "“You are an expert in writing instructions for an LLM agent. Convert the following help center document into a clear … Continue reading A Practical Guide to Building Agents by OpenAI

Interactive Conversation to Perform Tasks is Essential in This Agent

The OpenAI Agent SDK provides the foundation (agents, tools, MCP, sessions), but we need a custom interactive wrapper to handle the confirmation/correction flow that's essential. current simple_agent.py does this beautifully:# Line 1149-1176: Interactive parameter correctionprint(f"\nExecute tool '{tool_name}' with these parameters? (y/n): ")user_input = input().strip()if user_input == 'n':# User can provide corrections# Agent remembers and retries … Continue reading Interactive Conversation to Perform Tasks is Essential in This Agent

Comparing My Agent to OpenAI Agent SDK

My agent hand-rolls LLM prompting, tool selection, conversational memory, and MCP tool discovery while openai-agents-python/src/agents/agent.py already encapsulates these behaviors through the Agent runtime. Custom MCP plumbing, the class manages ClientSession, output parsing, retries, and tool enablement logic on its own, while agents.mcp.MCPUtil and Agent.get_all_tools() can surface MCP tools automatically once servers are connected. Conversation history and logging live in plain dicts and prints. The … Continue reading Comparing My Agent to OpenAI Agent SDK

Cook Book Review: Agent SDK Agent as a Portfolio Manager

This complex agent is meant to create a workflow that multiple specialist agents (Macro, Fundamental, Quantitative) collaborate under a Portfolio Manager agent to solve a challenging investment research problem. Workflow codes: import datetime import json import os from pathlib import Path from contextlib import AsyncExitStack from agents import Runner, add_trace_processor, trace from agents.tracing.processors import BatchTraceProcessor … Continue reading Cook Book Review: Agent SDK Agent as a Portfolio Manager

Cook Book Review: Agent SDK Case Parallel Agents

First create agents # Agent focusing on product features features_agent = Agent( name="FeaturesAgent", instructions="Extract the key product features from the review." ) # Agent focusing on pros & cons pros_cons_agent = Agent( name="ProsConsAgent", instructions="List the pros and cons mentioned in the review." ) # Agent focusing on sentiment analysis sentiment_agent = Agent( name="SentimentAgent", instructions="Summarize the … Continue reading Cook Book Review: Agent SDK Case Parallel Agents