Skip to content
Merged

Sync #35

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.DS_Store
39 changes: 39 additions & 0 deletions agents/agent-salesEngineer/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
node_modules

# output
out
dist
*.tgz

# code coverage
coverage
*.lcov

# logs
logs
_.log
report.[0-9]_.[0-9]_.[0-9]_.[0-9]_.json

# dotenv environment variable files
.env
.env.development.local
.env.test.local
.env.production.local
.env.local
.env.production
.env.development

# caches
.eslintcache
.cache
*.tsbuildinfo

# IntelliJ based IDEs
.idea

# Finder (MacOS) folder config
.DS_Store

# don't commit the agentuity build folder
.agentuity
.agentuity-crash-*.json
72 changes: 72 additions & 0 deletions agents/agent-salesEngineer/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
# Sales Engineer Agentuity Example

[![Deploy with Agentuity](https://app.agentuity.com/img/deploy.svg)](https://app.agentuity.com/deploy)

The Sales Engineer set of Agents are a system designed to help you efficiently complete Request for Proposal (RFP) documents via a natural conversation. The system is broken down into three agents:

1. Sales Engineer Agent
- This is the main agent that will be used to carry out a conversation with the user.
2. RFP Schema Agent
- This agent is responsible for extracting the schema from the RFP document. This allows users to submit their own RFP documents, which the sales engineer agent can then use to talk with them about.
3. RFP Generator Agent
- This agent is responsible for generating an RFP document based on the requirements of the user and the information gathered from the conversation.

Also included in this project is a simple CLI interface that allows you to interact with the Sales Engineer Agent.

## Quick Start

1. Clone the repository
2. Run `bun install` in the `app` directory to install the dependencies for the CLI interface
3. Run `bun install` in the `agent` directory to install the dependencies for the agents.
4. If you do not already have `agentuity` installed, run `curl -fsS https://agentuity.sh | sh` to install it. Then login with `agentuity login`.
5. Import the project with `agentuity project import` in the `agent` directory.
6. Run `agentuity dev` to start the agents in the `agent` directory.
7. Run `bun run app` in the `app` directory to start the CLI interface.

## Implementation Details

### Sales Engineer Agent

The Sales Engineer Agent is the main agent that will be used to carry out a conversation with the user. It is responsible for:

- Maintaining the state of the conversation.
- Outsourcing document related tasks to the RFP Schema Agent and RFP Generator Agent.

The Sales Engineer Agent expects requests of the format:

```json
{
"sessionId": "123e4567-e89b-12d3-a456-426614174000",
"userMessage": "Hello, I need help with my RFP",
"template": "base64EncodedStringHere (only required on first message)",
"templateContentType": "application/pdf (only required on first message)"
}
```

And responds with a message of the format:

```json
{
"message": "Hello, I need help with my RFP",
"done": false,
"filledTemplate": "only filled when done"
}
```

### RFP Schema Agent

The RFP Schema Agent is responsible for extracting the schema from the RFP document. This allows users to submit their own RFP documents, which the sales engineer agent can then use to talk with them about.
It accepts documents and returns a JSON object with the schema of the document.

### RFP Generator Agent

The RFP Generator Agent is responsible for generating an RFP document based on the requirements of the user and the information gathered from the conversation. It accepts a JSON object with the schema of the document and returns a markdown document.

### Setting up the Agent URL

The Agentuity environment variables are set by default on project import. However, to use the CLI, you'll need to configure your agent URL:

- **For Local Development**: Use the URL provided by the `agentuity dev` command
- **For Deployed Agents**:
1. Set the Incoming IO to API instead of Webhook
2. Set the provided URL in the `SALES_ENGINEER_URL` environment variable
36 changes: 36 additions & 0 deletions agents/agent-salesEngineer/agent/.cursor/rules/agent.mdc
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
---
description: Guidelines for writing Agentuity AI Agents in TypeScript
globs: "**/src/agents/**/index.ts"
alwaysApply: true
---

# AI Agent File

- Prefer using the `agentuity agent create` command to create a new Agent
- Prefer loading types from the node modules package `@agentuity/sdk` in the node_modules folder
- The file should export a default function
- Prefer naming the default function Agent or the name of the Agent based on the context of the Agent description
- All code should be in Typescript format
- Use the provided logger from the `AgentContext` interface such as `ctx.logger.info("my message: %s", "hello")`

## Example Agent File

```typescript
import type { AgentRequest, AgentResponse, AgentContext } from "@agentuity/sdk";

export default async function Agent(req: AgentRequest, resp: AgentResponse, ctx: AgentContext) {
return resp.json({hello: 'world'});
}
```

### AgentRequest

The AgentRequest interface provides a set of helper methods and public variables which can be used for working with data has been passed to the Agent.

### AgentResponse

The AgentResponse interface provides a set of helper methods for responding with different data formats from the Agent.

### AgentContext

The AgentContext has information specific to the incoming Agent request and a set of helper methods for accessing AI services like KeyValue storage and Vector storage.
97 changes: 97 additions & 0 deletions agents/agent-salesEngineer/agent/.cursor/rules/sdk.mdc
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
---
description: Agentuity JavaScript SDK API Reference
globs: "src/agents/**/*.ts"
alwaysApply: false
---

# Agentuity JavaScript SDK

The Agentuity JavaScript SDK provides a powerful framework for building AI agents in JavaScript and TypeScript. This cursor rules file helps you navigate the SDK's core interfaces and methods.

## Core Interfaces

### AgentHandler

The main handler function type for an agent:

```typescript
type AgentHandler = (
request: AgentRequest,
response: AgentResponse,
context: AgentContext
) => Promise<AgentResponseType>;
```

### AgentRequest

The `AgentRequest` interface provides methods for accessing request data:

- `request.trigger`: Gets the trigger type of the request
- `request.metadata(key, defaultValue)`: Gets metadata associated with the request
- `request.get(key, defaultValue)`: Gets the metadata value of the request
- `request.data.contentType`: Gets the content type of the request payload
- `request.data.json(): Promise<Json>`: Gets the payload as a JSON object
- `request.data.text(): Promise<string>`: Gets the payload as a string
- `request.data.buffer(): Promise<ArrayBuffer>`: Gets the payload as a ArrayBuffer
- `request.data.binary(): Promise<ArrayBuffer>`: Gets the payload as a ArrayBuffer
- `request.data.object<T>: Promise<T>`: Gets the payload as a typed object

### AgentResponse

The `AgentResponse` interface provides methods for creating responses:

- `response.json(data, metadata)`: Creates a JSON response
- `response.text(data, metadata)`: Creates a text response
- `response.binary(data, metadata)`: Creates a binary response
- `response.html(data, metadata)`: Creates an HTML response
- `response.empty(metadata)`: Creates an empty response
- `response.handoff(agent, args?)`: Redirects to another agent within the same project

### AgentContext

The `AgentContext` interface provides access to various capabilities:

- `context.logger`: Logging functionality
- `context.kv`: Key-Value storage
- `context.vector`: Vector storage
- `context.getAgent(params)`: Gets a handle to a remote agent
- `context.tracer`: OpenTelemetry tracing

## Storage APIs

### Key-Value Storage

Access through `context.kv`:

- `context.kv.get(name, key)`: Retrieves a value
- `context.kv.set(name, key, value, params)`: Stores a value with optional params (KeyValueStorageSetParams)
- `context.kv.delete(name, key)`: Deletes a value

### Vector Storage

Access through `context.vector`:

- `context.vector.upsert(name, ...documents)`: Inserts or updates vectors
- `context.vector.search(name, params)`: Searches for vectors
- `context.vector.delete(name, ...ids)`: Deletes vectors

## Logging

Access through `context.logger`:

- `context.logger.debug(message, ...args)`: Logs a debug message
- `context.logger.info(message, ...args)`: Logs an informational message
- `context.logger.warn(message, ...args)`: Logs a warning message
- `context.logger.error(message, ...args)`: Logs an error message
- `context.logger.child(opts)`: Creates a child logger with additional context

## Best Practices

- Use TypeScript for better type safety and IDE support
- Import types from `@agentuity/sdk`
- Use structured error handling with try/catch blocks
- Leverage the provided logger for consistent logging
- Use the storage APIs for persisting data
- Consider agent communication for complex workflows

For complete documentation, visit: https://agentuity.dev/SDKs/javascript/api-reference
12 changes: 12 additions & 0 deletions agents/agent-salesEngineer/agent/.editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# EditorConfig is awesome: https://EditorConfig.org

# top-most EditorConfig file
root = true

[*]
indent_style = tab
indent_size = 2
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = false
insert_final_newline = false
78 changes: 78 additions & 0 deletions agents/agent-salesEngineer/agent/agentuity.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
# yaml-language-server: $schema=https://raw.githubusercontent.com/agentuity/cli/refs/heads/main/agentuity.schema.json

# ------------------------------------------------
# This file is generated by Agentuity
# You should check this file into version control
# ------------------------------------------------

# The version semver range required to run this project
version: ">=0.0.149"
# The ID of the project which is automatically generated
project_id: proj_d0b669c40c43b68abfa45eb582ded55a
# The name of the project which is editable
name: agent-salesEngineer
# The description of the project which is editable
description: A set of agents that fill out an RFP based on a template and user input.
# The development configuration for the project
development:
# The port to run the development server on which can be overridden by setting the PORT environment variable
port: 3500
watch:
# Whether to watch for changes and automatically restart the server
enabled: true
# Rules for files to watch for changes
files:
- src/**
# The command to run the development server
command: node
# The arguments to pass to the development server
args:
- --env-file=.env
- --env-file-if-exists=.env.development
- --no-deprecation
- .agentuity/index.js
deployment:
command: node
args:
- --disable-sigusr1
- --disallow-code-generation-from-strings
- --no-addons
- --no-deprecation
- --no-global-search-paths
- --report-uncaught-exception
- .agentuity/index.js
# You should tune the resources for the deployment
resources:
# The memory requirements
memory: 350Mi
# The CPU requirements
cpu: 500M
# The disk size requirements
disk: 250Mi
# You should not need to change these value
bundler:
enabled: true
identifier: nodejs
language: javascript
runtime: nodejs
agents:
dir: src/agents
ignore:
- node_modules/**
- dist/**
- src/**
# The agents that are part of this project
agents:
- # The ID of the Agent which is automatically generated
id: agent_8e7e449811a4a2a8a2244a80335ef5a9
# The name of the Agent which is editable
name: salesEngineer
# The description of the Agent which is editable
description: An agent that fills out an RFP based on a template and user input.
- id: agent_8c1b5f5a7e5925498085ff0edab24948
name: rfpSchema
description: A simple agent that generates a JSON Schema for an RFP.
- id: agent_d1688c17ebd73df1171be9616531c365
name: rfpGenerator
- id: agent_ee0e683154200352d1599aa7bef67c86
name: temp
27 changes: 27 additions & 0 deletions agents/agent-salesEngineer/agent/biome.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"$schema": "https://biomejs.dev/schemas/1.5.3/schema.json",
"organizeImports": {
"enabled": true
},
"linter": {
"enabled": true,
"rules": {
"recommended": true
}
},
"formatter": {
"enabled": true,
"indentStyle": "space",
"indentWidth": 2
},
"javascript": {
"formatter": {
"quoteStyle": "single",
"trailingCommas": "es5",
"semicolons": "always"
}
},
"files": {
"ignore": [".agentuity/**"]
}
}
Loading