用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
直接命令不会经过审查 Prompt;运行前请先检查来源。
npx skills add https://github.com/tomevault-io/skills-registry --skill foundry-code-interpreter命令会保持在同一行。复制前请横向滚动并检查完整内容。
想先保存到本地?可下载 SkillsMP 当前能够提供的文件。
基于 SOC 职业分类
正在显示 SKILL.md
| name | foundry-code-interpreter |
| description | | Use when this capability is needed. |
Create an ad-hoc Foundry agent with Code Interpreter enabled using the new v2 Responses API.
The agent can write and execute Python code in a sandboxed environment to solve data analysis tasks, generate visualizations, and perform computations.
The user must have completed the Foundry setup (the setup-foundry skill). They need:
FOUNDRY_PROJECT_ENDPOINT -- the project endpoint URLFOUNDRY_MODEL_DEPLOYMENT_NAME -- the model deployment name (e.g. gpt-4.1-mini)If these are not set, ask the user for the values.
Ask the user what they want the code interpreter agent to do. Examples:
If the user provides a file, note the file path for upload.
Use the following Python script. Replace placeholders with actual values.
Without file upload (computation / code generation):
python3 << 'PYEOF'
import os
from azure.identity import DefaultAzureCredential
from azure.ai.projects import AIProjectClient
from azure.ai.projects.models import PromptAgentDefinition, CodeInterpreterTool, CodeInterpreterToolAuto
endpoint = os.environ.get("FOUNDRY_PROJECT_ENDPOINT", "<ENDPOINT>")
model = os.environ.get("FOUNDRY_MODEL_DEPLOYMENT_NAME", "<MODEL>")
project_client = AIProjectClient(
endpoint=endpoint,
credential=DefaultAzureCredential(),
)
with project_client:
openai_client = project_client.get_openai_client()
# Create agent with code interpreter
agent = project_client.agents.create_version(
agent_name="CodeInterpreterAgent",
definition=PromptAgentDefinition(
model=model,
instructions="You are a data analysis and computation assistant. Write and execute Python code to solve the user's problem. Show results clearly.",
tools=[CodeInterpreterTool(container=CodeInterpreterToolAuto())],
),
description="Ad-hoc code interpreter agent.",
)
print(f"Agent created: {agent.name} v{agent.version}")
# Create a conversation
conversation = openai_client.conversations.create()
print(f"Conversation: {conversation.id}")
# Send the user's request
response = openai_client.responses.create(
conversation=conversation.id,
input="USER_PROMPT_HERE",
extra_body={"agent": {"name": agent.name, "type": "agent_reference"}},
)
# Print the response
for item in response.output:
if item.type == "message":
for content in item.content:
if content.type == "output_text":
print(content.text)
# Clean up
project_client.agents.delete_version(agent_name=agent.name, agent_version=agent.version)
print("Agent cleaned up.")
PYEOF
With file upload (data analysis):
python3 << 'PYEOF'
import os
from azure.identity import DefaultAzureCredential
from azure.ai.projects import AIProjectClient
from azure.ai.projects.models import PromptAgentDefinition, CodeInterpreterTool, CodeInterpreterToolAuto
endpoint = os.environ.get("FOUNDRY_PROJECT_ENDPOINT", "<ENDPOINT>")
model = os.environ.get("FOUNDRY_MODEL_DEPLOYMENT_NAME", "<MODEL>")
file_path = "FILE_PATH_HERE"
project_client = AIProjectClient(
endpoint=endpoint,
credential=DefaultAzureCredential(),
)
with project_client:
openai_client = project_client.get_openai_client()
# Upload the file
with open(file_path, "rb") as f:
uploaded_file = openai_client.files.create(purpose="assistants", file=f)
print(f"File uploaded: {uploaded_file.id}")
# Create agent with code interpreter and file access
agent = project_client.agents.create_version(
agent_name="DataAnalysisAgent",
definition=PromptAgentDefinition(
model=model,
instructions="You are a data analysis assistant. Analyze the uploaded file and fulfil the user's request. Generate charts or output files when appropriate.",
tools=[CodeInterpreterTool(container=CodeInterpreterToolAuto(file_ids=[uploaded_file.id]))],
),
description="Ad-hoc data analysis agent with file.",
)
print(f"Agent created: {agent.name} v{agent.version}")
# Create a conversation
conversation = openai_client.conversations.create()
# Send the user's request
response = openai_client.responses.create(
conversation=conversation.id,
input="USER_PROMPT_HERE",
extra_body={"agent": {"name": agent.name, "type": "agent_reference"}},
)
# Print response and download generated files
for item in response.output:
if item.type == "message":
content item.content:
content.type == :
(content.text)
hasattr(content, ) and content.annotations:
ann content.annotations:
ann.type == :
file_content = openai_client.containers.files.content.retrieve(
file_id=ann.file_id, container_id=ann.container_id
)
safe_name = os.path.basename(ann.filename)
with open(safe_name, ) as out:
out.write(file_content.read())
(f)
project_client.agents.delete_version(agent_name=agent.name, agent_version=agent.version)
()
PYEOF
After running the script:
The conversation is stateful. If the user wants to continue the analysis, reuse the same conversation ID and agent. Only clean up when the user is done.
The code interpreter supports: .csv, .json, .xlsx, .txt, .pdf, .py, .md, .html, .png, .jpg, .gif, and more.
Source: aymenfurter/polyclaw — distributed by TomeVault.