ワンクリックで
create-subagent
Create a new Python subagent file in the workspace. After creating, use run_subagent to test it (NOT use_saved_subagent).
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
メニュー
Create a new Python subagent file in the workspace. After creating, use run_subagent to test it (NOT use_saved_subagent).
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
Complete the task with a final answer and save reusable subagents as skills. Use this when you have successfully solved the question.
List all previously saved subagent skills. Use this to check if a suitable subagent already exists before creating a new one.
Edit an existing subagent file by replacing specific code snippets. Supports both workspace files and saved skills.
Run a subagent - either a newly created one from workspace or a saved subagent from previous sessions.
View the source code of a saved subagent skill. Use this to understand how an existing subagent works before reusing or adapting it.
**Problem Category**: Audio file transcription using OpenAI Whisper
SOC 職業分類に基づく
| name | create_subagent |
| description | Create a new Python subagent file in the workspace. After creating, use run_subagent to test it (NOT use_saved_subagent). |
Create a new Python subagent file in the workspace (temporary directory).
After create_subagent, use run_subagent to run it:
create_subagent → run_subagent (with query) → finish
DO NOT use use_saved_subagent for newly created subagents!
run_subagent: For subagents you just created (in workspace)use_saved_subagent: ONLY for subagents listed by list_saved_subagents<action>create_subagent</action>
<params>
{
"skill_name": "my_subagent_name",
"filename": "subagent.py",
"code": "your python code here",
"skills": ["local_search", "open_page"]
}
</params>
| Parameter | Type | Default | Description |
|---|---|---|---|
| skill_name | str | required | Name for this subagent (used when saving with finish) |
| filename | str | "subagent.py" | Name of the file to create in workspace |
| code | str | required | The Python code for the subagent |
| skills | list | ["local_search", "open_page"] | List of tool skill names this subagent will use. You MUST call get_skill_description for each tool skill BEFORE creating the subagent to understand how to use them. |
{
"success": True,
"path": "/path/to/workspace/subagent.py",
"message": "Subagent created with skills: [...]"
}
Use run_subagent with the same filename to test:
<action>run_subagent</action>
<params>{"filename": "subagent.py", "query": "your test query"}</params>
The LLM is the core reasoning engine of your subagent. Use it like this:
from llm import call_llm
response = call_llm(
system="You are a research assistant.",
messages=[{"role": "user", "content": "Your prompt here"}],
max_tokens=2000 # optional, default 8000
)
# Returns: str - The LLM's text response, or "Error:..." on failure
IMPORTANT: call_llm requires TWO positional arguments:
system: A string for the system promptmessages: A list of message dicts with "role" and "content" keysIMPORTANT: Before using any tool skill, use get_skill_description to read its documentation and understand:
Each tool skill has a SKILL.md file that shows exactly how to use it. For example:
# For search tool - check its SKILL.md first with get_skill_description
from tools import local_search
results = local_search(query="your query", topk=10)
# For open_page tool - check its SKILL.md first with get_skill_description
from tools import open_page
content = open_page(docid="doc_id_from_search")
Workflow:
get_skill_description("local_search") to read the tool's documentation.json file in the workspace, and the consuming subagent reads from that JSON file. This avoids passing large data through return values and keeps subagent interfaces clean.output.md, result.png, data.json). The subagent runs in a workspace directory, so relative paths will automatically save files to the correct location. Do NOT use absolute paths like /Users/.../file.md for output.
plt.savefig('chart.png'), pathlib.Path('result.md').write_text(...), json.dump(data, open('data.json', 'w'))matplotlib for plotting, Do NOT use emoji characters (e.g., \U0001f4c8, 📈, 😊) in any labels, titles, legends, annotations, or text elements. Emojis are NOT supported by matplotlib's default fonts and will cause rendering failures or missing characters. Use plain text only.get_skill_description for EVERY tool skill the subagent will use. This is mandatory to understand:
main(query) function receives the question as a parameter and returns a dictdef main(query): as the entry pointA subagent will be saved and reused for MANY different questions of the same category. NEVER hardcode the current question's specific details (entity names, dates, search terms, expected answers, if-checks for specific strings) into the code.
Instead, ALL question-specific logic must be driven by call_llm at runtime:
call_llm based on the query parameter, not written as string literalscall_llm analyzing search results, not by if "SomeName" in textcall_llm reasoning over evidence, not hardcodedSelf-test: Mentally replace the query parameter with a completely different question of the same category. If the code would break or return nonsense, it is too specific — rewrite it to be input-driven.
Example 1: Web Data Extraction
Task: "Scrape the price of iPhone 15 from amazon.com"
❌ BAD — hardcoded product and URL:
def main(query):
page = open_page("https://www.amazon.com/dp/B0CHP7Y5VN")
price = call_llm(
system="Extract the price of iPhone 15 from this page.",
messages=[{"role": "user", "content": page}]
)
return {"answer": price, "summary": "Found iPhone 15 price."}
✅ GOOD — LLM-driven extraction, works for any product:
def main(query):
# Step 1: LLM decides what to search for based on the query
search_plan = call_llm(
system="You are a web research planner. Given a user query about finding product info, generate a search query.",
messages=[{"role": "user", "content": f"Query: {query}\nGenerate a search query to find this product's information online."}]
)
results = local_search(query=search_plan, topk=5)
# Step 2: LLM picks the best result and extracts the answer
# ... (iterative search and extraction loop)
Example 2: File Processing
Task: "Convert report.csv to a bar chart"
❌ BAD — hardcoded file path and column names:
def main(query):
import pandas as pd
df = pd.read_csv("/Users/alice/data/report.csv")
df.plot.bar(x="month", y="revenue")
plt.savefig("/Users/alice/data/chart.png")
return {"answer": "/Users/alice/data/chart.png", "summary": "Created bar chart."}
✅ GOOD — LLM extracts file path and column info from query:
def main(query):
# Step 1: LLM parses the query to extract file path and intent
plan = call_llm(
system="You are a data visualization planner.",
messages=[{"role": "user", "content": f"Query: {query}\nExtract: 1) the file path, 2) what type of chart to create, 3) which columns to use (if specified). Return as JSON."}]
)
parsed = json.loads(plan)
# Step 2: Read the file, inspect columns, let LLM decide visualization
# ... (dynamic processing based on parsed intent)
Example 3: API Interaction
Task: "Send a Slack message to #general saying 'Hello team'"
❌ BAD — hardcoded channel and message:
def main(query):
execute_shell_command('curl -X POST -H "Authorization: Bearer xoxb-TOKEN" '
'-d \'{"channel": "#general", "text": "Hello team"}\' '
'https://slack.com/api/chat.postMessage')
return {"answer": "Sent 'Hello team' to #general", "summary": "Done."}
✅ GOOD — LLM extracts parameters from query:
def main(query):
# Step 1: LLM parses the query to extract channel, message, and action
parsed = call_llm(
system="You parse user requests about sending messages. Extract the target channel/recipient and message content. Return as JSON.",
messages=[{"role": "user", "content": f"Query: {query}"}]
)
params = json.loads(parsed)
# Step 2: Use extracted params to perform the action dynamically
# ... (send message using params["channel"] and params["message"])
Key Principle: The subagent code should be a reusable template for a category of tasks. All question-specific details (file paths, entity names, URLs, search terms, expected values) must be extracted from query at runtime via call_llm, never written as literals in the code.
Your subagent's main(query) function must return a dict with answer and summary keys. Do NOT use print() for output.
Function signature: def main(query: str) -> dict
Return format:
return {"answer": "<the answer to the focused sub-task>", "summary": "<reasoning trace with key evidence>"}
ANSWER: The direct answer to the task. Should be focused and specific.
SUMMARY: A detailed reasoning trace that includes:
Keep SUMMARY between 100-2000 words. Focus on the reasoning path and evidence, not verbose explanations.
⚠️ CRITICAL: SUMMARY must be generated by call_llm as a SEPARATE step ⚠️
Do NOT generate SUMMARY by string concatenation or truncation like analysis[:200]. Instead, after finding the answer, make a DEDICATED call_llm call to produce the SUMMARY, passing it ALL the evidence collected during the search. This ensures the SUMMARY is coherent, complete, and contains the key reasoning chain.
Example code pattern:
# WRONG - printing output
print(f"ANSWER: {final_answer}")
print(f"SUMMARY: {summary}")
# WRONG - truncated string concatenation for summary
return {"answer": final_answer, "summary": analysis[:200]}
# RIGHT - LLM-generated summary with full context, returned as dict
summary = call_llm(
system="You are a research summarizer. Write a detailed SUMMARY of the research process and findings.",
messages=[{"role": "user", "content": f"Query: {query}\nEvidence collected:\n{evidence}\nFinal answer: {answer}\n\nWrite a SUMMARY (100-2000 words) that traces the reasoning path: what was searched, what was found, what evidence supports the answer, and how the answer was verified."}],
max_tokens=3000
)
return {"answer": final_answer, "summary": summary}
Good SUMMARY example:
Searched "Mount Everest first ascent" → Found Wikipedia article stating Edmund Hillary and Tenzing Norgay reached the summit on May 29, 1953, as part of the British Expedition led by John Hunt. Verified expedition name "British Expedition 1953" from nationalgeographic.com article titled "First to Everest". Cross-checked dates match across both sources. The answer is confirmed: Edmund Hillary and Tenzing Norgay. (2 iterations)
Bad SUMMARY examples:
Research completed # Too vague, no evidence, no reasoning trace
Searched 5 queries including 'some query'. Based on the search results... # Truncated, missing actual evidence
Why this matters: The meta-agent reads your SUMMARY to decide what to do next. If your SUMMARY is vague, the meta-agent cannot refine its strategy. Even when you FAIL to find the answer, your SUMMARY must report exactly what you searched and what you found, so the meta-agent can try a different approach.
CRITICAL: Create COMPLETE PIPELINES, not weak single-shot tools
A good subagent is a full reasoning agent that can solve problems autonomously:
AVOID weak subagents that only do:
Remember: The meta agent will give subagents SIMPLER sub-problems to reduce reasoning difficulty. But each subagent should still be a COMPLETE PIPELINE capable of solving its sub-problem through autonomous reasoning.