مشاركة عبر


أداة مفسر الشيفرة لوكلاء مايكروسوفت فاوندري

يتيح مفسر الكود لوكيل Microsoft Foundry تشغيل كود Python في بيئة تنفيذ موحدة (sandbox). استخدم هذه الأداة لتحليل البيانات، وتوليد المخططات، والمهام التكرارية لحل المشكلات التي تستفيد من تنفيذ الكود.

في هذا المقال، تقوم بإنشاء وكيل يستخدم Code Interpreter، ورفع ملف CSV للتحليل، وتنزيل مخطط تم إنشاؤه.

عند تفعيل Code Interpreter، يمكن لوكيلك كتابة وتشغيل كود بايثون بشكل تكراري لحل مهام تحليل البيانات والرياضيات، وتوليد الرسوم البيانية.

مهم

لدى Code Interpreter رسوم إضافية تتجاوز الرسوم القائمة على الرموز لاستخدام OpenAI Azure. إذا استدعى وكيلك مترجم الشيفرة في نفس الوقت في محادثتين مختلفتين، فإنه ينشئ جلستين لمفسر الكود. كل جلسة تكون نشطة افتراضيا لمدة ساعة واحدة مع مهلة توقف لمدة 30 دقيقة.

دعم الاستخدام

✔️ (GA) تشير إلى التوفر العام، ✔️ (معاينة) تشير إلى معاينة عامة، وشرطة شرطة (-) تشير إلى عدم توفر الميزة.

دعم مايكروسوفت فاوندري حزمة تطوير التطوير الخاصة لبايثون C # SDK حزمة تطوير جافاسكريبت مجموعة تطوير جافا واجهة برمجة تطبيقات REST إعداد العامل الأساسي إعداد العامل القياسي
✔️ ✔️ (GA) ✔️ (معاينة) ✔️ (GA) ✔️ (معاينة) ✔️ (GA) ✔️ ✔️

المتطلبات المسبقه

  • بيئة وكيل أساسية أو قياسية. راجع إعداد بيئة الوكيل لمزيد من التفاصيل.
  • أحدث حزمة SDK مثبتة للغتك. مجموعات تطوير .NET و Java حاليا قيد المعاينة. راجع البدء السريع لخطوات التثبيت.
  • تم إعداد نشر نموذج Azure AI في مشروعك.
  • بالنسبة لعمليات الملفات: ملفات CSV أو ملفات مدعومة أخرى للرفع للتحليل.

‏‫ملاحظة‬

مترجم الشيفرة غير متوفر في جميع المناطق. انظر تحقق من توفر المناطق الإقليمية والطرازات.

إنشاء وكيل باستخدام مفسر الشيفرة

توضح العينات التالية كيفية إنشاء وكيل مع تفعيل Code Interpreter، ورفع ملف للتحليل، وتنزيل الناتج المولد.

مثال على استخدام أداة مفسر الوكيل مع الكود في Python SDK

توضح عينة Python التالية كيفية إنشاء وكيل باستخدام أداة مفسر الكود، ورفع ملف CSV للتحليل، وطلب مخطط شريطي بناء على البيانات. يظهر سير عمل كامل: رفع ملف، إنشاء وكيل مع تفعيل Code Interpreter، طلب عرض البيانات، وتنزيل المخطط المولد.

import os
from azure.identity import DefaultAzureCredential
from azure.ai.projects import AIProjectClient
from azure.ai.projects.models import PromptAgentDefinition, CodeInterpreterTool, AutoCodeInterpreterToolParam

# Load the CSV file to be processed
asset_file_path = os.path.abspath(
    os.path.join(os.path.dirname(__file__), "../assets/synthetic_500_quarterly_results.csv")
)

# Format: "https://resource_name.ai.azure.com/api/projects/project_name"
PROJECT_ENDPOINT = "your_project_endpoint"

# Create clients to call Foundry API
project = AIProjectClient(
    endpoint=PROJECT_ENDPOINT,
    credential=DefaultAzureCredential(),
)
openai = project.get_openai_client()

# Upload the CSV file for the code interpreter to use
file = openai.files.create(purpose="assistants", file=open(asset_file_path, "rb"))

# Create agent with code interpreter tool
agent = project.agents.create_version(
    agent_name="MyAgent",
    definition=PromptAgentDefinition(
        model="gpt-5-mini",
        instructions="You are a helpful assistant.",
        tools=[CodeInterpreterTool(container=AutoCodeInterpreterToolParam(file_ids=[file.id]))],
    ),
    description="Code interpreter agent for data analysis and visualization.",
)

# Create a conversation for the agent interaction
conversation = openai.conversations.create()

# Send request to create a chart and generate a file
response = openai.responses.create(
    conversation=conversation.id,
    input="Could you please create bar chart in TRANSPORTATION sector for the operating profit from the uploaded csv file and provide file to me?",
    extra_body={"agent_reference": {"name": agent.name, "type": "agent_reference"}},
)

# Extract file information from response annotations
file_id = ""
filename = ""
container_id = ""

# Get the last message which should contain file citations
last_message = response.output[-1]  # ResponseOutputMessage
if (
    last_message.type == "message"
    and last_message.content
    and last_message.content[-1].type == "output_text"
    and last_message.content[-1].annotations
):
    file_citation = last_message.content[-1].annotations[-1]  # AnnotationContainerFileCitation
    if file_citation.type == "container_file_citation":
        file_id = file_citation.file_id
        filename = file_citation.filename
        container_id = file_citation.container_id
        print(f"Found generated file: {filename} (ID: {file_id})")

# Clean up resources
project.agents.delete_version(agent_name=agent.name, agent_version=agent.version)

# Download the generated file if available
if file_id and filename:
    file_content = openai.containers.files.content.retrieve(file_id=file_id, container_id=container_id)
    print(f"File ready for download: {filename}")
    file_path = os.path.join(os.path.dirname(__file__), filename)
    with open(file_path, "wb") as f:
        f.write(file_content.read())
    print(f"File downloaded successfully: {file_path}")
else:
    print("No file generated in response")

الإخراج المتوقع

ينتج الكود النموذجي مخرجا مشابها للمثال التالي:

Found generated file: transportation_operating_profit_bar_chart.png (ID: file-xxxxxxxxxxxxxxxxxxxx)
File ready for download: transportation_operating_profit_bar_chart.png
File downloaded successfully: transportation_operating_profit_bar_chart.png

يقوم الوكيل بتحميل ملف CSV الخاص بك إلى تخزين Azure، وينشئ بيئة Python مزينة بصندوق الرمل، ويحلل البيانات لتصفية سجلات قطاع النقل، وينشئ مخطط شرطي PNG يوضح الربح التشغيلي حسب ربع السنة، ثم يقوم بتنزيل المخطط إلى دليلك المحلي. توفر تعليقات الملفات في الرد معرف الملف ومعلومات الحاوية اللازمة لاسترجاع المخطط المولد.

أنشئ مخططا باستخدام Code Interpreter بلغة C#‎

توضح عينة C# التالية كيفية إنشاء وكيل باستخدام أداة مفسر الشيفرة واستخدامه لإنشاء مخطط شريطي. يقوم الوكيل بكتابة وتنفيذ كود Python (باستخدام matplotlib) في حاوية معززة بصندوق مفتوح. للاستخدام غير المتزامن، راجع عينة الكود في مستودع Azure SDK for .NET على GitHub.

using System;
using Azure.AI.Projects;
using Azure.AI.Extensions.OpenAI;
using Azure.Identity;

// Format: "https://resource_name.ai.azure.com/api/projects/project_name"
var projectEndpoint = "your_project_endpoint";

// Create project client to call Foundry API
AIProjectClient projectClient = new(
    endpoint: new Uri(projectEndpoint),
    tokenProvider: new DefaultAzureCredential());

// Create an agent with Code Interpreter enabled.
PromptAgentDefinition agentDefinition = new(model: "gpt-5-mini")
{
    Instructions = "You are a data visualization assistant. When asked to create charts, write and run Python code using matplotlib to generate them.",
    Tools = {
        ResponseTool.CreateCodeInterpreterTool(
            new CodeInterpreterToolContainer(
                CodeInterpreterToolContainerConfiguration.CreateAutomaticContainerConfiguration(
                    fileIds: []
                )
            )
        ),
    }
};
AgentVersion agentVersion = projectClient.Agents.CreateAgentVersion(
    agentName: "myChartAgent",
    options: new(agentDefinition));

// Ask the agent to create a bar chart from inline data.
AgentReference agentReference = new(name: agentVersion.Name, version: agentVersion.Version);
ProjectResponsesClient responseClient = projectClient.OpenAI.GetProjectResponsesClientForAgent(agentReference);

ResponseResult response = responseClient.CreateResponse(
    "Create a bar chart showing quarterly revenue for 2025: Q1=$2.1M, Q2=$2.8M, Q3=$3.2M, Q4=$2.9M. " +
    "Use a blue color scheme, add data labels on each bar, and title the chart 'Quarterly Revenue 2025'. " +
    "Save the chart as a PNG file.");

Console.WriteLine(response.GetOutputText());

// Clean up
projectClient.Agents.DeleteAgentVersion(agentName: agentVersion.Name, agentVersion: agentVersion.Version);

الإخراج المتوقع

ينتج الكود النموذجي مخرجا مشابها للمثال التالي:

Here is the bar chart showing quarterly revenue for 2025. The chart displays Q1 ($2.1M), Q2 ($2.8M), Q3 ($3.2M), and Q4 ($2.9M) with a blue color scheme, data labels on each bar, and the title "Quarterly Revenue 2025".

يقوم الوكيل بإنشاء جلسة Code Interpreter، ويكتب كود بايثون باستخدام matplotlib لإنشاء مخطط الشريط، ويشغل الكود في بيئة مفتوحة (sandbox)، ويعيد المخطط كملف تم إنشاؤه. لمثال يقوم بتحميل ملف CSV وتنزيل المخطط المولد، اختر Python أو TypeScript من محدد اللغة في أعلى هذا المقال.

عينة من استخدام أداة الوكيل مع مفسر الشيفرة في TypeScript SDK

توضح عينة TypeScript التالية كيفية إنشاء وكيل باستخدام أداة مفسر الكود، ورفع ملف CSV للتحليل، وطلب مخطط شريطي بناء على البيانات. للحصول على نسخة جافا سكريبت، راجع JavaScript sample في Azure SDK مستودع JavaScript على GitHub.

import { DefaultAzureCredential } from "@azure/identity";
import { AIProjectClient } from "@azure/ai-projects";
import * as fs from "fs";
import * as path from "path";
import { fileURLToPath } from "url";

// Format: "https://resource_name.ai.azure.com/api/projects/project_name"
const PROJECT_ENDPOINT = "your_project_endpoint";

// Helper to resolve asset file path
const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);

export async function main(): Promise<void> {
  // Create clients to call Foundry API
  const project = new AIProjectClient(PROJECT_ENDPOINT, new DefaultAzureCredential());
  const openai = project.getOpenAIClient();

  // Load and upload CSV file
  const assetFilePath = path.resolve(
    __dirname,
    "../assets/synthetic_500_quarterly_results.csv",
  );
  const fileStream = fs.createReadStream(assetFilePath);

  // Upload CSV file
  const uploadedFile = await openai.files.create({
    file: fileStream,
    purpose: "assistants",
  });

  // Create agent with Code Interpreter tool
  const agent = await project.agents.createVersion("MyAgent", {
    kind: "prompt",
    model: "gpt-5-mini",
    instructions: "You are a helpful assistant.",
    tools: [
      {
        type: "code_interpreter",
        container: {
          type: "auto",
          file_ids: [uploadedFile.id],
        },
      },
    ],
  });

  // Create a conversation
  const conversation = await openai.conversations.create();

  // Request chart generation
  const response = await openai.responses.create(
    {
      conversation: conversation.id,
      input:
        "Could you please create bar chart in TRANSPORTATION sector for the operating profit from the uploaded csv file and provide file to me?",
    },
    {
      body: { agent: { name: agent.name, type: "agent_reference" } },
    },
  );

  // Extract file information from response annotations
  let fileId = "";
  let filename = "";
  let containerId = "";

  // Get the last message which should contain file citations
  const lastMessage = response.output?.[response.output.length - 1];
  if (lastMessage && lastMessage.type === "message") {
    // Get the last content item
    const textContent = lastMessage.content?.[lastMessage.content.length - 1];
    if (textContent && textContent.type === "output_text" && textContent.annotations) {
      // Get the last annotation (most recent file)
      const fileCitation = textContent.annotations[textContent.annotations.length - 1];
      if (fileCitation && fileCitation.type === "container_file_citation") {
        fileId = fileCitation.file_id;
        filename = fileCitation.filename;
        containerId = fileCitation.container_id;
        console.log(`Found generated file: ${filename} (ID: ${fileId})`);
      }
    }
  }

  // Download the generated file if available
  if (fileId && filename) {
    const safeFilename = path.basename(filename);
    const fileContent = await openai.containers.files.content.retrieve({
      file_id: fileId,
      container_id: containerId,
    });

    // Read the readable stream into a buffer
    const chunks: Buffer[] = [];
    for await (const chunk of fileContent.body) {
      chunks.push(Buffer.from(chunk));
    }
    const buffer = Buffer.concat(chunks);

    fs.writeFileSync(safeFilename, buffer);
    console.log(`File ${safeFilename} downloaded successfully.`);
    console.log(`File ready for download: ${safeFilename}`);
  } else {
    console.log("No file generated in response");
  }

  // Clean up resources
  await project.agents.deleteVersion(agent.name, agent.version);
}

main().catch((err) => {
  console.error("The sample encountered an error:", err);
});

الإخراج المتوقع

ينتج الكود النموذجي مخرجا مشابها للمثال التالي:

Found generated file: transportation_operating_profit_bar_chart.png (ID: file-xxxxxxxxxxxxxxxxxxxx)
File transportation_operating_profit_bar_chart.png downloaded successfully.
File ready for download: transportation_operating_profit_bar_chart.png

يقوم الوكيل بتحميل ملف CSV الخاص بك إلى تخزين Azure، وينشئ بيئة Python مزينة بصندوق الرمل، ويحلل البيانات لتصفية سجلات قطاع النقل، وينشئ مخطط شرطي PNG يوضح الربح التشغيلي حسب ربع السنة، ثم يقوم بتنزيل المخطط إلى دليلك المحلي. توفر تعليقات الملفات في الرد معرف الملف ومعلومات الحاوية اللازمة لاسترجاع المخطط المولد.

أنشئ مخططا باستخدام Code Interpreter بلغة Java

أضف الاعتماد إلى :pom.xml

<dependency>
    <groupId>com.azure</groupId>
    <artifactId>azure-ai-agents</artifactId>
    <version>2.0.0-beta.3</version>
</dependency>

أنشئ وكيلا وأنشئ مخططا بيانيا

import com.azure.ai.agents.AgentsClient;
import com.azure.ai.agents.AgentsClientBuilder;
import com.azure.ai.agents.ResponsesClient;
import com.azure.ai.agents.models.AgentReference;
import com.azure.ai.agents.models.AgentVersionDetails;
import com.azure.ai.agents.models.AzureCreateResponseOptions;
import com.azure.ai.agents.models.CodeInterpreterTool;
import com.azure.ai.agents.models.PromptAgentDefinition;
import com.azure.identity.DefaultAzureCredentialBuilder;
import com.openai.models.responses.Response;
import com.openai.models.responses.ResponseCreateParams;

import java.util.Collections;

public class CodeInterpreterChartExample {
    public static void main(String[] args) {
        // Format: "https://resource_name.ai.azure.com/api/projects/project_name"
        String projectEndpoint = "your_project_endpoint";

        AgentsClientBuilder builder = new AgentsClientBuilder()
            .credential(new DefaultAzureCredentialBuilder().build())
            .endpoint(projectEndpoint);

        AgentsClient agentsClient = builder.buildAgentsClient();
        ResponsesClient responsesClient = builder.buildResponsesClient();

        // Create code interpreter tool
        CodeInterpreterTool codeInterpreter = new CodeInterpreterTool();

        // Create agent with code interpreter for data visualization
        PromptAgentDefinition agentDefinition = new PromptAgentDefinition("gpt-5-mini")
            .setInstructions("You are a data visualization assistant. When asked to create charts, "
                + "write and run Python code using matplotlib to generate them.")
            .setTools(Collections.singletonList(codeInterpreter));

        AgentVersionDetails agent = agentsClient.createAgentVersion("chart-agent", agentDefinition);

        // Request a bar chart with inline data
        AgentReference agentReference = new AgentReference(agent.getName())
            .setVersion(agent.getVersion());

        Response response = responsesClient.createAzureResponse(
            new AzureCreateResponseOptions().setAgentReference(agentReference),
            ResponseCreateParams.builder()
                .input("Create a bar chart showing quarterly revenue for 2025: "
                    + "Q1=$2.1M, Q2=$2.8M, Q3=$3.2M, Q4=$2.9M. "
                    + "Use a blue color scheme, add data labels on each bar, "
                    + "and title the chart 'Quarterly Revenue 2025'. "
                    + "Save the chart as a PNG file."));

        System.out.println("Response: " + response.output());

        // Clean up
        agentsClient.deleteAgentVersion(agent.getName(), agent.getVersion());
    }
}

الإخراج المتوقع

Response: Here is the bar chart showing quarterly revenue for 2025 with Q1 ($2.1M), Q2 ($2.8M), Q3 ($3.2M), and Q4 ($2.9M) displayed in blue with data labels.

يقوم الوكيل بإنشاء جلسة مفسر الكود، ويكتب شيفرة بايثون باستخدام matplotlib لإنشاء المخطط، وينفذ الكود في بيئة مفتوحة. لمثال يقوم بتحميل ملف CSV وتنزيل المخطط المولد، اختر Python أو TypeScript من محدد اللغة في أعلى هذا المقال. لمزيد من الأمثلة، راجع Azure AI Agents Java SDK samples.

أنشئ مخططا باستخدام Code Interpreter باستخدام واجهة برمجة تطبيقات REST

يوضح المثال التالي كيفية رفع ملف CSV، وإنشاء وكيل باستخدام Code Interpreter، وطلب جدول، وتنزيل الملف المولد.

المتطلبات المسبقه

اضبط هذه المتغيرات البيئية:

  • FOUNDRY_PROJECT_ENDPOINT: رابط نقطة نهاية مشروعك.
  • AGENT_TOKEN: رمز حامل للمفاهرة.

الحصول على رمز مميز للوصول:

export AGENT_TOKEN=$(az account get-access-token --scope "https://ai.azure.com/.default" --query accessToken -o tsv)

1. رفع ملف CSV

curl -X POST "$FOUNDRY_PROJECT_ENDPOINT/openai/v1/files" \
  -H "Authorization: Bearer $AGENT_TOKEN" \
  -F "purpose=assistants" \
  -F "file=@quarterly_results.csv"

احفظ من id الرد (على سبيل المثال، file-abc123).

2. إنشاء وكيل مع مفسر كود

curl -X POST "$FOUNDRY_PROJECT_ENDPOINT/agents?api-version=v1" \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $AGENT_TOKEN" \
  -d '{
    "name": "chart-agent",
    "definition": {
      "kind": "prompt",
      "model": "<MODEL_DEPLOYMENT>",
      "instructions": "You are a data visualization assistant. When asked to create charts, write and run Python code using matplotlib to generate them.",
      "tools": [
        {
          "type": "code_interpreter",
          "container": {
            "type": "auto",
            "file_ids": ["<FILE_ID>"]
          }
        }
      ]
    }
  }'

3. إنشاء مخطط

curl -X POST "$FOUNDRY_PROJECT_ENDPOINT/openai/v1/responses" \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $AGENT_TOKEN" \
  -d '{
    "agent_reference": {"type": "agent_reference", "name": "chart-agent"},
    "input": "Create a bar chart of operating profit by quarter from the uploaded CSV file. Use a blue color scheme and add data labels."
  }'

يتضمن container_file_citation الرد تعليقات توضيحية مع تفاصيل الملف التي تم إنشاؤها. احفظ قيم container_id و file_id من التعليق.

4. تحميل المخطط المولد

curl -X GET "$FOUNDRY_PROJECT_ENDPOINT/openai/v1/containers/<CONTAINER_ID>/files/<FILE_ID>/content" \
  -H "Authorization: Bearer $AGENT_TOKEN" \
  --output chart.png

5. التنظيف

curl -X DELETE "$FOUNDRY_PROJECT_ENDPOINT/agents/chart-agent?api-version=v1" \
  -H "Authorization: Bearer $AGENT_TOKEN"

تحقق من توفر المناطق الإقليمية والنماذج

تختلف توفر الأدوات حسب المنطقة والنموذج.

للاطلاع على القائمة الحالية للمناطق والنماذج المدعومة لكود فيريتر، راجع أفضل الممارسات لاستخدام الأدوات في خدمة وكلاء مايكروسوفت فاوندري.

أنواع الملفات المعتمدة

تنسيق الملف MIME type
.c text/x-c
.cpp text/x-c++
.csv application/csv
.docx application/vnd.openxmlformats-officedocument.wordprocessingml.document
.html text/html
.java text/x-java
.json application/json
.md text/markdown
.pdf application/pdf
.php text/x-php
.pptx application/vnd.openxmlformats-officedocument.presentationml.presentation
.py text/x-python
.py text/x-script.python
.rb text/x-ruby
.tex text/x-tex
.txt text/plain
.css text/css
.jpeg image/jpeg
.jpg image/jpeg
.js text/javascript
.gif image/gif
.png image/png
.tar application/x-tar
.ts application/typescript
.xlsx application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
.xml application/xml او text/xml
.zip application/zip

استكشاف الأخطاء وإصلاحها

مشكلة السبب المحتمل الحل
مترجم الشيفرة لا يعمل. الأداة غير مفعلة أو النموذج لا يدعمها في منطقتك. تأكيد تفعيل مفسر الرموز على الوكيل. تحقق من أن نشر النموذج يدعم الأداة في منطقتك. انظر تحقق من توفر المناطق الإقليمية والطرازات.
لا يتم إنشاء أي ملف. أعاد الوكيل ردا نصيا فقط دون تعليق ملف. تحقق من تعليقات الرد ل container_file_citation. إذا لم يكن هناك ملف، فهذا يعني أن الوكيل لم يولد ملفا. أعد صياغة الرسالة لطلب إخراج ملف بشكل صريح.
فشل رفع الملف. نوع ملف غير مدعوم أو غرض خاطئ. تأكد من أن نوع الملف موجود في قائمة أنواع الملفات المدعومة . ارفع الملف باستخدام purpose="assistants".
الملف المولد تالف أو فارغ. خطأ في تنفيذ الكود أو معالجة غير مكتملة. تحقق من رد الوكيل بحثا عن رسائل خطأ. تحقق من صحة بيانات الإدخال. جرب طلبا أبسط أولا.
مهلة الجلسة أو تأخير عالي. جلسات مفسر الشيفرة لها حدود زمنية. الجلسات تحتوي على مهلة نشطة مدتها ساعة واحدة ومهلة خمول مدتها 30 دقيقة. قلل من تعقيد العمليات أو قسم إلى مهام أصغر.
رسوم فوترة غير متوقعة. تم إنشاء عدة جلسات متزامنة متزامنة. كل محادثة تخلق جلسة منفصلة. راقب استخدام الجلسة ودمج العمليات حيثما أمكن.
حزمة Python غير متوفرة. يحتوي مفسر الشيفرة على مجموعة ثابتة من الحزم. يتضمن مفسر الشيفرة حزم علوم البيانات الشائعة. للحزم المخصصة، استخدم مفسر الشيفرة المخصصة.
فشل تحميل الملف. معرف الحاوية أو معرف الملف غير صحيح. تحقق من أنك تستخدم التعليقات الصحيحة container_id ومن file_id الرد.

تنظيف الموارد

احذف الموارد التي أنشأتها في هذه العينة عندما لا تعود بحاجة إليها لتجنب التكاليف المستمرة:

  • احذف نسخة الوكيل.
  • احذف المحادثة.
  • احذف الملفات المرفوعة.

للحصول على أمثلة على أنماط المحادثة وتنظيف الملفات، راجع أداة البحث على الويبوأداة البحث عن الملفات للوكلاء.

بيئة التنفيذ المفتوح

يعمل Code Interpreter على تشغيل كود بايثون في صندوق رمل تديره مايكروسوفت. تم تصميم صندوق الرمل لتشغيل كود غير موثوق ويستخدم جلسات ديناميكية (جلسات مفسر الكود) في تطبيقات حاويات أزرور. كل جلسة معزولة بحدود Hyper-V.

السلوكيات الرئيسية التي يجب التخطيط لها:

  • المنطقة: يعمل صندوق الرمل لمفتاح الرموز في نفس منطقة Azure التي يعمل بها مشروع Foundry الخاص بك.
  • مدة الجلسة: تكون جلسة مفسر الشيفرة نشطة لمدة تصل إلى ساعة واحدة، مع مهلة توقف (انظر الملاحظة المهمة في بداية هذا المقال).
  • العزل: كل جلسة تجري في بيئة معزولة. إذا استدعى وكيلك مترجم الرموز في محادثات مختلفة، يتم إنشاء جلسات منفصلة.
  • عزل الشبكة والوصول إلى الإنترنت: لا يرث صندوق اللعب تكوين شبكة الوكيل الفرعية الخاصة بك، والجلسات الديناميكية لا يمكنها إجراء طلبات الشبكة الصادرة.
  • الملفات في صندوق الرمل: وقت تشغيل بايثون المدمج في صندوق الرمل يتيح الوصول إلى الملفات التي ترفقها للتحليل. يمكن لكود فبرترير أيضا توليد ملفات مثل الرسوم البيانية وإعادتها كمخرجات قابلة للتنزيل.

إذا كنت بحاجة إلى تحكم أكبر في وقت تشغيل صندوق الرمل أو إلى نموذج عزل مختلف، راجع أداة مفسر الشيفرة المخصصة للوكلاء.