Claude Agent Skills
Create and download PowerPoint, Excel, Word, and PDF files with Claude Agent Skills.
Pass a Skill configuration to Claude, then download generated files from Anthropic's Files API.
Code
from pathlib import Path
from typing import Any, Dict, List, Optional
from agno.agent import Agent
from agno.models.anthropic import Claude
from anthropic import Anthropic
def extract_generated_file_ids(
provider_data: Optional[Dict[str, Any]],
) -> List[str]:
provider_data = provider_data or {}
file_ids = []
for file_id in provider_data.get("file_ids", []):
if isinstance(file_id, str) and file_id not in file_ids:
file_ids.append(file_id)
def collect(value: Any) -> None:
if isinstance(value, dict):
if value.get("type") in {
"code_execution_output",
"bash_code_execution_output",
}:
file_id = value.get("file_id")
if isinstance(file_id, str) and file_id not in file_ids:
file_ids.append(file_id)
for nested_value in value.values():
collect(nested_value)
elif isinstance(value, list):
for nested_value in value:
collect(nested_value)
collect(provider_data.get("server_tool_blocks", []))
return file_ids
def download_generated_files(file_ids: List[str]) -> None:
client = Anthropic()
for file_id in file_ids:
metadata = client.beta.files.retrieve_metadata(file_id=file_id)
output_path = Path(metadata.filename).name
client.beta.files.download(file_id=file_id).write_to_file(output_path)
print(f"Downloaded {output_path}")
agent = Agent(
model=Claude(
id="claude-sonnet-4-6",
skills=[{"type": "anthropic", "skill_id": "pptx", "version": "latest"}],
),
instructions="Create concise, well-structured presentations.",
)
if __name__ == "__main__":
run = agent.run("Create a three-slide presentation about renewable energy.")
file_ids = extract_generated_file_ids(run.model_provider_data)
if not file_ids:
raise RuntimeError("Claude did not return a generated file.")
download_generated_files(file_ids)Agno adds the Skills container, the code_execution_20250825 server tool, and the code-execution-2025-08-25 and skills-2025-10-02 beta values when skills is set. Anthropic now treats that code execution version as generally available, but still accepts its legacy beta value. Agno copies IDs from Bash execution results to model_provider_data["file_ids"] and preserves Python execution results in model_provider_data["server_tool_blocks"]. extract_generated_file_ids() handles both result shapes. The Files API and Skills are generally available. Current SDKs retain client.beta.files for compatibility without automatically adding the legacy Files beta header.
Pre-Built Skills
| Skill ID | Capability |
|---|---|
pptx | Create and edit presentations and analyze presentation content |
xlsx | Create and analyze spreadsheets and generate reports with charts |
docx | Create and edit Word documents and format text |
pdf | Generate formatted PDF documents and reports |
Use up to eight Skills in one Messages API request. Each configuration takes type, skill_id, and an optional version. Use type="custom" with the skill_* ID for a Skill uploaded to your Anthropic workspace.
Usage
Set up your virtual environment
uv venv --python 3.12
source .venv/bin/activateInstall dependencies
uv pip install -U "agno[anthropic]"Export your Anthropic API key
export ANTHROPIC_API_KEY="your_anthropic_api_key_here"Run the agent
Save the code above as skills.py, then run:
python skills.pyConstraints
- Skills run in an isolated Anthropic container without network access or runtime package installation.
- Generated files remain in Anthropic's environment until you download them. The Files API permits downloads only for files generated by Skills or code execution.
- Anthropic can return
pause_turnfor a long-running Skill. Agno drops that stop reason. Keep this one-shot example to short generation tasks, and use Anthropic's native SDK when the operation requires pause continuation. - The Files API is generally available. Skills and the Files API are available through the Claude API, Claude Platform on AWS, and Microsoft Foundry deployments hosted by Anthropic. They are unavailable through Amazon Bedrock and Google Cloud Vertex AI.
- Skill-generated
.pptx,.xlsx,.docx, and.pdffiles are outputs. Office binary inputs require a code-execution container upload or conversion to text or PDF instead of a Messages APIdocumentblock.