Run inference.sh apps as agent tools.
Basic Usage
1from inferencesh import app_tool2 3image_gen = (4 app_tool("generate_image", "infsh/flux@latest")5 .describe("Generate images from text prompts")6 .build()7)How It Works
When the agent calls an app tool:
- A task is created for the referenced app
- Tool arguments become task input
- Task output becomes tool result
- Agent continues with the result
Builder Methods
| Method | Description |
|---|---|
appTool(name, ref) | Create app tool with app reference |
.describe(text) | Set description for LLM |
.display(name) | Human-readable name |
.requireApproval() | Require user approval |
.build() | Build the tool |
App Reference Formats
code
1# Latest version2namespace/app-name@latest3 4# Specific version5namespace/app-name@abc123Examples
Image Generation
1image_gen = (2 app_tool("generate_image", "infsh/flux@latest")3 .describe("Generate an image from a text prompt")4 .build()5)6 7agent = client.agent({8 "core_app_ref": "infsh/claude-sonnet-4@latest",9 "tools": [image_gen]10})11 12response = agent.send_message("Generate a picture of a sunset")13# Agent calls generate_image, waits for result, then respondsText-to-Speech & Code Execution
1tts = (2 app_tool("speak", "infsh/tts@latest")3 .describe("Convert text to speech audio")4 .build()5)6 7code_runner = (8 app_tool("run_code", "infsh/code-interpreter@latest")9 .describe("Execute Python code and return the result")10 .build()11)With Approval
1expensive_model = (2 app_tool("analyze", "expensive/model@latest")3 .describe("Deep analysis using expensive model")4 .require_approval() # User must approve before running5 .build()6)Multiple App Tools
1agent = client.agent({2 "core_app_ref": "infsh/claude-sonnet-4@latest",3 "tools": [4 app_tool("generate_image", "infsh/flux@latest")5 .describe("Generate images").build(),6 app_tool("transcribe", "infsh/whisper@latest")7 .describe("Transcribe audio").build(),8 app_tool("run_code", "infsh/code-interpreter@latest")9 .describe("Run Python code").build(),10 ]11})