Skip to main content

Quickstart

Fastest Path to Your First Agent

This guide shows how to build and run a simple AI agent using the SmythOS SDK. For setup and prerequisites, see the Getting Started page.

1. Create a New Project

If you haven’t already, scaffold a project using the CLI instructions or create a folder manually.

CLI Scaffolding (Recommended)

For the fastest setup, see Getting Started for full CLI details.

npm i -g @smythos/cli
sre create

2. Install the SDK

Inside your project folder, install the SmythOS SDK. If you need help with this step, see the installation instructions to get started

npm install @smythos/sdk

3. Build Your First Agent

Create a new file called index.ts in your project folder, and add the following code:

import { Agent } from '@smythos/sdk';

async function main() {
// Create a new agent
const agent = new Agent({
name: 'CryptoMarket Assistant',
behavior: 'You are a crypto price tracker. You are given a coin id and you need to get the price of the coin in USD',
model: 'gpt-4o',
});

// Add a skill to the agent
agent.addSkill({
name: 'MarketData',
description: 'Use this skill to get comprehensive market data and statistics for a cryptocurrency',
process: async ({ coin_id }) => {
const url = `https://api.coingecko.com/api/v3/coins/${coin_id}?localization=false&tickers=false&market_data=true&community_data=false&developer_data=false&sparkline=false`;
const response = await fetch(url);
const data = await response.json();
return data.market_data;
},
});

// Prompt the agent and let it use the skill
const promptResult = await agent.prompt('What are the current prices of Bitcoin and Ethereum ?');
console.log(promptResult);

// You can also call the skill directly
const directCallResult = await agent.call('MarketData', { coin_id: 'bitcoin' });
console.log('Direct call to MarketData for Bitcoin:', directCallResult.current_price.usd);
}

main();

4. Run Your Agent

Use ts-node to run your agent:

ts-node index.ts
What to Expect

If everything is set up correctly, you should see your agent respond with the current prices of Bitcoin and Ethereum.

Next Steps

  • Edit your agent’s skills or prompts to try out new ideas.
  • Explore advanced workflows in the SDK Guide.
  • Learn about system internals in the SRE Architecture page.