A starter project to help you get started with OpenServ Labs SDK - a powerful TypeScript framework for building non-deterministic AI agents with advanced cognitive capabilities.
This starter provides a minimal setup to help you understand the basics of the SDK. For more advanced features like tasks, file operations, and inter-agent collaboration, check out the SDK documentation.
To allow OpenServ to access your agent locally, use a tunneling tool like ngrok or localtunnel:
Example using ngrok:
ngrok http 7378 # Replace 7378 with your actual PORT if different
Copy your tunneling tool URL (e.g., https://your-name.ngrok-free.app
)
A tunneling is a software utility that exposes a local server on your machine to the internet through a secure public URL, making it useful for testing webhooks, APIs, or services in a local development environment.
- Create a developer account on OpenServ
- Create an agent: Developer -> Add Agent --> Add: Agent Name and Capabilities Description
Agent Name: My first AI Agent Test
Capabilities Description: I perform basic arithmetic operations
- Add Endpoint URL: set the agent's endpoint URL to your tunnelling URL (e.g. ngrok) --> Save
- Create an API key: Manage this agent --> Create secret key --> Copy secret key
- Create an account on OpenAI
- Create an API key: API keys --> Create new secret key --> Copy key
- Clone this repository
git clone https://github.com/openserv-labs/agent-starter.git
cd agent-starter
- Install dependencies:
npm install
- Copy
.env.example
to.env
and fill in your configuration:
cp .env.example .env
- Update the environment variables in
.env
:OPENSERV_API_KEY
: Your OpenServ API keyPORT
: The port number for your agent's HTTP server (default: 7378)OPENAI_API_KEY
: Your OpenAI API key
- Start your agent locally using
npm run dev
ornpm start
- Your agent is now ready to use on the platform!
This agent-starter includes a simple example agent that can perform basic arithmetic:
// Example usage
const response = await agent.process({
messages: [
{
role: 'user',
content: 'add 13 and 29'
}
]
})
Run the development server with hot reload:
npm run dev
- Go to the OpenServ Platform
- Create a new Project: Projects -> Create a new project
- Add Project Name and Project Goal and Instructions
- Add Agent: Search for your agent name and add it to the project
- Run the project
- Verify if the agent response is equivalent to what you expect
The project uses ESLint and Prettier for code quality and formatting:
# Run ESLint
npm run lint
# Fix ESLint issues
npm run lint:fix
# Format code with Prettier
npm run format
Build the project:
npm run build
Run the built version:
npm start
- The project is set up with TypeScript, ts-node-dev for development, and includes VS Code debugging configuration
- Environment variables are validated using Zod
- ESLint and Prettier are configured for consistent code style
- The agent uses natural language processing to understand and execute commands
Once you're comfortable with the basics, explore more advanced features in the OpenServ Labs SDK:
- Tasks and workflows
- Chat interactions
- File operations
- Custom capabilities
- Inter-agent collaboration