Skip to main content

Overview

Initializing an Agent Project sets up the foundation for building your AI agent. This process involves creating a virtual environment, installing the Upsonic CLI, and generating the project structure with template files.
If you don’t have uv installed, you can install it by following the instructions at this link.

Creating Virtual Environment

Before installing Upsonic, create a virtual environment to isolate your project dependencies:

Installing Upsonic CLI

Install Upsonic using pip:
This installs the upsonic command-line tool globally or within your virtual environment. Verify the installation:

Initialize your Agent Project

Navigate to your project directory and run:
The CLI will prompt you for an agent name. This creates:
  • agent.py: Template agent file with a basic main() function
  • upsonic_config.json: Configuration file with your agent’s metadata, schemas, and dependencies
The generated agent.py includes a simple example that uses Upsonic’s Agent class to process questions. You can customize this file to implement your agent’s specific logic.

Run your Agent Project

After initialization, install the required dependencies:
This installs all dependencies listed in the api section of upsonic_config.json, including FastAPI and uvicorn. Then start your agent as a FastAPI server:
By default, the server runs on http://localhost:8000. You can customize the host and port:
Access the interactive API documentation at http://localhost:8000/docs to test your agent’s endpoint.