A powerful framework for creating AI agents with flows and plugins.
npm install @skynet/agent
import { createAgent, AgentConfig } from '@skynet/agent'
const config: AgentConfig = {
id: {
generation: 1,
familyCode: 'TEST',
serialNumber: '001'
},
type: 'MAIN',
brain: {
provider: 'openai',
config: {
model: 'gpt-4'
},
// Optional: Override default system prompt
systemPrompt: `You are a specialized AI agent focused on blockchain analysis.
Your primary goal is to analyze market trends and identify opportunities.
You should always prioritize risk management and provide clear reasoning for your decisions.`
}
}
const agent = await createAgent(config)
await agent.start()
import { createFlow, BaseFlow, FlowContext } from '@skynet/agent'
// Method 1: Using createFlow helper
const simpleFlow = createFlow(
'simple-flow',
'A simple example flow',
['my-plugin'],
async (context: FlowContext) => {
// Flow logic here
console.log('Executing simple flow')
}
)
// Method 2: Extending BaseFlow
class CustomFlow extends BaseFlow {
constructor() {
super(
'custom-flow',
'A more complex flow',
['plugin1', 'plugin2'],
{
step1: {
plugin: 'plugin1',
command: 'doSomething',
args: []
}
}
)
}
async execute(context: FlowContext) {
// Complex flow logic here
}
}
import { IPlugin } from '@skynet/agent'
import { EventEmitter } from 'events'
export class CustomPlugin extends EventEmitter implements IPlugin {
name = 'custom-plugin'
async initialize() {
// Plugin initialization
}
async cleanup() {
// Cleanup resources
}
// Custom plugin methods
async doSomething() {
return 'result'
}
}
- 🤖 Easy agent creation and management
- 🔄 Flow-based task execution
- 🔌 Plugin system for extensibility
- 🧬 Trait-based agent personalities
- 🔗 Blockchain integration
- 🧠 LLM integration with customizable system prompts
- 📦 Type-safe APIs
You can customize your agent's behavior by providing a custom system prompt:
const agent = await createAgent({
// ... other config
brain: {
provider: 'openai',
config: { model: 'gpt-4' },
systemPrompt: `You are a specialized trading agent with the following traits:
1. Risk-averse: Always prioritize capital preservation
2. Data-driven: Make decisions based on quantitative analysis
3. Transparent: Explain your reasoning clearly
4. Methodical: Follow a strict trading strategy`
}
})
The system prompt helps define the agent's:
- Role and personality
- Decision-making criteria
- Communication style
- Operating constraints
- Specialized knowledge or focus areas
If not provided, the agent will use a default system prompt appropriate for its type and traits.
The framework follows a modular architecture:
- Agents: Core entities that execute flows and manage plugins
- Flows: Define sequences of actions using plugins
- Plugins: Provide specific functionalities (e.g., blockchain, API integrations)
- Traits: Define agent personalities and behaviors
- LLM: Integration with language models for decision making
curl -X POST http://localhost:3010/kill -H "Content-Type: application/json" -d '{"shutdownKey": "hello"}'
- Fork the repository
- Create your feature branch
- Commit your changes
- Push to the branch
- Create a Pull Request