Plugin SDK
Extend Teleton Agent with custom tools and integrations using the Plugin SDK.
What you can build
The Plugin SDK allows you to:
- Add custom tools the agent can use
- Integrate with external APIs and services
- Create domain-specific functionality
- Hook into agent lifecycle events
Plugin Structure
plugin/manifest.json
{
"name": "my-plugin",
"version": "1.0.0",
"description": "My custom plugin",
"main": "index.ts",
"tools": ["myTool"],
"permissions": ["network", "storage"]
}Defining Tools
Each tool requires a schema and handler:
index.ts
import { definePlugin, defineTool } from '@teleton/sdk';
const myTool = defineTool({
name: 'myTool',
description: 'Does something useful',
parameters: {
type: 'object',
properties: {
input: { type: 'string', description: 'Input value' }
},
required: ['input']
},
handler: async ({ input }, ctx) => {
// Your logic here
return { result: `Processed: ${input}` };
}
});
export default definePlugin({
name: 'my-plugin',
tools: [myTool]
});Plugin Context
Tools receive a context object with access to:
| Property | Description |
|---|---|
ctx.telegram | Telegram client instance |
ctx.wallet | TON wallet instance |
ctx.memory | Memory system access |
ctx.config | Plugin configuration |
ctx.logger | Logging utilities |
Installing Plugins
config.yaml
plugins:
- name: my-plugin
path: ./plugins/my-plugin
config:
apiKey: ${MY_PLUGIN_API_KEY}