Skip to content

Commit 78dee9c

Browse files
committed
add agent-cli package
1 parent 74ad610 commit 78dee9c

15 files changed

Lines changed: 5624 additions & 0 deletions

agent-cli/.gitignore

Lines changed: 134 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,134 @@
1+
# Logs
2+
logs
3+
*.log
4+
npm-debug.log*
5+
yarn-debug.log*
6+
yarn-error.log*
7+
lerna-debug.log*
8+
.pnpm-debug.log*
9+
10+
# Diagnostic reports (https://nodejs.org/api/report.html)
11+
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
12+
13+
# Runtime data
14+
pids
15+
*.pid
16+
*.seed
17+
*.pid.lock
18+
19+
# Directory for instrumented libs generated by jscoverage/JSCover
20+
lib-cov
21+
22+
# Coverage directory used by tools like istanbul
23+
coverage
24+
*.lcov
25+
26+
# nyc test coverage
27+
.nyc_output
28+
29+
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
30+
.grunt
31+
32+
# Bower dependency directory (https://bower.io/)
33+
bower_components
34+
35+
# node-waf configuration
36+
.lock-wscript
37+
38+
# Compiled binary addons (https://nodejs.org/api/addons.html)
39+
build/Release
40+
41+
# Dependency directories
42+
node_modules/
43+
jspm_packages/
44+
45+
# Snowpack dependency directory (https://snowpack.dev/)
46+
web_modules/
47+
48+
# TypeScript cache
49+
*.tsbuildinfo
50+
51+
# Optional npm cache directory
52+
.npm
53+
54+
# Optional eslint cache
55+
.eslintcache
56+
57+
# Optional stylelint cache
58+
.stylelintcache
59+
60+
# Microbundle cache
61+
.rpt2_cache/
62+
.rts2_cache_cjs/
63+
.rts2_cache_es/
64+
.rts2_cache_umd/
65+
66+
# Optional REPL history
67+
.node_repl_history
68+
69+
# Output of 'npm pack'
70+
*.tgz
71+
72+
# Yarn Integrity file
73+
.yarn-integrity
74+
75+
# dotenv environment variable files
76+
.env
77+
.env.development.local
78+
.env.test.local
79+
.env.production.local
80+
.env.local
81+
82+
# parcel-bundler cache (https://parceljs.org/)
83+
.cache
84+
.parcel-cache
85+
86+
# Next.js build output
87+
.next
88+
out
89+
90+
# Nuxt.js build / generate output
91+
.nuxt
92+
dist
93+
94+
# Gatsby files
95+
.cache/
96+
# Comment in the public line in if your project uses Gatsby and not Next.js
97+
# https://nextjs.org/blog/next-9-1#public-directory-support
98+
# public
99+
100+
# vuepress build output
101+
.vuepress/dist
102+
103+
# vuepress v2.x temp and cache directory
104+
.temp
105+
.cache
106+
107+
# Docusaurus cache and generated files
108+
.docusaurus
109+
110+
# Serverless directories
111+
.serverless/
112+
113+
# FuseBox cache
114+
.fusebox/
115+
116+
# DynamoDB Local files
117+
.dynamodb/
118+
119+
# TernJS port file
120+
.tern-port
121+
122+
# Stores VSCode versions used for testing VSCode extensions
123+
.vscode-test
124+
125+
# yarn v2
126+
.yarn/cache
127+
.yarn/unplugged
128+
.yarn/build-state.yml
129+
.yarn/install-state.gz
130+
.pnp.*
131+
132+
133+
#lib
134+
lib/

agent-cli/.husky/pre-commit

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
cd agent-cli
2+
npx lint-staged
3+
git update-index --again

agent-cli/.lintstagedrc.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"*.{ts,md,json}": "npx eslint --fix"
3+
}

agent-cli/.prettierignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Ignore artifacts:
2+
**/lib
3+
package-lock.json

agent-cli/.prettierrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{}

agent-cli/CLAUDE.md

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
# CLAUDE.md
2+
3+
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
4+
5+
## Project Overview
6+
7+
This repository contains a sample CLI application that demonstrates how to use Vertesia's Agent Runner SDK. The project uses TypeScript and is set up with ESLint, Prettier for code quality.
8+
9+
## Environment Setup
10+
11+
The application requires three environment variables to be set in a `.env` file:
12+
13+
- `VERTESIA_ENVIRONMENT` - The URL for the Vertesia API (default: <https://api.vertesia.io>)
14+
- `VERTESIA_API_KEY` - Your Vertesia API key
15+
16+
## Common Commands
17+
18+
### Development
19+
20+
- **Start the application**: `npm run start` (uses Bun to run the TypeScript directly)
21+
- **Build the application**: `npm run build` (compiles TypeScript to JavaScript in the `lib` directory)
22+
- **Clean build artifacts**: `npm run clean`
23+
24+
### Code Quality
25+
26+
- **Lint the code**: `npm run lint`
27+
- **Format the code**: `npm run format`
28+
29+
## Project Structure
30+
31+
- `src/index.ts` - Main entry point
32+
- `lib/` - Output directory for compiled JavaScript
33+
- `.env` - Environment configuration file (not committed to the repository)
34+
35+
## Architecture
36+
37+
The application uses the `@vertesia/client` SDK to interact with Vertesia's API. The main workflow:
38+
39+
1. Load environment variables from `.env`
40+
2. Initialize the Vertesia client with configuration
41+
3. Execute an asynchronous interaction (conversation)
42+
4. Stream and display the messages from the interaction
43+
44+
When extending this application, follow the pattern of using the Vertesia client's methods to create and manage interactions through their API.

agent-cli/README.md

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
# Vertesia Agent CLI
2+
3+
A command-line interface for interacting with Vertesia's AI agents. This CLI allows you to run conversations with Vertesia agents directly from your terminal.
4+
5+
## Installation
6+
7+
### From Source
8+
9+
1. Clone the repository
10+
2. Install dependencies:
11+
12+
```bash
13+
npm install
14+
```
15+
16+
3. Build the project:
17+
18+
```bash
19+
npm run build
20+
```
21+
22+
4. Link the CLI to make it available globally:
23+
24+
```bash
25+
npm link
26+
```
27+
28+
## Configuration
29+
30+
Create a `.env` file in the project root with the following variables:
31+
32+
```env
33+
VERTESIA_API_KEY=<your_vertesia_api_key>
34+
```
35+
36+
## Usage
37+
38+
### Getting Help
39+
40+
```bash
41+
agent --help
42+
```
43+
44+
### Running a Simple Agent Conversation
45+
46+
```bash
47+
agent run "Generate 5 creative business ideas for a tech startup and store those as individual content objects in a collection"
48+
```
49+
50+
### Running an Interactive Conversation
51+
52+
```bash
53+
agent run "Help me debug my React application" --interactive
54+
```
55+
56+
### Specifying Agent Type
57+
58+
```bash
59+
agent run "Create a marketing plan" --agent MarketingAgent
60+
```
61+
62+
## Command Options
63+
64+
- `--interactive`, `-i`: Enable interactive mode where you can converse with the agent
65+
- `--agent`, `-a`: Specify the agent type to use (default: MultipurposeAgent)
66+
67+
## Features
68+
69+
- Markdown rendering: Agent responses are rendered as markdown in the terminal
70+
- Interactive mode: Have real-time conversations with agents
71+
- Configurable agent types: Use different specialized agents for different tasks
72+
- Color-coded messages: Easily distinguish between user and agent messages
73+
- Link transformation: Resource references like `store:abc123` and `collection:xyz789` are automatically converted to clickable URLs
74+
- Styled hyperlinks: Links appear with white text and underline for better visibility
75+
76+
## Development
77+
78+
- Run in development mode: `npm run dev`
79+
- Build the project: `npm run build`
80+
- Run linting: `npm run lint`
81+
- Format code: `npm run format`
82+
83+
## License
84+
85+
APL-2.0 © Vertesia

agent-cli/env.example

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Rename this file to .env and fill in the appropriate values
2+
3+
# Vertesia API URL (default: api.vertesia.io)
4+
VERTESIA_ENVIRONMENT=api.vertesia.io
5+
6+
# Your Vertesia API key (required)
7+
VERTESIA_API_KEY=your_api_key_here

agent-cli/eslint.config.js

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import eslint from "@eslint/js";
2+
import tseslint from "typescript-eslint";
3+
4+
export default tseslint.config(
5+
eslint.configs.recommended,
6+
...tseslint.configs.recommended,
7+
{
8+
files: ["**/*.ts"],
9+
languageOptions: {
10+
parser: tseslint.parser,
11+
parserOptions: {
12+
project: "./tsconfig.json",
13+
},
14+
},
15+
plugins: {
16+
"@typescript-eslint": tseslint.plugin,
17+
},
18+
rules: {
19+
"@typescript-eslint/no-floating-promises": "error",
20+
},
21+
},
22+
);

0 commit comments

Comments
 (0)