Create agents on-the-fly without saving to workspace.
Basic Usage
typescript
1import { inference } from '@inferencesh/sdk';23const client = inference({ apiKey: 'inf_your_key' });45const agent = client.agent({6 core_app: { ref: 'infsh/claude-sonnet-4@latest' },7 system_prompt: 'You are a helpful assistant.'8});910const response = await agent.sendMessage('Hello!');11console.log(response.text);Configuration Options
typescript
1interface AgentConfig {2 // Required3 core_app: { ref: string };45 // Optional6 system_prompt?: string;7 tools?: Tool[];8 skills?: SkillConfig[]; // On-demand context9 internal_tools?: InternalToolsConfig;10 max_tool_iterations?: number;11 enable_autocomplete?: boolean;1213 // Model parameters14 temperature?: number;15 max_tokens?: number;16}Core Apps
| App | Description |
|---|---|
infsh/claude-sonnet-4 | Claude Sonnet 4 |
infsh/claude-haiku-35 | Claude 3.5 Haiku |
infsh/gpt-4o | GPT-4o |
infsh/gpt-4o-mini | GPT-4o Mini |
With Tools
typescript
1import { tool, string } from '@inferencesh/sdk';23const weather = tool('get_weather')4 .describe('Get current weather')5 .param('city', string('City name'))6 .handler(args => `Weather in ${args.city}: 72°F, Sunny`)7 .build();89const agent = client.agent({10 core_app: { ref: 'infsh/claude-sonnet-4@latest' },11 tools: [weather]12});Skills
Load context on-demand via skill_get:
typescript
1const agent = client.agent({2 core_app: { ref: 'infsh/claude-sonnet-4@latest' },3 skills: [4 {5 name: 'code-review',6 description: 'Guidelines for reviewing pull requests',7 content: '# Code Review\n\nWhen reviewing code...'8 },9 {10 name: 'api-docs',11 description: 'API documentation',12 url: 'https://example.com/skills/api-docs.md'13 }14 ]15});Internal Tools
Enable built-in tools:
typescript
1const agent = client.agent({2 core_app: { ref: 'infsh/claude-sonnet-4@latest' },3 internal_tools: {4 web_search: true,5 code_execution: true,6 image_generation: {7 enabled: true,8 app_ref: 'infsh/flux@latest'9 }10 }11});