{
  "schemaVersion": "1.0",
  "item": {
    "slug": "python-sdk",
    "name": "Python Sdk",
    "source": "tencent",
    "type": "skill",
    "category": "开发工具",
    "sourceUrl": "https://clawhub.ai/okaris/python-sdk",
    "canonicalUrl": "https://clawhub.ai/okaris/python-sdk",
    "targetPlatform": "OpenClaw"
  },
  "install": {
    "downloadMode": "redirect",
    "downloadUrl": "/downloads/python-sdk",
    "sourceDownloadUrl": "https://wry-manatee-359.convex.site/api/v1/download?slug=python-sdk",
    "sourcePlatform": "tencent",
    "targetPlatform": "OpenClaw",
    "installMethod": "Manual import",
    "extraction": "Extract archive",
    "prerequisites": [
      "OpenClaw"
    ],
    "packageFormat": "ZIP package",
    "includedAssets": [
      "SKILL.md",
      "references/agent-patterns.md",
      "references/async-patterns.md",
      "references/files.md",
      "references/sessions.md",
      "references/streaming.md"
    ],
    "primaryDoc": "SKILL.md",
    "quickSetup": [
      "Download the package from Yavira.",
      "Extract the archive and review SKILL.md first.",
      "Import or place the package into your OpenClaw setup."
    ],
    "agentAssist": {
      "summary": "Hand the extracted package to your coding agent with a concrete install brief instead of figuring it out manually.",
      "steps": [
        "Download the package from Yavira.",
        "Extract it into a folder your agent can access.",
        "Paste one of the prompts below and point your agent at the extracted folder."
      ],
      "prompts": [
        {
          "label": "New install",
          "body": "I downloaded a skill package from Yavira. Read SKILL.md from the extracted folder and install it by following the included instructions. Tell me what you changed and call out any manual steps you could not complete."
        },
        {
          "label": "Upgrade existing",
          "body": "I downloaded an updated skill package from Yavira. Read SKILL.md from the extracted folder, compare it with my current installation, and upgrade it while preserving any custom configuration unless the package docs explicitly say otherwise. Summarize what changed and any follow-up checks I should run."
        }
      ]
    },
    "sourceHealth": {
      "source": "tencent",
      "slug": "python-sdk",
      "status": "healthy",
      "reason": "direct_download_ok",
      "recommendedAction": "download",
      "checkedAt": "2026-05-07T15:55:58.739Z",
      "expiresAt": "2026-05-14T15:55:58.739Z",
      "httpStatus": 200,
      "finalUrl": "https://wry-manatee-359.convex.site/api/v1/download?slug=python-sdk",
      "contentType": "application/zip",
      "probeMethod": "head",
      "details": {
        "probeUrl": "https://wry-manatee-359.convex.site/api/v1/download?slug=python-sdk",
        "contentDisposition": "attachment; filename=\"python-sdk-0.1.5.zip\"",
        "redirectLocation": null,
        "bodySnippet": null,
        "slug": "python-sdk"
      },
      "scope": "item",
      "summary": "Item download looks usable.",
      "detail": "Yavira can redirect you to the upstream package for this item.",
      "primaryActionLabel": "Download for OpenClaw",
      "primaryActionHref": "/downloads/python-sdk"
    },
    "validation": {
      "installChecklist": [
        "Use the Yavira download entry.",
        "Review SKILL.md after the package is downloaded.",
        "Confirm the extracted package contains the expected setup assets."
      ],
      "postInstallChecks": [
        "Confirm the extracted package includes the expected docs or setup files.",
        "Validate the skill or prompts are available in your target agent workspace.",
        "Capture any manual follow-up steps the agent could not complete."
      ]
    },
    "downloadPageUrl": "https://openagent3.xyz/downloads/python-sdk",
    "agentPageUrl": "https://openagent3.xyz/skills/python-sdk/agent",
    "manifestUrl": "https://openagent3.xyz/skills/python-sdk/agent.json",
    "briefUrl": "https://openagent3.xyz/skills/python-sdk/agent.md"
  },
  "agentAssist": {
    "summary": "Hand the extracted package to your coding agent with a concrete install brief instead of figuring it out manually.",
    "steps": [
      "Download the package from Yavira.",
      "Extract it into a folder your agent can access.",
      "Paste one of the prompts below and point your agent at the extracted folder."
    ],
    "prompts": [
      {
        "label": "New install",
        "body": "I downloaded a skill package from Yavira. Read SKILL.md from the extracted folder and install it by following the included instructions. Tell me what you changed and call out any manual steps you could not complete."
      },
      {
        "label": "Upgrade existing",
        "body": "I downloaded an updated skill package from Yavira. Read SKILL.md from the extracted folder, compare it with my current installation, and upgrade it while preserving any custom configuration unless the package docs explicitly say otherwise. Summarize what changed and any follow-up checks I should run."
      }
    ]
  },
  "documentation": {
    "source": "clawhub",
    "primaryDoc": "SKILL.md",
    "sections": [
      {
        "title": "Python SDK",
        "body": "Build AI applications with the inference.sh Python SDK."
      },
      {
        "title": "Quick Start",
        "body": "pip install inferencesh\n\nfrom inferencesh import inference\n\nclient = inference(api_key=\"inf_your_key\")\n\n# Run an AI app\nresult = client.run({\n    \"app\": \"infsh/flux-schnell\",\n    \"input\": {\"prompt\": \"A sunset over mountains\"}\n})\nprint(result[\"output\"])"
      },
      {
        "title": "Installation",
        "body": "# Standard installation\npip install inferencesh\n\n# With async support\npip install inferencesh[async]\n\nRequirements: Python 3.8+"
      },
      {
        "title": "Authentication",
        "body": "import os\nfrom inferencesh import inference\n\n# Direct API key\nclient = inference(api_key=\"inf_your_key\")\n\n# From environment variable (recommended)\nclient = inference(api_key=os.environ[\"INFERENCE_API_KEY\"])\n\nGet your API key: Settings → API Keys → Create API Key"
      },
      {
        "title": "Basic Execution",
        "body": "result = client.run({\n    \"app\": \"infsh/flux-schnell\",\n    \"input\": {\"prompt\": \"A cat astronaut\"}\n})\n\nprint(result[\"status\"])  # \"completed\"\nprint(result[\"output\"])  # Output data"
      },
      {
        "title": "Fire and Forget",
        "body": "task = client.run({\n    \"app\": \"google/veo-3-1-fast\",\n    \"input\": {\"prompt\": \"Drone flying over mountains\"}\n}, wait=False)\n\nprint(f\"Task ID: {task['id']}\")\n# Check later with client.get_task(task['id'])"
      },
      {
        "title": "Streaming Progress",
        "body": "for update in client.run({\n    \"app\": \"google/veo-3-1-fast\",\n    \"input\": {\"prompt\": \"Ocean waves at sunset\"}\n}, stream=True):\n    print(f\"Status: {update['status']}\")\n    if update.get(\"logs\"):\n        print(update[\"logs\"][-1])"
      },
      {
        "title": "Run Parameters",
        "body": "ParameterTypeDescriptionappstringApp ID (namespace/name@version)inputdictInput matching app schemasetupdictHidden setup configurationinfrastring'cloud' or 'private'sessionstringSession ID for stateful executionsession_timeoutintIdle timeout (1-3600 seconds)"
      },
      {
        "title": "Automatic Upload",
        "body": "result = client.run({\n    \"app\": \"image-processor\",\n    \"input\": {\n        \"image\": \"/path/to/image.png\"  # Auto-uploaded\n    }\n})"
      },
      {
        "title": "Manual Upload",
        "body": "from inferencesh import UploadFileOptions\n\n# Basic upload\nfile = client.upload_file(\"/path/to/image.png\")\n\n# With options\nfile = client.upload_file(\n    \"/path/to/image.png\",\n    UploadFileOptions(\n        filename=\"custom_name.png\",\n        content_type=\"image/png\",\n        public=True\n    )\n)\n\nresult = client.run({\n    \"app\": \"image-processor\",\n    \"input\": {\"image\": file[\"uri\"]}\n})"
      },
      {
        "title": "Sessions (Stateful Execution)",
        "body": "Keep workers warm across multiple calls:\n\n# Start new session\nresult = client.run({\n    \"app\": \"my-app\",\n    \"input\": {\"action\": \"init\"},\n    \"session\": \"new\",\n    \"session_timeout\": 300  # 5 minutes\n})\nsession_id = result[\"session_id\"]\n\n# Continue in same session\nresult = client.run({\n    \"app\": \"my-app\",\n    \"input\": {\"action\": \"process\"},\n    \"session\": session_id\n})"
      },
      {
        "title": "Template Agents",
        "body": "Use pre-built agents from your workspace:\n\nagent = client.agent(\"my-team/support-agent@latest\")\n\n# Send message\nresponse = agent.send_message(\"Hello!\")\nprint(response.text)\n\n# Multi-turn conversation\nresponse = agent.send_message(\"Tell me more\")\n\n# Reset conversation\nagent.reset()\n\n# Get chat history\nchat = agent.get_chat()"
      },
      {
        "title": "Ad-hoc Agents",
        "body": "Create custom agents programmatically:\n\nfrom inferencesh import tool, string, number, app_tool\n\n# Define tools\ncalculator = (\n    tool(\"calculate\")\n    .describe(\"Perform a calculation\")\n    .param(\"expression\", string(\"Math expression\"))\n    .build()\n)\n\nimage_gen = (\n    app_tool(\"generate_image\", \"infsh/flux-schnell@latest\")\n    .describe(\"Generate an image\")\n    .param(\"prompt\", string(\"Image description\"))\n    .build()\n)\n\n# Create agent\nagent = client.agent({\n    \"core_app\": {\"ref\": \"infsh/claude-sonnet-4@latest\"},\n    \"system_prompt\": \"You are a helpful assistant.\",\n    \"tools\": [calculator, image_gen],\n    \"temperature\": 0.7,\n    \"max_tokens\": 4096\n})\n\nresponse = agent.send_message(\"What is 25 * 4?\")"
      },
      {
        "title": "Available Core Apps",
        "body": "ModelApp ReferenceClaude Sonnet 4infsh/claude-sonnet-4@latestClaude 3.5 Haikuinfsh/claude-haiku-35@latestGPT-4oinfsh/gpt-4o@latestGPT-4o Miniinfsh/gpt-4o-mini@latest"
      },
      {
        "title": "Parameter Types",
        "body": "from inferencesh import (\n    string, number, integer, boolean,\n    enum_of, array, obj, optional\n)\n\nname = string(\"User's name\")\nage = integer(\"Age in years\")\nscore = number(\"Score 0-1\")\nactive = boolean(\"Is active\")\npriority = enum_of([\"low\", \"medium\", \"high\"], \"Priority\")\ntags = array(string(\"Tag\"), \"List of tags\")\naddress = obj({\n    \"street\": string(\"Street\"),\n    \"city\": string(\"City\"),\n    \"zip\": optional(string(\"ZIP\"))\n}, \"Address\")"
      },
      {
        "title": "Client Tools (Run in Your Code)",
        "body": "greet = (\n    tool(\"greet\")\n    .display(\"Greet User\")\n    .describe(\"Greets a user by name\")\n    .param(\"name\", string(\"Name to greet\"))\n    .require_approval()\n    .build()\n)"
      },
      {
        "title": "App Tools (Call AI Apps)",
        "body": "generate = (\n    app_tool(\"generate_image\", \"infsh/flux-schnell@latest\")\n    .describe(\"Generate an image from text\")\n    .param(\"prompt\", string(\"Image description\"))\n    .setup({\"model\": \"schnell\"})\n    .input({\"steps\": 20})\n    .require_approval()\n    .build()\n)"
      },
      {
        "title": "Agent Tools (Delegate to Sub-agents)",
        "body": "from inferencesh import agent_tool\n\nresearcher = (\n    agent_tool(\"research\", \"my-org/researcher@v1\")\n    .describe(\"Research a topic\")\n    .param(\"topic\", string(\"Topic to research\"))\n    .build()\n)"
      },
      {
        "title": "Webhook Tools (Call External APIs)",
        "body": "from inferencesh import webhook_tool\n\nnotify = (\n    webhook_tool(\"slack\", \"https://hooks.slack.com/...\")\n    .describe(\"Send Slack notification\")\n    .secret(\"SLACK_SECRET\")\n    .param(\"channel\", string(\"Channel\"))\n    .param(\"message\", string(\"Message\"))\n    .build()\n)"
      },
      {
        "title": "Internal Tools (Built-in Capabilities)",
        "body": "from inferencesh import internal_tools\n\nconfig = (\n    internal_tools()\n    .plan()\n    .memory()\n    .web_search(True)\n    .code_execution(True)\n    .image_generation({\n        \"enabled\": True,\n        \"app_ref\": \"infsh/flux@latest\"\n    })\n    .build()\n)\n\nagent = client.agent({\n    \"core_app\": {\"ref\": \"infsh/claude-sonnet-4@latest\"},\n    \"internal_tools\": config\n})"
      },
      {
        "title": "Streaming Agent Responses",
        "body": "def handle_message(msg):\n    if msg.get(\"content\"):\n        print(msg[\"content\"], end=\"\", flush=True)\n\ndef handle_tool(call):\n    print(f\"\\n[Tool: {call.name}]\")\n    result = execute_tool(call.name, call.args)\n    agent.submit_tool_result(call.id, result)\n\nresponse = agent.send_message(\n    \"Explain quantum computing\",\n    on_message=handle_message,\n    on_tool_call=handle_tool\n)"
      },
      {
        "title": "File Attachments",
        "body": "# From file path\nwith open(\"image.png\", \"rb\") as f:\n    response = agent.send_message(\n        \"What's in this image?\",\n        files=[f.read()]\n    )\n\n# From base64\nresponse = agent.send_message(\n    \"Analyze this\",\n    files=[\"data:image/png;base64,iVBORw0KGgo...\"]\n)"
      },
      {
        "title": "Skills (Reusable Context)",
        "body": "agent = client.agent({\n    \"core_app\": {\"ref\": \"infsh/claude-sonnet-4@latest\"},\n    \"skills\": [\n        {\n            \"name\": \"code-review\",\n            \"description\": \"Code review guidelines\",\n            \"content\": \"# Code Review\\n\\n1. Check security\\n2. Check performance...\"\n        },\n        {\n            \"name\": \"api-docs\",\n            \"description\": \"API documentation\",\n            \"url\": \"https://example.com/skills/api-docs.md\"\n        }\n    ]\n})"
      },
      {
        "title": "Async Support",
        "body": "from inferencesh import async_inference\nimport asyncio\n\nasync def main():\n    client = async_inference(api_key=\"inf_...\")\n\n    # Async app execution\n    result = await client.run({\n        \"app\": \"infsh/flux-schnell\",\n        \"input\": {\"prompt\": \"A galaxy\"}\n    })\n\n    # Async agent\n    agent = client.agent(\"my-org/assistant@latest\")\n    response = await agent.send_message(\"Hello!\")\n\n    # Async streaming\n    async for msg in agent.stream_messages():\n        print(msg)\n\nasyncio.run(main())"
      },
      {
        "title": "Error Handling",
        "body": "from inferencesh import RequirementsNotMetException\n\ntry:\n    result = client.run({\"app\": \"my-app\", \"input\": {...}})\nexcept RequirementsNotMetException as e:\n    print(f\"Missing requirements:\")\n    for err in e.errors:\n        print(f\"  - {err['type']}: {err['key']}\")\nexcept RuntimeError as e:\n    print(f\"Error: {e}\")"
      },
      {
        "title": "Human Approval Workflows",
        "body": "def handle_tool(call):\n    if call.requires_approval:\n        # Show to user, get confirmation\n        approved = prompt_user(f\"Allow {call.name}?\")\n        if approved:\n            result = execute_tool(call.name, call.args)\n            agent.submit_tool_result(call.id, result)\n        else:\n            agent.submit_tool_result(call.id, {\"error\": \"Denied by user\"})\n\nresponse = agent.send_message(\n    \"Delete all temp files\",\n    on_tool_call=handle_tool\n)"
      },
      {
        "title": "Reference Files",
        "body": "Agent Patterns - Multi-agent, RAG, human-in-the-loop patterns\nTool Builder - Complete tool builder API reference\nStreaming - Real-time progress updates and SSE handling\nFile Handling - Upload, download, and manage files\nSessions - Stateful execution with warm workers\nAsync Patterns - Parallel processing and async/await"
      },
      {
        "title": "Related Skills",
        "body": "# JavaScript SDK\nnpx skills add inference-sh/skills@javascript-sdk\n\n# Full platform skill (all 150+ apps via CLI)\nnpx skills add inference-sh/skills@inference-sh\n\n# LLM models\nnpx skills add inference-sh/skills@llm-models\n\n# Image generation\nnpx skills add inference-sh/skills@ai-image-generation"
      },
      {
        "title": "Documentation",
        "body": "Python SDK Reference - Full API documentation\nAgent SDK Overview - Building agents\nTool Builder Reference - Creating tools\nAuthentication - API key setup\nStreaming - Real-time updates\nFile Uploads - File handling"
      }
    ],
    "body": "Python SDK\n\nBuild AI applications with the inference.sh Python SDK.\n\nQuick Start\npip install inferencesh\n\nfrom inferencesh import inference\n\nclient = inference(api_key=\"inf_your_key\")\n\n# Run an AI app\nresult = client.run({\n    \"app\": \"infsh/flux-schnell\",\n    \"input\": {\"prompt\": \"A sunset over mountains\"}\n})\nprint(result[\"output\"])\n\nInstallation\n# Standard installation\npip install inferencesh\n\n# With async support\npip install inferencesh[async]\n\n\nRequirements: Python 3.8+\n\nAuthentication\nimport os\nfrom inferencesh import inference\n\n# Direct API key\nclient = inference(api_key=\"inf_your_key\")\n\n# From environment variable (recommended)\nclient = inference(api_key=os.environ[\"INFERENCE_API_KEY\"])\n\n\nGet your API key: Settings → API Keys → Create API Key\n\nRunning Apps\nBasic Execution\nresult = client.run({\n    \"app\": \"infsh/flux-schnell\",\n    \"input\": {\"prompt\": \"A cat astronaut\"}\n})\n\nprint(result[\"status\"])  # \"completed\"\nprint(result[\"output\"])  # Output data\n\nFire and Forget\ntask = client.run({\n    \"app\": \"google/veo-3-1-fast\",\n    \"input\": {\"prompt\": \"Drone flying over mountains\"}\n}, wait=False)\n\nprint(f\"Task ID: {task['id']}\")\n# Check later with client.get_task(task['id'])\n\nStreaming Progress\nfor update in client.run({\n    \"app\": \"google/veo-3-1-fast\",\n    \"input\": {\"prompt\": \"Ocean waves at sunset\"}\n}, stream=True):\n    print(f\"Status: {update['status']}\")\n    if update.get(\"logs\"):\n        print(update[\"logs\"][-1])\n\nRun Parameters\nParameter\tType\tDescription\napp\tstring\tApp ID (namespace/name@version)\ninput\tdict\tInput matching app schema\nsetup\tdict\tHidden setup configuration\ninfra\tstring\t'cloud' or 'private'\nsession\tstring\tSession ID for stateful execution\nsession_timeout\tint\tIdle timeout (1-3600 seconds)\nFile Handling\nAutomatic Upload\nresult = client.run({\n    \"app\": \"image-processor\",\n    \"input\": {\n        \"image\": \"/path/to/image.png\"  # Auto-uploaded\n    }\n})\n\nManual Upload\nfrom inferencesh import UploadFileOptions\n\n# Basic upload\nfile = client.upload_file(\"/path/to/image.png\")\n\n# With options\nfile = client.upload_file(\n    \"/path/to/image.png\",\n    UploadFileOptions(\n        filename=\"custom_name.png\",\n        content_type=\"image/png\",\n        public=True\n    )\n)\n\nresult = client.run({\n    \"app\": \"image-processor\",\n    \"input\": {\"image\": file[\"uri\"]}\n})\n\nSessions (Stateful Execution)\n\nKeep workers warm across multiple calls:\n\n# Start new session\nresult = client.run({\n    \"app\": \"my-app\",\n    \"input\": {\"action\": \"init\"},\n    \"session\": \"new\",\n    \"session_timeout\": 300  # 5 minutes\n})\nsession_id = result[\"session_id\"]\n\n# Continue in same session\nresult = client.run({\n    \"app\": \"my-app\",\n    \"input\": {\"action\": \"process\"},\n    \"session\": session_id\n})\n\nAgent SDK\nTemplate Agents\n\nUse pre-built agents from your workspace:\n\nagent = client.agent(\"my-team/support-agent@latest\")\n\n# Send message\nresponse = agent.send_message(\"Hello!\")\nprint(response.text)\n\n# Multi-turn conversation\nresponse = agent.send_message(\"Tell me more\")\n\n# Reset conversation\nagent.reset()\n\n# Get chat history\nchat = agent.get_chat()\n\nAd-hoc Agents\n\nCreate custom agents programmatically:\n\nfrom inferencesh import tool, string, number, app_tool\n\n# Define tools\ncalculator = (\n    tool(\"calculate\")\n    .describe(\"Perform a calculation\")\n    .param(\"expression\", string(\"Math expression\"))\n    .build()\n)\n\nimage_gen = (\n    app_tool(\"generate_image\", \"infsh/flux-schnell@latest\")\n    .describe(\"Generate an image\")\n    .param(\"prompt\", string(\"Image description\"))\n    .build()\n)\n\n# Create agent\nagent = client.agent({\n    \"core_app\": {\"ref\": \"infsh/claude-sonnet-4@latest\"},\n    \"system_prompt\": \"You are a helpful assistant.\",\n    \"tools\": [calculator, image_gen],\n    \"temperature\": 0.7,\n    \"max_tokens\": 4096\n})\n\nresponse = agent.send_message(\"What is 25 * 4?\")\n\nAvailable Core Apps\nModel\tApp Reference\nClaude Sonnet 4\tinfsh/claude-sonnet-4@latest\nClaude 3.5 Haiku\tinfsh/claude-haiku-35@latest\nGPT-4o\tinfsh/gpt-4o@latest\nGPT-4o Mini\tinfsh/gpt-4o-mini@latest\nTool Builder API\nParameter Types\nfrom inferencesh import (\n    string, number, integer, boolean,\n    enum_of, array, obj, optional\n)\n\nname = string(\"User's name\")\nage = integer(\"Age in years\")\nscore = number(\"Score 0-1\")\nactive = boolean(\"Is active\")\npriority = enum_of([\"low\", \"medium\", \"high\"], \"Priority\")\ntags = array(string(\"Tag\"), \"List of tags\")\naddress = obj({\n    \"street\": string(\"Street\"),\n    \"city\": string(\"City\"),\n    \"zip\": optional(string(\"ZIP\"))\n}, \"Address\")\n\nClient Tools (Run in Your Code)\ngreet = (\n    tool(\"greet\")\n    .display(\"Greet User\")\n    .describe(\"Greets a user by name\")\n    .param(\"name\", string(\"Name to greet\"))\n    .require_approval()\n    .build()\n)\n\nApp Tools (Call AI Apps)\ngenerate = (\n    app_tool(\"generate_image\", \"infsh/flux-schnell@latest\")\n    .describe(\"Generate an image from text\")\n    .param(\"prompt\", string(\"Image description\"))\n    .setup({\"model\": \"schnell\"})\n    .input({\"steps\": 20})\n    .require_approval()\n    .build()\n)\n\nAgent Tools (Delegate to Sub-agents)\nfrom inferencesh import agent_tool\n\nresearcher = (\n    agent_tool(\"research\", \"my-org/researcher@v1\")\n    .describe(\"Research a topic\")\n    .param(\"topic\", string(\"Topic to research\"))\n    .build()\n)\n\nWebhook Tools (Call External APIs)\nfrom inferencesh import webhook_tool\n\nnotify = (\n    webhook_tool(\"slack\", \"https://hooks.slack.com/...\")\n    .describe(\"Send Slack notification\")\n    .secret(\"SLACK_SECRET\")\n    .param(\"channel\", string(\"Channel\"))\n    .param(\"message\", string(\"Message\"))\n    .build()\n)\n\nInternal Tools (Built-in Capabilities)\nfrom inferencesh import internal_tools\n\nconfig = (\n    internal_tools()\n    .plan()\n    .memory()\n    .web_search(True)\n    .code_execution(True)\n    .image_generation({\n        \"enabled\": True,\n        \"app_ref\": \"infsh/flux@latest\"\n    })\n    .build()\n)\n\nagent = client.agent({\n    \"core_app\": {\"ref\": \"infsh/claude-sonnet-4@latest\"},\n    \"internal_tools\": config\n})\n\nStreaming Agent Responses\ndef handle_message(msg):\n    if msg.get(\"content\"):\n        print(msg[\"content\"], end=\"\", flush=True)\n\ndef handle_tool(call):\n    print(f\"\\n[Tool: {call.name}]\")\n    result = execute_tool(call.name, call.args)\n    agent.submit_tool_result(call.id, result)\n\nresponse = agent.send_message(\n    \"Explain quantum computing\",\n    on_message=handle_message,\n    on_tool_call=handle_tool\n)\n\nFile Attachments\n# From file path\nwith open(\"image.png\", \"rb\") as f:\n    response = agent.send_message(\n        \"What's in this image?\",\n        files=[f.read()]\n    )\n\n# From base64\nresponse = agent.send_message(\n    \"Analyze this\",\n    files=[\"data:image/png;base64,iVBORw0KGgo...\"]\n)\n\nSkills (Reusable Context)\nagent = client.agent({\n    \"core_app\": {\"ref\": \"infsh/claude-sonnet-4@latest\"},\n    \"skills\": [\n        {\n            \"name\": \"code-review\",\n            \"description\": \"Code review guidelines\",\n            \"content\": \"# Code Review\\n\\n1. Check security\\n2. Check performance...\"\n        },\n        {\n            \"name\": \"api-docs\",\n            \"description\": \"API documentation\",\n            \"url\": \"https://example.com/skills/api-docs.md\"\n        }\n    ]\n})\n\nAsync Support\nfrom inferencesh import async_inference\nimport asyncio\n\nasync def main():\n    client = async_inference(api_key=\"inf_...\")\n\n    # Async app execution\n    result = await client.run({\n        \"app\": \"infsh/flux-schnell\",\n        \"input\": {\"prompt\": \"A galaxy\"}\n    })\n\n    # Async agent\n    agent = client.agent(\"my-org/assistant@latest\")\n    response = await agent.send_message(\"Hello!\")\n\n    # Async streaming\n    async for msg in agent.stream_messages():\n        print(msg)\n\nasyncio.run(main())\n\nError Handling\nfrom inferencesh import RequirementsNotMetException\n\ntry:\n    result = client.run({\"app\": \"my-app\", \"input\": {...}})\nexcept RequirementsNotMetException as e:\n    print(f\"Missing requirements:\")\n    for err in e.errors:\n        print(f\"  - {err['type']}: {err['key']}\")\nexcept RuntimeError as e:\n    print(f\"Error: {e}\")\n\nHuman Approval Workflows\ndef handle_tool(call):\n    if call.requires_approval:\n        # Show to user, get confirmation\n        approved = prompt_user(f\"Allow {call.name}?\")\n        if approved:\n            result = execute_tool(call.name, call.args)\n            agent.submit_tool_result(call.id, result)\n        else:\n            agent.submit_tool_result(call.id, {\"error\": \"Denied by user\"})\n\nresponse = agent.send_message(\n    \"Delete all temp files\",\n    on_tool_call=handle_tool\n)\n\nReference Files\nAgent Patterns - Multi-agent, RAG, human-in-the-loop patterns\nTool Builder - Complete tool builder API reference\nStreaming - Real-time progress updates and SSE handling\nFile Handling - Upload, download, and manage files\nSessions - Stateful execution with warm workers\nAsync Patterns - Parallel processing and async/await\nRelated Skills\n# JavaScript SDK\nnpx skills add inference-sh/skills@javascript-sdk\n\n# Full platform skill (all 150+ apps via CLI)\nnpx skills add inference-sh/skills@inference-sh\n\n# LLM models\nnpx skills add inference-sh/skills@llm-models\n\n# Image generation\nnpx skills add inference-sh/skills@ai-image-generation\n\nDocumentation\nPython SDK Reference - Full API documentation\nAgent SDK Overview - Building agents\nTool Builder Reference - Creating tools\nAuthentication - API key setup\nStreaming - Real-time updates\nFile Uploads - File handling"
  },
  "trust": {
    "sourceLabel": "tencent",
    "provenanceUrl": "https://clawhub.ai/okaris/python-sdk",
    "publisherUrl": "https://clawhub.ai/okaris/python-sdk",
    "owner": "okaris",
    "version": "0.1.5",
    "license": null,
    "verificationStatus": "Indexed source record"
  },
  "links": {
    "detailUrl": "https://openagent3.xyz/skills/python-sdk",
    "downloadUrl": "https://openagent3.xyz/downloads/python-sdk",
    "agentUrl": "https://openagent3.xyz/skills/python-sdk/agent",
    "manifestUrl": "https://openagent3.xyz/skills/python-sdk/agent.json",
    "briefUrl": "https://openagent3.xyz/skills/python-sdk/agent.md"
  }
}