[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M6N2083Q86V0C7VR2E3QBH5R":3,"skill-same:01M6N2083Q86V0C7VR2E3QBH5R":97},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":15,"categories":16,"keywords":17,"publishedAt":38,"linkOnly":39,"markdownContent":40,"markdownBody":41,"frontMatter":42,"refName":45,"commitSha":46,"skillDirectory":47,"forksCount":48,"repositoryHtmlUrl":49,"repositoryHomepageUrl":6,"ownerHtmlUrl":50,"ownerBlogUrl":6,"ownerDescription":51,"updatedAt":52,"install":53,"resources":66},"01M6N2083Q86V0C7VR2E3QBH5R","python-sdk",null,"Python SDK for inference.sh - run AI apps, build agents, and integrate with 150+ models.\nPackage: inferencesh (pip install inferencesh). Supports sync\u002Fasync, streaming, file uploads.\nBuild agents with template or ad-hoc patterns, tool builder API, skills, and human approval.\nUse for: Python integration, AI apps, agent development, RAG pipelines, automation.\nTriggers: python sdk, inferencesh, pip install, python api, python client, async inference,\npython agent, tool builder python, programmatic ai, python integration, sdk python","Kernel8901\u002Fai-agent-skills-classification","Kernel8901","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F72647553?v=4","01M6KV388J2H5PNC8D8P940BJD","01M6KV38CS5B3AY63RKZB410YM",7,"MIT","https:\u002F\u002Fgithub.com\u002FKernel8901\u002Fai-agent-skills-classification\u002Fblob\u002Fmain\u002F人工智能与大型语言模型\u002Fpython-sdk\u002FSKILL.md",[],[18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37],"sdk","python","python sdk","programmatic","apps","human","patterns","builder","integrate","install","template","Bash","api","file uploads","agent development","streaming","run","development","rag","sync","2026-11-10 10:12:30",false,"---\nname: python-sdk\ndescription: |\n  Python SDK for inference.sh - run AI apps, build agents, and integrate with 150+ models.\n  Package: inferencesh (pip install inferencesh). Supports sync\u002Fasync, streaming, file uploads.\n  Build agents with template or ad-hoc patterns, tool builder API, skills, and human approval.\n  Use for: Python integration, AI apps, agent development, RAG pipelines, automation.\n  Triggers: python sdk, inferencesh, pip install, python api, python client, async inference,\n  python agent, tool builder python, programmatic ai, python integration, sdk python\nallowed-tools: Bash(pip install inferencesh), Bash(python *)\n---\n\n# Python SDK\n\nBuild AI applications with the [inference.sh](https:\u002F\u002Finference.sh) Python SDK.\n\n## Quick Start\n\n```bash\npip install inferencesh\n```\n\n```python\nfrom inferencesh import inference\n\nclient = inference(api_key=\"inf_your_key\")\n\n# Run an AI app\nresult = client.run({\n    \"app\": \"infsh\u002Fflux-schnell\",\n    \"input\": {\"prompt\": \"A sunset over mountains\"}\n})\nprint(result[\"output\"])\n```\n\n## Installation\n\n```bash\n# Standard installation\npip install inferencesh\n\n# With async support\npip install inferencesh[async]\n```\n\n**Requirements:** Python 3.8+\n\n## Authentication\n\n```python\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\n## Running Apps\n\n### Basic Execution\n\n```python\nresult = client.run({\n    \"app\": \"infsh\u002Fflux-schnell\",\n    \"input\": {\"prompt\": \"A cat astronaut\"}\n})\n\nprint(result[\"status\"])  # \"completed\"\nprint(result[\"output\"])  # Output data\n```\n\n### Fire and Forget\n\n```python\ntask = client.run({\n    \"app\": \"google\u002Fveo-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```\n\n### Streaming Progress\n\n```python\nfor update in client.run({\n    \"app\": \"google\u002Fveo-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```\n\n### Run Parameters\n\n| Parameter | Type | Description |\n|-----------|------|-------------|\n| `app` | string | App ID (namespace\u002Fname@version) |\n| `input` | dict | Input matching app schema |\n| `setup` | dict | Hidden setup configuration |\n| `infra` | string | 'cloud' or 'private' |\n| `session` | string | Session ID for stateful execution |\n| `session_timeout` | int | Idle timeout (1-3600 seconds) |\n\n## File Handling\n\n### Automatic Upload\n\n```python\nresult = client.run({\n    \"app\": \"image-processor\",\n    \"input\": {\n        \"image\": \"\u002Fpath\u002Fto\u002Fimage.png\"  # Auto-uploaded\n    }\n})\n```\n\n### Manual Upload\n\n```python\nfrom inferencesh import UploadFileOptions\n\n# Basic upload\nfile = client.upload_file(\"\u002Fpath\u002Fto\u002Fimage.png\")\n\n# With options\nfile = client.upload_file(\n    \"\u002Fpath\u002Fto\u002Fimage.png\",\n    UploadFileOptions(\n        filename=\"custom_name.png\",\n        content_type=\"image\u002Fpng\",\n        public=True\n    )\n)\n\nresult = client.run({\n    \"app\": \"image-processor\",\n    \"input\": {\"image\": file[\"uri\"]}\n})\n```\n\n## Sessions (Stateful Execution)\n\nKeep workers warm across multiple calls:\n\n```python\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```\n\n## Agent SDK\n\n### Template Agents\n\nUse pre-built agents from your workspace:\n\n```python\nagent = client.agent(\"my-team\u002Fsupport-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```\n\n### Ad-hoc Agents\n\nCreate custom agents programmatically:\n\n```python\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\u002Fflux-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\u002Fclaude-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```\n\n### Available Core Apps\n\n| Model | App Reference |\n|-------|---------------|\n| Claude Sonnet 4 | `infsh\u002Fclaude-sonnet-4@latest` |\n| Claude 3.5 Haiku | `infsh\u002Fclaude-haiku-35@latest` |\n| GPT-4o | `infsh\u002Fgpt-4o@latest` |\n| GPT-4o Mini | `infsh\u002Fgpt-4o-mini@latest` |\n\n## Tool Builder API\n\n### Parameter Types\n\n```python\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```\n\n### Client Tools (Run in Your Code)\n\n```python\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```\n\n### App Tools (Call AI Apps)\n\n```python\ngenerate = (\n    app_tool(\"generate_image\", \"infsh\u002Fflux-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```\n\n### Agent Tools (Delegate to Sub-agents)\n\n```python\nfrom inferencesh import agent_tool\n\nresearcher = (\n    agent_tool(\"research\", \"my-org\u002Fresearcher@v1\")\n    .describe(\"Research a topic\")\n    .param(\"topic\", string(\"Topic to research\"))\n    .build()\n)\n```\n\n### Webhook Tools (Call External APIs)\n\n```python\nfrom inferencesh import webhook_tool\n\nnotify = (\n    webhook_tool(\"slack\", \"https:\u002F\u002Fhooks.slack.com\u002F...\")\n    .describe(\"Send Slack notification\")\n    .secret(\"SLACK_SECRET\")\n    .param(\"channel\", string(\"Channel\"))\n    .param(\"message\", string(\"Message\"))\n    .build()\n)\n```\n\n### Internal Tools (Built-in Capabilities)\n\n```python\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\u002Fflux@latest\"\n    })\n    .build()\n)\n\nagent = client.agent({\n    \"core_app\": {\"ref\": \"infsh\u002Fclaude-sonnet-4@latest\"},\n    \"internal_tools\": config\n})\n```\n\n## Streaming Agent Responses\n\n```python\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```\n\n## File Attachments\n\n```python\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\u002Fpng;base64,iVBORw0KGgo...\"]\n)\n```\n\n## Skills (Reusable Context)\n\n```python\nagent = client.agent({\n    \"core_app\": {\"ref\": \"infsh\u002Fclaude-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:\u002F\u002Fexample.com\u002Fskills\u002Fapi-docs.md\"\n        }\n    ]\n})\n```\n\n## Async Support\n\n```python\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\u002Fflux-schnell\",\n        \"input\": {\"prompt\": \"A galaxy\"}\n    })\n\n    # Async agent\n    agent = client.agent(\"my-org\u002Fassistant@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```\n\n## Error Handling\n\n```python\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```\n\n## Human Approval Workflows\n\n```python\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```\n\n## Reference Files\n\n- [Agent Patterns](references\u002Fagent-patterns.md) - Multi-agent, RAG, human-in-the-loop patterns\n- [Tool Builder](references\u002Ftool-builder.md) - Complete tool builder API reference\n- [Streaming](references\u002Fstreaming.md) - Real-time progress updates and SSE handling\n- [File Handling](references\u002Ffiles.md) - Upload, download, and manage files\n- [Sessions](references\u002Fsessions.md) - Stateful execution with warm workers\n- [Async Patterns](references\u002Fasync-patterns.md) - Parallel processing and async\u002Fawait\n\n## Related Skills\n\n```bash\n# JavaScript SDK\nnpx skills add inference-sh\u002Fagent-skills@javascript-sdk\n\n# Full platform skill (all 150+ apps via CLI)\nnpx skills add inference-sh\u002Fagent-skills@inference-sh\n\n# LLM models\nnpx skills add inference-sh\u002Fagent-skills@llm-models\n\n# Image generation\nnpx skills add inference-sh\u002Fagent-skills@ai-image-generation\n```\n\n## Documentation\n\n- [Python SDK Reference](https:\u002F\u002Finference.sh\u002Fdocs\u002Fapi\u002Fsdk-python) - Full API documentation\n- [Agent SDK Overview](https:\u002F\u002Finference.sh\u002Fdocs\u002Fapi\u002Fagent-sdk) - Building agents\n- [Tool Builder Reference](https:\u002F\u002Finference.sh\u002Fdocs\u002Fapi\u002Fagent-tools) - Creating tools\n- [Authentication](https:\u002F\u002Finference.sh\u002Fdocs\u002Fapi\u002Fauthentication) - API key setup\n- [Streaming](https:\u002F\u002Finference.sh\u002Fdocs\u002Fapi\u002Fsdk\u002Fstreaming) - Real-time updates\n- [File Uploads](https:\u002F\u002Finference.sh\u002Fdocs\u002Fapi\u002Fsdk\u002Ffiles) - File handling\n","# Python SDK\n\nBuild AI applications with the [inference.sh](https:\u002F\u002Finference.sh) Python SDK.\n\n## Quick Start\n\n```bash\npip install inferencesh\n```\n\n```python\nfrom inferencesh import inference\n\nclient = inference(api_key=\"inf_your_key\")\n\n# Run an AI app\nresult = client.run({\n    \"app\": \"infsh\u002Fflux-schnell\",\n    \"input\": {\"prompt\": \"A sunset over mountains\"}\n})\nprint(result[\"output\"])\n```\n\n## Installation\n\n```bash\n# Standard installation\npip install inferencesh\n\n# With async support\npip install inferencesh[async]\n```\n\n**Requirements:** Python 3.8+\n\n## Authentication\n\n```python\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\n## Running Apps\n\n### Basic Execution\n\n```python\nresult = client.run({\n    \"app\": \"infsh\u002Fflux-schnell\",\n    \"input\": {\"prompt\": \"A cat astronaut\"}\n})\n\nprint(result[\"status\"])  # \"completed\"\nprint(result[\"output\"])  # Output data\n```\n\n### Fire and Forget\n\n```python\ntask = client.run({\n    \"app\": \"google\u002Fveo-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```\n\n### Streaming Progress\n\n```python\nfor update in client.run({\n    \"app\": \"google\u002Fveo-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```\n\n### Run Parameters\n\n| Parameter | Type | Description |\n|-----------|------|-------------|\n| `app` | string | App ID (namespace\u002Fname@version) |\n| `input` | dict | Input matching app schema |\n| `setup` | dict | Hidden setup configuration |\n| `infra` | string | 'cloud' or 'private' |\n| `session` | string | Session ID for stateful execution |\n| `session_timeout` | int | Idle timeout (1-3600 seconds) |\n\n## File Handling\n\n### Automatic Upload\n\n```python\nresult = client.run({\n    \"app\": \"image-processor\",\n    \"input\": {\n        \"image\": \"\u002Fpath\u002Fto\u002Fimage.png\"  # Auto-uploaded\n    }\n})\n```\n\n### Manual Upload\n\n```python\nfrom inferencesh import UploadFileOptions\n\n# Basic upload\nfile = client.upload_file(\"\u002Fpath\u002Fto\u002Fimage.png\")\n\n# With options\nfile = client.upload_file(\n    \"\u002Fpath\u002Fto\u002Fimage.png\",\n    UploadFileOptions(\n        filename=\"custom_name.png\",\n        content_type=\"image\u002Fpng\",\n        public=True\n    )\n)\n\nresult = client.run({\n    \"app\": \"image-processor\",\n    \"input\": {\"image\": file[\"uri\"]}\n})\n```\n\n## Sessions (Stateful Execution)\n\nKeep workers warm across multiple calls:\n\n```python\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```\n\n## Agent SDK\n\n### Template Agents\n\nUse pre-built agents from your workspace:\n\n```python\nagent = client.agent(\"my-team\u002Fsupport-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```\n\n### Ad-hoc Agents\n\nCreate custom agents programmatically:\n\n```python\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\u002Fflux-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\u002Fclaude-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```\n\n### Available Core Apps\n\n| Model | App Reference |\n|-------|---------------|\n| Claude Sonnet 4 | `infsh\u002Fclaude-sonnet-4@latest` |\n| Claude 3.5 Haiku | `infsh\u002Fclaude-haiku-35@latest` |\n| GPT-4o | `infsh\u002Fgpt-4o@latest` |\n| GPT-4o Mini | `infsh\u002Fgpt-4o-mini@latest` |\n\n## Tool Builder API\n\n### Parameter Types\n\n```python\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```\n\n### Client Tools (Run in Your Code)\n\n```python\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```\n\n### App Tools (Call AI Apps)\n\n```python\ngenerate = (\n    app_tool(\"generate_image\", \"infsh\u002Fflux-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```\n\n### Agent Tools (Delegate to Sub-agents)\n\n```python\nfrom inferencesh import agent_tool\n\nresearcher = (\n    agent_tool(\"research\", \"my-org\u002Fresearcher@v1\")\n    .describe(\"Research a topic\")\n    .param(\"topic\", string(\"Topic to research\"))\n    .build()\n)\n```\n\n### Webhook Tools (Call External APIs)\n\n```python\nfrom inferencesh import webhook_tool\n\nnotify = (\n    webhook_tool(\"slack\", \"https:\u002F\u002Fhooks.slack.com\u002F...\")\n    .describe(\"Send Slack notification\")\n    .secret(\"SLACK_SECRET\")\n    .param(\"channel\", string(\"Channel\"))\n    .param(\"message\", string(\"Message\"))\n    .build()\n)\n```\n\n### Internal Tools (Built-in Capabilities)\n\n```python\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\u002Fflux@latest\"\n    })\n    .build()\n)\n\nagent = client.agent({\n    \"core_app\": {\"ref\": \"infsh\u002Fclaude-sonnet-4@latest\"},\n    \"internal_tools\": config\n})\n```\n\n## Streaming Agent Responses\n\n```python\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```\n\n## File Attachments\n\n```python\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\u002Fpng;base64,iVBORw0KGgo...\"]\n)\n```\n\n## Skills (Reusable Context)\n\n```python\nagent = client.agent({\n    \"core_app\": {\"ref\": \"infsh\u002Fclaude-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:\u002F\u002Fexample.com\u002Fskills\u002Fapi-docs.md\"\n        }\n    ]\n})\n```\n\n## Async Support\n\n```python\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\u002Fflux-schnell\",\n        \"input\": {\"prompt\": \"A galaxy\"}\n    })\n\n    # Async agent\n    agent = client.agent(\"my-org\u002Fassistant@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```\n\n## Error Handling\n\n```python\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```\n\n## Human Approval Workflows\n\n```python\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```\n\n## Reference Files\n\n- [Agent Patterns](references\u002Fagent-patterns.md) - Multi-agent, RAG, human-in-the-loop patterns\n- [Tool Builder](references\u002Ftool-builder.md) - Complete tool builder API reference\n- [Streaming](references\u002Fstreaming.md) - Real-time progress updates and SSE handling\n- [File Handling](references\u002Ffiles.md) - Upload, download, and manage files\n- [Sessions](references\u002Fsessions.md) - Stateful execution with warm workers\n- [Async Patterns](references\u002Fasync-patterns.md) - Parallel processing and async\u002Fawait\n\n## Related Skills\n\n```bash\n# JavaScript SDK\nnpx skills add inference-sh\u002Fagent-skills@javascript-sdk\n\n# Full platform skill (all 150+ apps via CLI)\nnpx skills add inference-sh\u002Fagent-skills@inference-sh\n\n# LLM models\nnpx skills add inference-sh\u002Fagent-skills@llm-models\n\n# Image generation\nnpx skills add inference-sh\u002Fagent-skills@ai-image-generation\n```\n\n## Documentation\n\n- [Python SDK Reference](https:\u002F\u002Finference.sh\u002Fdocs\u002Fapi\u002Fsdk-python) - Full API documentation\n- [Agent SDK Overview](https:\u002F\u002Finference.sh\u002Fdocs\u002Fapi\u002Fagent-sdk) - Building agents\n- [Tool Builder Reference](https:\u002F\u002Finference.sh\u002Fdocs\u002Fapi\u002Fagent-tools) - Creating tools\n- [Authentication](https:\u002F\u002Finference.sh\u002Fdocs\u002Fapi\u002Fauthentication) - API key setup\n- [Streaming](https:\u002F\u002Finference.sh\u002Fdocs\u002Fapi\u002Fsdk\u002Fstreaming) - Real-time updates\n- [File Uploads](https:\u002F\u002Finference.sh\u002Fdocs\u002Fapi\u002Fsdk\u002Ffiles) - File handling\n",{"name":5,"description":43,"allowed-tools":44},"Python SDK for inference.sh - run AI apps, build agents, and integrate with 150+ models.\nPackage: inferencesh (pip install inferencesh). Supports sync\u002Fasync, streaming, file uploads.\nBuild agents with template or ad-hoc patterns, tool builder API, skills, and human approval.\nUse for: Python integration, AI apps, agent development, RAG pipelines, automation.\nTriggers: python sdk, inferencesh, pip install, python api, python client, async inference,\npython agent, tool builder python, programmatic ai, python integration, sdk python\n","Bash(pip install inferencesh), Bash(python *)","main","f4cb2d49f7667e79ef7804f50396d5aaffdf1f56","人工智能与大型语言模型\u002Fpython-sdk",1,"https:\u002F\u002Fgithub.com\u002FKernel8901\u002Fai-agent-skills-classification","https:\u002F\u002Fgithub.com\u002FKernel8901","a little little little dobe in life but science geek","2026-04-05 16:43:56",{"source":8,"skillName":5,"commands":54,"prompt":64,"zipAvailable":65},[55,58,61],{"tool":56,"command":57},"npx","npx skills add Kernel8901\u002Fai-agent-skills-classification --skill python-sdk",{"tool":59,"command":60},"bunx","bunx skills add Kernel8901\u002Fai-agent-skills-classification --skill python-sdk",{"tool":62,"command":63},"pnpm","pnpm dlx skills add Kernel8901\u002Fai-agent-skills-classification --skill python-sdk","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002FKernel8901\u002Fai-agent-skills-classification\u002Fblob\u002Fmain\u002F人工智能与大型语言模型\u002Fpython-sdk\u002FSKILL.md",true,[67,73,77,81,85,89,93],{"path":68,"resourceType":69,"resourceTypeDesc":70,"sizeBytes":71,"sourceHtmlUrl":72},"_meta.json","REFERENCE","参考文档",272,"https:\u002F\u002Fgithub.com\u002FKernel8901\u002Fai-agent-skills-classification\u002Fblob\u002Fmain\u002F人工智能与大型语言模型\u002Fpython-sdk\u002F_meta.json",{"path":74,"resourceType":69,"resourceTypeDesc":70,"sizeBytes":75,"sourceHtmlUrl":76},"references\u002Fagent-patterns.md",7051,"https:\u002F\u002Fgithub.com\u002FKernel8901\u002Fai-agent-skills-classification\u002Fblob\u002Fmain\u002F人工智能与大型语言模型\u002Fpython-sdk\u002Freferences\u002Fagent-patterns.md",{"path":78,"resourceType":69,"resourceTypeDesc":70,"sizeBytes":79,"sourceHtmlUrl":80},"references\u002Fasync-patterns.md",8755,"https:\u002F\u002Fgithub.com\u002FKernel8901\u002Fai-agent-skills-classification\u002Fblob\u002Fmain\u002F人工智能与大型语言模型\u002Fpython-sdk\u002Freferences\u002Fasync-patterns.md",{"path":82,"resourceType":69,"resourceTypeDesc":70,"sizeBytes":83,"sourceHtmlUrl":84},"references\u002Ffiles.md",6234,"https:\u002F\u002Fgithub.com\u002FKernel8901\u002Fai-agent-skills-classification\u002Fblob\u002Fmain\u002F人工智能与大型语言模型\u002Fpython-sdk\u002Freferences\u002Ffiles.md",{"path":86,"resourceType":69,"resourceTypeDesc":70,"sizeBytes":87,"sourceHtmlUrl":88},"references\u002Fsessions.md",7035,"https:\u002F\u002Fgithub.com\u002FKernel8901\u002Fai-agent-skills-classification\u002Fblob\u002Fmain\u002F人工智能与大型语言模型\u002Fpython-sdk\u002Freferences\u002Fsessions.md",{"path":90,"resourceType":69,"resourceTypeDesc":70,"sizeBytes":91,"sourceHtmlUrl":92},"references\u002Fstreaming.md",5932,"https:\u002F\u002Fgithub.com\u002FKernel8901\u002Fai-agent-skills-classification\u002Fblob\u002Fmain\u002F人工智能与大型语言模型\u002Fpython-sdk\u002Freferences\u002Fstreaming.md",{"path":94,"resourceType":69,"resourceTypeDesc":70,"sizeBytes":95,"sourceHtmlUrl":96},"references\u002Ftool-builder.md",8766,"https:\u002F\u002Fgithub.com\u002FKernel8901\u002Fai-agent-skills-classification\u002Fblob\u002Fmain\u002F人工智能与大型语言模型\u002Fpython-sdk\u002Freferences\u002Ftool-builder.md",[98,122,144,152,159,185],{"skillNo":99,"name":100,"nameZh":6,"description":101,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":102,"categories":103,"keywords":104,"publishedAt":38},"01M6Q5R6WZ06RRB9RQTW54B34B","zyfai","Earn yield on any Ethereum wallet on Base, Arbitrum, and Plasma. Use when a user wants passive DeFi yield on their funds. Deploys a non-custodial subaccount (Safe) linked to their EOA, enables automated yield optimization, and lets them deposit\u002Fwithdraw anytime.","https:\u002F\u002Fgithub.com\u002FKernel8901\u002Fai-agent-skills-classification\u002Fblob\u002Fmain\u002F金融\u002Fzyfai-sdk\u002FSKILL.md",[],[100,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121],"safe","ethereum","defi","Optimization","user","use","Wallet","base","deposit","withdraw","yield","arbitrum","non-custodial","passive","defi yield","earn","yield optimization",{"skillNo":123,"name":124,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":125,"categories":126,"keywords":127,"publishedAt":38},"01M6Q5R337B5JSNER4P4YS03TN","zerion-api","https:\u002F\u002Fgithub.com\u002FKernel8901\u002Fai-agent-skills-classification\u002Fblob\u002Fmain\u002F金融\u002Fzerion-api\u002FSKILL.md",[],[30,128,129,130,131,132,133,107,134,111,135,136,137,138,139,140,141,142,143],"zerion api","zerion","MCP","mcp server","server","blockchain","transactions","crypto wallet","crypto","evm","solana","query","across","positions","token","prices",{"skillNo":145,"name":146,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":147,"categories":148,"keywords":149,"publishedAt":38},"01M6Q5QZFYTDAZMZ27BN5VZXAR","zerion-api-skill","https:\u002F\u002Fgithub.com\u002FKernel8901\u002Fai-agent-skills-classification\u002Fblob\u002Fmain\u002F金融\u002Fzerion-api-skill\u002FSKILL.md",[],[30,150,151,128,129,130,131,132,133,107,134,111,136,137,138,139,140,141,142,143],"api skill","zerion api skill",{"skillNo":153,"name":154,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":155,"categories":156,"keywords":157,"publishedAt":38},"01M6Q5QW17QW98RA3FE45E4RD8","zerion-api-mcp","https:\u002F\u002Fgithub.com\u002FKernel8901\u002Fai-agent-skills-classification\u002Fblob\u002Fmain\u002F金融\u002Fzerion-api-mcp\u002FSKILL.md",[],[130,30,158,128,129,131,132,107,134,111,135,136,137,138,139,140,141,142,143],"zerion api mcp",{"skillNo":160,"name":161,"nameZh":6,"description":162,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":163,"categories":164,"keywords":165,"publishedAt":38},"01M6Q5QQYZB7A501BDEQWKGSJT","yahoo-finance-forex","Fetches real-time FOREX news and market data from Yahoo Finance for major currency pairs (EUR\u002FUSD, GBP\u002FUSD, USD\u002FJPY, etc.). Analyzes sentiment and provides trading context.","https:\u002F\u002Fgithub.com\u002FKernel8901\u002Fai-agent-skills-classification\u002Fblob\u002Fmain\u002F金融\u002Fyahoo-finance-forex\u002FSKILL.md",[],[166,167,168,169,170,171,172,173,174,175,27,176,177,178,179,180,181,182,183,184],"finance","yahoo finance","forex","yahoo","yahoo finance forex","github","https","sentiment","real-time","python3","Market","usd","news","time","currency","gbp","pip","market data","for",{"skillNo":186,"name":187,"nameZh":6,"description":188,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":189,"categories":190,"keywords":191,"publishedAt":38},"01M6Q5QM6VS84WZVM7BKXXPF32","yahoo-finance","This skill should be used when the user asks to \"get stock prices\", \"check stock quotes\", \"look up earnings\", \"get financial data\", \"find trending stocks\", or needs stock market data from Yahoo Finance.","https:\u002F\u002Fgithub.com\u002FKernel8901\u002Fai-agent-skills-classification\u002Fblob\u002Fmain\u002F金融\u002Fyahoo-finance-cli\u002FSKILL.md",[],[166,167,169,192,193,194,195,196,197,176,198,199,200,201,202,203,204,205,143,183],"cli","homebrew","find","check","brew","up","local","get","stock","link","trending","sf","quotes","ln"]