mirror of
https://github.com/shumaiOne/shumai.git
synced 2026-11-27 11:24:43 +00:00
48 lines
2.2 KiB
Plaintext
48 lines
2.2 KiB
Plaintext
---
|
|
title: Agent Skills
|
|
description: Extend your agents' capabilities with custom JavaScript/TypeScript tool scripts.
|
|
---
|
|
|
|
By default, LLMs can only process text. In Shumai, you can extend your agents' capabilities by registering **Skills**—custom scripts that the agent can choose to execute when solving a task.
|
|
|
|
---
|
|
|
|
## How Skills Work
|
|
|
|
Shumai skills are structured as standard functions that accept a JSON input payload and execute inside a secure, sandboxed environment.
|
|
|
|
- **Function Declarations**: When you register a skill, you write a description and declare a parameters schema using JSON Schema format.
|
|
- **Tool Calling**: The LLM reads this schema. If it decides it needs to use the skill (e.g. to search a folder or calculate a statistic), it outputs a structured tool call.
|
|
- **Execution**: Shumai catches the tool call, spins up a secure sandbox, runs your skill script with the LLM's arguments, and returns the result back to the LLM to complete its response.
|
|
|
|
---
|
|
|
|
## Registering a Skill
|
|
|
|
To add a new skill, navigate to **Team Settings** > **Skills**:
|
|
|
|
1. Click **Create Skill**.
|
|
2. Fill in the parameters:
|
|
- **Name**: E.g., `image_resizer` or `slack_notify`.
|
|
- **Description**: A clear explanation of what the tool does (the LLM reads this description to understand when to invoke it).
|
|
- **Parameters Schema**: A JSON Schema describing the input arguments.
|
|
- **Script Code**: The actual JavaScript code to be executed.
|
|
3. Click **Save**.
|
|
4. Navigate to **Agents** and check the box to assign this skill to your chosen Chat Agent.
|
|
|
|
```javascript
|
|
// Example Skill Script: slack_notify
|
|
// Receives parameter: { channel: string, message: string }
|
|
async function main(args) {
|
|
const response = await fetch(`https://hooks.slack.com/services/${args.channel}`, {
|
|
method: 'POST',
|
|
body: JSON.stringify({ text: args.message }),
|
|
headers: { 'Content-Type': 'application/json' },
|
|
})
|
|
return response.ok ? 'Notification sent' : 'Failed to send'
|
|
}
|
|
```
|
|
|
|

|
|
_Placeholder: Table displaying custom skills, their descriptions, code editors, and the list of agents currently utilizing them._
|