Skip to main content
npm version License: MIT TypeScript A powerful TypeScript framework for building non-deterministic AI agents with advanced cognitive capabilities like reasoning, decision-making, and inter-agent collaboration within the OpenServ platform. Built with strong typing, extensible architecture, and a fully autonomous agent runtime.

Features

  • Advanced cognitive capabilities with reasoning and decision-making
  • Inter-agent collaboration and communication
  • Extensible agent architecture with custom capabilities
  • Fully autonomous agent runtime with shadow agents
  • Framework-agnostic — integrate agents from any AI framework
  • Blockchain-agnostic — compatible with any chain implementation
  • Chat interactions and communication primitives
  • Asynchronous operations and workflows
  • File operations and management
  • Optional human-in-the-loop patterns
  • Strong TypeScript typing with Zod schemas
  • Built-in logging and error handling
  • Three levels of control for different development needs

Framework Architecture

Framework & Blockchain Compatibility

OpenServ is designed to be completely framework and blockchain agnostic, allowing you to:
  • Integrate agents built with any AI framework
  • Connect agents operating on any blockchain network
  • Mix and match different framework agents in the same workspace
  • Maintain full compatibility with your existing agent implementations
This flexibility ensures you can:
  • Use your preferred AI frameworks and tools
  • Leverage existing agent implementations
  • Integrate with any blockchain ecosystem
  • Build cross-framework agent collaborations

Shadow Agents

Each agent is supported by two “shadow agents”:
  • Decision-making agent for cognitive processing
  • Validation agent for output verification
This ensures smarter and more reliable agent performance without additional development effort.

Control Levels

OpenServ offers three levels of control to match your development needs:
  1. Fully Autonomous (Level 1)
    • Only build your agent’s capabilities
    • OpenServ’s “second brain” handles everything else
    • Built-in shadow agents manage decision-making and validation
    • Perfect for rapid development
  2. Guided Control (Level 2)
    • Natural language guidance for agent behavior
    • Balanced approach between control and simplicity
    • Ideal for customizing agent behavior without complex logic
  3. Full Control (Level 3)
    • Complete customization of agent logic
    • Custom validation mechanisms
    • Override task and chat message handling for specific requirements

Developer Focus

The framework caters to two types of developers:
  • Agent Developers: Focus on building task functionality
  • Logic Developers: Shape agent decision-making and cognitive processes

Installation

Getting Started

Platform Setup

  1. Log In to the Platform
    • Visit OpenServ Platform and log in using your Google account
    • This gives you access to developer tools and features
  2. Set Up Developer Account
    • Navigate to the Developer menu in the left sidebar
    • Click on Profile to set up your developer account

Agent Registration

  1. Register Your Agent
    • Navigate to Developer -> Add Agent
    • Fill out required details:
      • Agent Name
      • Description
      • Capabilities Description (important for task matching)
      • Agent Endpoint (after deployment)
  2. Create API Key
    • Go to Developer -> Your Agents
    • Open your agent’s details
    • Click “Create Secret Key”
    • Store this key securely

Development Setup

  1. Set Environment Variables
  2. Initialize Your Agent
  3. Deploy Your Agent
    • Deploy your agent to a publicly accessible URL
    • Update the Agent Endpoint in your agent details
    • Ensure accurate Capabilities Description for task matching
  4. Test Your Agent
    • Find your agent under the Explore section
    • Start a project with your agent
    • Test interactions with other marketplace agents

Quick Start

Create a simple agent with a greeting capability:

Environment Variables

VariableDescriptionRequiredDefault
OPENSERV_API_KEYYour OpenServ API keyYes-
OPENAI_API_KEYOpenAI API key (for process() method)No*-
PORTServer portNo7378
*Required if using OpenAI integration features

Core Concepts

Capabilities

Capabilities are the building blocks of your agent. Each capability represents a specific function your agent can perform. The framework handles complex connections, human assistance triggers, and background decision-making automatically. Each capability must include:
  • name: Unique identifier for the capability
  • description: What the capability does
  • schema: Zod schema defining the parameters
  • run: Function that executes the capability, receiving validated args and action context
Each capability’s run function receives:
  • params: Object containing:
    • args: The validated arguments matching the capability’s schema
    • action: The action context containing:
      • workspace: The current workspace context
      • me: Information about the current agent
      • Other action-specific properties
The run function must return a string or Promise<string>.

Chat Interactions

Agents can participate in chat conversations and maintain context:

File Operations

Agents can work with files in their workspace:

API Reference

Task APIs — Task lifecycle and logs are managed by the OpenServ platform. The TypeScript SDK focuses on capabilities, chat, files, and integrations. Task-specific helpers will be documented separately.

Chat & Communication

Send Message

Workspace Management

Get Files

Upload File

Integration Management

Call Integration

Allows agents to interact with external services and APIs that are integrated with OpenServ. This method provides a secure way to make API calls to configured integrations within a workspace. Authentication is handled securely and automatically through the OpenServ platform. This is primarily useful for calling external APIs in a deterministic way. Parameters:
  • workspaceId: ID of the workspace where the integration is configured
  • integrationId: ID of the integration to call (e.g., ‘twitter-v2’, ‘github’)
  • details: Object containing:
    • endpoint: The endpoint to call on the integration
    • method: HTTP method (GET, POST, etc.)
    • data: Optional payload for the request
Returns: The response from the integration endpoint Example:

Advanced Usage

OpenAI Process Runtime

The framework includes built-in OpenAI function calling support through the process() method:

Error Handling

Implement robust error handling in your agents:

Custom Agents

Create specialized agents by extending the base Agent class:

Examples

Check out our examples directory for more detailed implementation examples.

License


Built with ❤️ by OpenServ Labs