๊ฐ€์ž… ํ›„ ์ดˆ๋Œ€ ๋งํฌ๋ฅผ ๊ณต์œ ํ•˜๋ฉด ๋™์˜์ƒ ์žฌ์ƒ ๋ฐ ์ดˆ๋Œ€ ๋ณด์ƒ์„ ๋ฐ›์„ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

cv usk
@cv_usk
AI / Software Research Notes AI Agent, LLMOps, MLOps, Software Architecture ๆŠ•็จฟใฏๅ€‹ไบบใฎๆ„่ฆ‹ใงใ™ใ€‚
๊ฐ€์ž… May 2026
258 ํŒ”๋กœ์ž‰ ์ค‘    220 ํŒฌ
# Useful but Little-Known Features of OpenAI Agent SDK ๐ŸŒ Want to manage and version your prompts on the platform instead of hardcoding them? With Prompt Templates, you can reference prompts created on the OpenAI platform from the SDK, injecting variables dynamically. ๐Ÿ“Œ Title: Prompt Templates ๐Ÿ”— URL: ๐Ÿงฉ Overview Instead of `instructions`, you can use the `prompt` parameter to reference prompt templates created and managed on the OpenAI platform. For static usage, pass a dict like `{"id": "pmpt_123", "version": "1", "variables": {...}}`. For dynamic usage, pass an async function that returns a prompt dict at runtime, enabling context-dependent variable injection. ๐Ÿ›  How to use it ```python from agents import Agent, RunContextWrapper # Static template reference agent_static = Agent( name="support", prompt={ "id": "pmpt_abc123", "version": "1", "variables": { "company_name": "Acme Corp", "support_level": "premium", }, }, ) # Dynamic template reference async def dynamic_prompt( context: RunContextWrapper[UserContext], agent: Agent, ) -> dict: user = context.context return { "id": "pmpt_abc123", "version": "2", "variables": { "company_name": "support_level": user.plan, "language": user.language, }, } agent_dynamic = Agent( name="dynamic-support", prompt=dynamic_prompt, ) ``` ๐Ÿ— Building it into production ใƒปManage prompts on the platform for updates and rollbacks without code deployment ใƒปUse version pinning for stable behavior while gradually rolling out new versions ใƒปInject user-attribute-based variables with dynamic templates ใƒปShare and reuse prompts across teams for quality standardization ๐Ÿ’ก Use cases ๐Ÿ“ Prompt version management and staged rollouts ๐Ÿข Cross-organization prompt sharing and standardization ๐Ÿ”„ Prompt updates without code deployment ๐Ÿ‘ค Dynamic variable injection based on user attributes โš ๏ธ Watch out `prompt` and `instructions` are mutually exclusive; specifying both causes an error. If the referenced prompt doesn't exist on the platform, you'll also get an error. Verify prompt IDs and versions before deployment, and watch for variable name typos. โœจ With Prompt Templates, move prompt management from "inside the code" to "the platform dashboard." #OpenAIAgentSDK# #AIAgent#
๋” ๋ณด๊ธฐ