Skip to main content
Agent Skills are folders of instructions and resources that agents can use. This guide shows how to upload a skill and build an agent that reads it.

Step 1: Get a Skill

Download from Anthropic Skills Repository:
git clone https://github.com/anthropics/skills.git
cd skills/skills/internal-comms
zip -r internal-comms.zip .

Step 2: Upload the Skill

import os
from acontext import AcontextClient, FileUpload

client = AcontextClient(api_key=os.getenv("ACONTEXT_API_KEY"))

with open("internal-comms.zip", "rb") as f:
    skill = client.skills.create(
        file=FileUpload(filename="internal-comms.zip", content=f.read())
    )
print(f"Skill ID: {skill.id}")

Step 3: Build an Agent with Sandbox Tools

import json
import os
from acontext import AcontextClient
from acontext.agent.sandbox import SANDBOX_TOOLS
from openai import OpenAI

client = AcontextClient(api_key=os.getenv("ACONTEXT_API_KEY"))
openai_client = OpenAI()

skill_id = "your-skill-id"

# Create sandbox and disk
sandbox = client.sandboxes.create()
disk = client.disks.create()

# Mount skill in sandbox
ctx = SANDBOX_TOOLS.format_context(
    client,
    sandbox_id=sandbox.sandbox_id,
    disk_id=disk.id,
    mount_skills=[skill_id]
)

tools = SANDBOX_TOOLS.to_openai_tool_schema()
context_prompt = ctx.get_context_prompt()

messages = [
    {"role": "system", "content": f"You have sandbox tools.\n\n{context_prompt}"},
    {"role": "user", "content": "What communication guidelines should I follow?"}
]

# Agent loop
while True:
    response = openai_client.chat.completions.create(
        model="gpt-4.1", messages=messages, tools=tools
    )
    message = response.choices[0].message
    messages.append(message)

    if not message.tool_calls:
        print(f"Assistant: {message.content}")
        break

    for tc in message.tool_calls:
        result = SANDBOX_TOOLS.execute_tool(ctx, tc.function.name, json.loads(tc.function.arguments))
        messages.append({"role": "tool", "tool_call_id": tc.id, "content": result})

# Cleanup
client.sandboxes.kill(sandbox.sandbox_id)
client.disks.delete(disk.id)

Alternative: Skill Content Tools

For read-only skills (no scripts to execute):
import json
import os
from acontext import AcontextClient
from acontext.agent.skill import SKILL_TOOLS
from openai import OpenAI

client = AcontextClient(api_key=os.getenv("ACONTEXT_API_KEY"))
openai_client = OpenAI()

ctx = SKILL_TOOLS.format_context(client, ["your-skill-id"])
tools = SKILL_TOOLS.to_openai_tool_schema()

messages = [
    {"role": "system", "content": f"You have skill access.\n\n{ctx.get_context_prompt()}"},
    {"role": "user", "content": "What are the guidelines?"}
]

while True:
    response = openai_client.chat.completions.create(
        model="gpt-4.1", messages=messages, tools=tools
    )
    message = response.choices[0].message
    messages.append(message)

    if not message.tool_calls:
        print(f"Assistant: {message.content}")
        break

    for tc in message.tool_calls:
        result = SKILL_TOOLS.execute_tool(ctx, tc.function.name, json.loads(tc.function.arguments))
        messages.append({"role": "tool", "tool_call_id": tc.id, "content": result})

When to Use Each

ApproachUse When
Sandbox ToolsSkill has executable scripts
Skill Content ToolsSkill is read-only reference

Next Steps