DataSphereServerlessSkill

View as MarkdownOpen in Claude

Same DataSphere search as DataSphereSkill, but the tool is registered as a DataMap — the SignalWire platform executes the search directly, without calling back to your agent process.

Credentials and URL are baked into the DataMap from config at registration time, so the same parameters are required here as on DataSphereSkill.

Class: DataSphereServerlessSkill

Tools: Custom per instance via tool_name (default search_knowledge), registered as a DataMap-style SWAIG function.

Env vars: None. space_name, project_id, and token must be supplied as config values — the serverless build path reads config only, not environment variables.

Multi-instance: yes

tool_name
stringDefaults to search_knowledge

Custom tool name for this instance. Required when registering multiple instances on the same agent.

space_name
stringRequired

SignalWire space name (e.g., "mycompany" from mycompany.signalwire.com).

project_id
stringRequired

SignalWire project ID.

token
stringRequired

SignalWire API token.

document_id
stringRequired

DataSphere document ID to search within.

count
integerDefaults to 1

Number of results to return (range 1-10).

distance
numberDefaults to 3.0

Maximum distance threshold (range 0-10; lower is more relevant).

tags
string[]

Tags to filter results.

language
string

Language code for query expansion (e.g., "en", "es").

pos_to_expand
string[]

Parts of speech to expand with synonyms. Entries must be one of "NOUN", "VERB", "ADJ", "ADV".

max_synonyms
integer

Maximum number of synonyms used for query expansion (range 1-10).

no_results_message
string

Message returned when no results match the query. Supports a {query} placeholder that is substituted with the user’s query text at registration time.

Example

1import { AgentBase, DataSphereServerlessSkill } from '@signalwire/sdk';
2
3const agent = new AgentBase({ name: 'assistant', route: '/assistant' });
4agent.setPromptText('You are a helpful assistant.');
5
6await agent.addSkill(new DataSphereServerlessSkill({
7 space_name: 'mycompany',
8 document_id: 'doc_1234',
9 count: 3,
10 tool_name: 'search_product_docs',
11}));
12
13agent.run();