scaffolding-openai-agents
使用 SDK 構建 OpenAI 代理
從頭開始創建 AI 代理需要理解異步模式、工具集成和多代理交接。本技能提供生產就緒的腳手架模式,讓您可以專注於代理邏輯而非樣板代碼。
スキルZIPをダウンロード
Claudeでアップロード
設定 → 機能 → スキル → スキルをアップロードへ移動
オンにして利用開始
テストする
「scaffolding-openai-agents」を使用しています。 Create an agent that helps students learn Python with async patterns and function tools for code execution
期待される結果:
- Agent configured with name, instructions, and tools
- Async main function using Runner.run() pattern
- Function tool decorator for custom operations
- Conversation continuation with message history
- Streaming response handling for real-time output
「scaffolding-openai-agents」を使用しています。 Build a multi-agent system with a triage agent that routes programming questions to specialist agents
期待される結果:
- Triage agent with handoff descriptions
- Specialist agents for concepts, debugging, and exercises
- Automatic routing based on question content
- Agent handoff implementation with full context transfer
「scaffolding-openai-agents」を使用しています。 Add input validation to prevent non-programming questions from reaching the tutoring agent
期待される結果:
- Input guardrail function checking for programming keywords
- GuardrailFunctionOutput with tripwire_triggered flag
- Agent configured with input_guardrails list
- Non-programming questions blocked before agent processing
セキュリティ監査
安全Pure documentation skill containing example code patterns and a simple validation script. No malicious code, no credential access, no network exfiltration, no persistence mechanisms. All static findings are false positives from the scanner misinterpreting documentation text and markdown code blocks as executable code.
リスク要因
品質スコア
作れるもの
創建教學代理
構建能夠解釋概念並引導學生完成學習材料的智能教學代理
協調專業代理
設計多代理系統,使專業代理通過交接路由處理不同任務
將代理與 FastAPI 集成
在 FastAPI 端點中包裝 OpenAI 代理以進行生產環境 API 部署,支持流式傳輸
これらのプロンプトを試す
使用 OpenAI Agents SDK 創建一個能夠回答 Python 編程問題的代理。包含異步 Runner 使用和流式響應。
為現有代理添加函數工具。創建使用 httpx 的天氣查詢工具和安全計算表達式的計算器工具。
設計帶有分診代理的多代理系統,將查詢路由到專業代理。使用交接進行代理間通信。
為代理添加輸入和輸出護欄。驗證用戶問題與編程相關,並確保輸出不包含完整解決方案。
ベストプラクティス
- 始終使用 Runner.run() 的 async/await 模式以實現可擴展的代理執行
- 為多代理系統中的有效路由,使用清晰的交接描述標記代理
- 使用帶有 output_type 的 Pydantic 模型以保證結構化 JSON 響應
- 早期實施護欄以驗證輸入並防止不需要的輸出
回避
- 不要在函數工具中使用 eval() 進行表達式評估 - 使用 safe_eval 或數學庫代替
- 不要跳過輸入驗證 - 始終在處理前驗證用戶內容
- 不要硬編碼 API 金鑰 - 使用環境變量存儲憑證