Basic Usage
This guide helps you get started with OpenHuman.
Create Your First Agent
npx openhuman agent create --name "My Assistant"
Or using code:
import { OpenHuman } from 'openhuman-sdk';
const client = new OpenHuman({
apiKey: process.env.OPENHUMAN_API_KEY,
});
const agent = await client.agents.create({
name: 'My Assistant',
instructions: 'You are a helpful assistant who can answer a variety of questions.',
});
console.log('Agent ID:', agent.id);
Start a Conversation
const response = await client.agents.run(agent.id, {
message: 'Hello, please introduce yourself',
});
console.log(response.message);
Use Tools
Agents can use various tools to complete tasks:
const response = await client.agents.run(agent.id, {
message: 'Search for the latest AI news for me',
tools: ['web-search'], // Specify tools to use
});
Manage Memory
// Store information
await client.memory.store({
content: 'User prefers a minimalist design style',
source: 'conversation',
tags: ['preference', 'design'],
});
// Retrieve memories
const memories = await client.memory.recall({
query: "User's design preferences",
});
Configure an Agent
const agent = await client.agents.create({
name: 'Tech Documentation Assistant',
instructions: `
You are a professional technical documentation assistant.
Behavior guidelines:
- Answer concisely and clearly
- Use markdown formatting for code examples
- Be honest when you are uncertain about something
`,
tools: ['web-search', 'web-scraper'],
model: 'claude-sonnet-4-20250514',
});
Monitor Run Status
const run = await client.agents.run(agent.id, {
message: 'Write a blog post about AI',
});
console.log('Run ID:', run.id);
console.log('Status:', run.status);
// Get result
const result = await client.runs.get(run.id);
console.log(result.message);
Next Steps
- Advanced Features - Learn more advanced features
- System Integration - Integrate with other systems
- Best Practices - Best practices recommendations