pdf-gen-fallback
하는 일
이 스킬은 셸에서 Python으로 PDF와 보고서를 만드는 믿을 만한 방법입니다. 알아보기 어려운 샌드박스 오류 때문에 문서 생성이 계속 실패하는 사람에게 맞습니다.
사용하는 경우
- ✓PDF나 보고서를 만드는 중 샌드박스가 알아보기 어려운 메시지로 실패할 때.
- ✓이 컴퓨터에 PDF, 보고서 또는 문서를 만들어야 할 때.
- ✓reportlab 같은 라이브러리를 쓸 수 없을 수도 있는 경우.
스킬 링크
https://github.com/HKUDS/AgentPilot/blob/main/openspace/benchmarks/gdpval/skills/pdf-gen-fallback/SKILL.md복사해서 AI(Claude, ChatGPT, Cursor)에 붙여넣고 지침을 따르도록 요청하세요.
사용 방법
가장 쉬운 방법입니다. 메시지를 복사해 AI에 붙여넣으세요. AI가 스킬을 읽고 지침을 따릅니다.
바로 붙여넣을 수 있는 메시지
Claude Code, Codex, Cursor용입니다. 프로젝트 폴더에서 실행하면 스킬이 설치됩니다.
SKILL.md를 다운로드해 에이전트의 스킬 폴더에 넣으세요.
AI에게 요청하는 예시
“제 내용으로 PDF 보고서를 만들어 주세요. 샌드박스가 알아보기 어려운 오류로 계속 실패하니 라이브러리를 확인하고 다른 방법으로 만들어 주세요.”
매주 새 스킬 5개. 읽는 데 1분.
작동 방식
AI는 먼저 샌드박스를 시도하고, 불분명하거나 import 오류가 나타나는지 살핀 뒤, 그런 오류가 있으면 라이브러리를 확인하고 셸에서 PDF를 만듭니다.
기술 내용 (원본 SKILL.md)
작성자의 영어 원문을 GitHub에서 그대로 가져왔습니다.
PDF Generation Fallback
This skill provides a reliable workflow for generating PDFs and documents when execute_code_sandbox returns opaque errors. Use direct run_shell with python -c as a fallback, with library availability checks and explicit error handling.
When to Use
execute_code_sandboxfails with cryptic error messages during document/PDF generation- You need to generate PDFs, reports, or structured documents
- Standard library execution is unreliable for document creation tasks
Step-by-Step Procedure
Step 1: Check Library Availability
Before attempting generation, verify that required libraries are installed:
run_shell command="python -c \"import reportlab; print('reportlab available')\""
run_shell command="python -c \"import fpdf; print('fpdf available')\""
run_shell command="python -c \"import pypdf; print('pypdf available')\""
Step 2: Attempt execute_code_sandbox First
Try the sandbox approach initially (it's cleaner for iteration):
execute_code_sandbox code="""
from reportlab.lib.pagesizes import letter
from reportlab.pdfgen import canvas
c = canvas.Canvas("output.pdf", pagesize=letter)
c.drawString(100, 750, "Document Content")
c.save()
print("ARTIFACT_PATH:/path/to/output.pdf")
"""
Step 3: Detect Opaque Errors
Watch for these failure indicators:
- Generic "execution failed" messages
- Import errors that don't match library availability checks
- Timeout errors during document rendering
- Missing artifact paths in output
Step 4: Fall Back to run_shell
If sandbox fails, use direct shell execution:
run_shell command="python -c \"
from reportlab.lib.pagesizes import letter
from reportlab.pdfgen import canvas
c = canvas.Canvas('output.pdf', pagesize=letter)
c.drawString(100, 750, 'Document Content')
c.save()
print('PDF created successfully')
\""
Step 5: Verify Output
After generation, confirm the file exists:
run_shell command="ls -la output.pdf && file output.pdf"
Complete Example Workflow
1. Check libraries: run_shell "python -c \"import reportlab\""
2. Try sandbox: execute_code_sandbox with PDF generation code
3. If error detected: Fall back to run_shell with python -c
4. Verify: run_shell "ls -la *.pdf"
5. Read result: read_file filetype="pdf" file_path="output.pdf"
Error Handling Tips
- Capture stderr from run_shell to diagnose issues
- Use absolute paths when possible to avoid working directory issues
- For complex documents, write the Python script to a file first, then execute
- Consider installing missing libraries:
run_shell command="pip install reportlab"
Library Alternatives
If reportlab is unavailable, try:
fpdf- Simpler API, good for basic PDFsweasyprint- HTML/CSS to PDF conversionpypdf- PDF manipulation and merging
Common Pitfalls
- Don't assume sandbox errors mean the approach is wrong—often it's环境 issues
- Always verify the PDF was created before proceeding
- Handle encoding issues explicitly (use utf-8)
- For images in PDFs, ensure image files are accessible to the execution context
자주 묻는 질문
AI는 샌드박스를 먼저 시도하나요?
네, 가이드는 반복 작업에 더 깔끔하므로 샌드박스를 먼저 시도하라고 말합니다.
실패의 신호는 무엇인가요?
일반적인 실행 실패 메시지, import 오류 및 그와 비슷한 불분명한 문제입니다.
어떤 라이브러리를 확인하나요?
가이드는 reportlab, fpdf, pypdf를 확인합니다.
상세 정보
작성자의 원본 설명
Reliable PDF generation using shell-based Python execution when sandbox fails
repo: HKUDS/AgentPilot
인기도
- GitHub 스타
- 7.8k
- 순위
- #12928
- 라이선스
- MIT
- 업데이트
- 2026. 11. 1.
댓글
- …
이 저장소의 다른 스킬
agentpilot
7.8k작업을 준비하고 AgentPilot 루프를 실행해 변경을 제안, 테스트, 점수화하면서 프로젝트를 단계적으로 개선하도록 돕습니다.
openspace
7.8k에이전트 스킬을 저장하고 가져오는 도구인 OpenSpace를 설정하고, MCP를 통해 AI 앱에 연결하도록 돕습니다.
rsi-arena
7.8kAIME나 Terminal-Bench 같은 표준 AI 벤치마크 테스트를 설정하고 실행해 서로 다른 개선 방법을 비교하도록 돕습니다.
experiment-guide
7.8k프로그램을 개선하는 방법을 조사하면서 작은 실험을 계획하고, 결과를 읽고, 발견 사항을 기록하도록 돕습니다.
비슷한 스킬
feishu-doc
394k에이전트가 문서 도구를 사용해 텍스트, 이미지, 표를 포함한 Feishu 클라우드 문서를 읽고, 만들고, 편집하도록 돕습니다.
feishu-drive
394k에이전트가 봇과 공유된 Feishu 클라우드 폴더의 파일을 찾아보고, 정리하고, 댓글을 달도록 돕습니다.
feishu-perm
394k에이전트가 요청을 충족하는 가장 작은 권한을 골라, Feishu 파일에 누가 접근할 수 있는지 확인하고 바꾸도록 돕습니다.