Skip to content
Merged
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
36 changes: 36 additions & 0 deletions agents/agent-riza/.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.
9 changes: 9 additions & 0 deletions agents/agent-riza/.cursor/rules/agentuity.mdc
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
description: Guidelines for the Agentuity AI Configuration file
globs: "agentuity.yaml"
alwaysApply: true
---

# Agentuity Configuration File

This file is used by Agentuity to configure the AI Agent project. You should NOT suggest edits to this file.
97 changes: 97 additions & 0 deletions agents/agent-riza/.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-riza/.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
Comment on lines +7 to +8
Copy link
Contributor

@coderabbitai coderabbitai bot Jun 16, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Inconsistent indentation style with biome.json.
.editorconfig enforces tabs, whereas biome.json uses spaces (indentStyle: space). Align both configurations to a single indentation strategy to avoid formatting conflicts.

🤖 Prompt for AI Agents
In agents/agent-riza/.editorconfig at lines 7 to 8, the indentation style is set
to tabs, which conflicts with the spaces indentation style defined in
biome.json. To fix this, change the indent_style value from "tab" to "space" and
adjust indent_size accordingly to match biome.json's configuration, ensuring
consistent indentation across both files.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this would be good to have devin fix in template repo

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jhaynie You're absolutely right - fixing this at the template level would prevent this inconsistency from appearing in all future agent projects. It's much better to address the root cause rather than fixing it project by project.

Would you like me to create an issue to track getting this EditorConfig/Biome indentation alignment fixed in the template repository? I can include the specific details about the conflict (tabs vs spaces) and reference this PR for context.

Also, just to make sure I target the right repository - is this referring to an internal Agentuity agent template repo, or should this issue be opened elsewhere?

end_of_line = lf
charset = utf-8
trim_trailing_whitespace = false
insert_final_newline = false
2 changes: 2 additions & 0 deletions agents/agent-riza/.env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# You can obtain this from riza.io.
RIZA_API_KEY=riza_abc123
39 changes: 39 additions & 0 deletions agents/agent-riza/.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
Comment on lines +13 to +15
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Typo in log file ignore pattern.
The entry _.log only matches filenames starting with an underscore. It should be *.log to ignore all .log files.

Apply this diff:

- logs
- _.log
+ logs
+ *.log
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
logs
_.log
report.[0-9]_.[0-9]_.[0-9]_.[0-9]_.json
logs
*.log
report.[0-9]_.[0-9]_.[0-9]_.[0-9]_.json
🤖 Prompt for AI Agents
In agents/agent-riza/.gitignore around lines 13 to 15, the pattern `_.log`
incorrectly matches only files starting with an underscore. Replace `_.log` with
`*.log` to correctly ignore all files ending with the `.log` extension.


# 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
46 changes: 46 additions & 0 deletions agents/agent-riza/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# Agentuity with Riza Example

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

This project showcases how you can execute code generated by LLMs with Riza.
This example uses the Anthropic SDK with tool calling.

## Implementation Details

### Tool Configuration

The agent configures Claude (via Anthropic SDK) with a code execution tool that supports:

- Python
- JavaScript
- Ruby
- PHP
- TypeScript

### Code Execution Flow

1. The agent receives a text prompt from the user
2. Claude processes the prompt and may respond with:
- Regular text responses
- Code execution requests
3. For code execution requests, Riza:
- Runs the code in a secure environment
- Returns both stdout or stderr (if applicable)

## Getting Started

To run this example locally,

1. Clone this repository.
2. Make sure you have installed the Agentuity CLI (`curl -fsS https://agentuity.sh | sh`)
3. Run `agentuity project import` to import the project into your Agentuity account.
4. Sign up for Riza and create an API key. Then you can put it in your `.env` file (match formatting in `.env.example`.)
4. Run `agentuity dev` to start the local development server.
Comment on lines +37 to +38
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Correct duplicate step numbering.

Steps 4 and 4 under "Getting Started" should be renumbered sequentially to maintain clarity.

🤖 Prompt for AI Agents
In agents/agent-riza/README.md around lines 37 to 38, the steps under "Getting
Started" have duplicate numbering for step 4. Renumber the second step 4 to step
5 to ensure the steps are sequential and clear.


To deploy this example, use the button above!

## Dependencies

- `@agentuity/sdk`
- `@anthropic-ai/sdk`
- `@riza-io/api`
69 changes: 69 additions & 0 deletions agents/agent-riza/agentuity.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
# 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.148'
# The ID of the project which is automatically generated
project_id: proj_54a1bf7abe4c64ca51ac01bdd0498328
# The name of the project which is editable
name: agent-riza2
# The description of the project which is editable
description: ""
# 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/**
Comment on lines +61 to +63
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Bundler ignore pattern excludes source directory.

The ignore list includes src/**, which would omit your agent code from the bundle. Remove or narrow this pattern so src/agents is not ignored.

🤖 Prompt for AI Agents
In agents/agent-riza/agentuity.yaml around lines 61 to 63, the ignore pattern
includes 'src/**', which excludes the entire source directory including your
agent code from the bundle. Modify the ignore list to remove 'src/**' or replace
it with a more specific pattern that excludes unwanted files but keeps
'src/agents' included, ensuring your agent code is bundled correctly.

# The agents that are part of this project
agents:
- # The ID of the Agent which is automatically generated
id: agent_c570eb8eb5ba873fee56087b4498fa51
# The name of the Agent which is editable
name: agent-riza
Comment on lines +65 to +69
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Inconsistent agent naming.

The agent is listed as agent-riza here while the project is named agent-riza2. Ensure naming is consistent across package.json, agentuity.yaml, and directory structure to avoid deployment conflicts.

🤖 Prompt for AI Agents
In agents/agent-riza/agentuity.yaml around lines 65 to 69, the agent name is set
as "agent-riza" which is inconsistent with the project name "agent-riza2".
Update the agent name in this file to "agent-riza2" to match the project name
and ensure consistency with package.json and the directory structure to prevent
deployment conflicts.

27 changes: 27 additions & 0 deletions agents/agent-riza/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