Skip to content

Commit

Permalink
Agents
Browse files Browse the repository at this point in the history
  • Loading branch information
awhiteside1 committed Sep 26, 2024
1 parent 68e0d41 commit 1465a85
Show file tree
Hide file tree
Showing 35 changed files with 1,459 additions and 262 deletions.
101 changes: 63 additions & 38 deletions packages/agents/docs/agents/agents.md
Original file line number Diff line number Diff line change
@@ -1,66 +1,91 @@
Task Interface
# Agents

```ts
import { Schema } from "@effect/schema"
An Agent is responsible for processing Tasks, and specializes in certain kinds of tasks.

interface Task{


summary: string
acceptanceCriteria: string[]
format: Schema

parent: Task



}
There are different kinds of Agents:


| Kind | Purpose | Examples |
|-----------|-------------------------------------------|----------------------------------------|
| Execution | Perform concrete, well defined tasks. | Web Search, Writer, Coder |
| Reasoning | Refines complex tasks into smaller tasks. | Intent Refiner, Solution Planner |
| Experts | Able to resolve domain specific details. | Marketing Expert, Data Modeling Expert |
| Directors | Orchestrate and monitor tasks and agents. | Task Assigner, Metric Monitor, |

```

## Creating Agents

Agent Interface
### Typescript classes

```ts
Agents can be created by extending the `Agent` class and implementing the necessary methods. These classes can then be registered with the runtime.


```ts

interface Agent{

assign(task:Task){

}
class WikipediaAgent extends ExecutionAgent {

name = "Wikipedia";
description = "Searches Wikipedia for a given term";
prompt = "You are an expert wikipedia searcher who helps.....";

override async process(task: Task): Promise<TaskResult> {
return super.process(task);
}

async search(query: string): Promise<string> {
const url = `https://wikipedia.com/wiki/${snake(query)}`;
const response = await fetch(url);
if (response.ok) {
const contents = await response.text();
const startingPoint = contents.search("mw-content-text");
return conents.substring(startingPoint);
}
throw new Error(response.statusText);
}

}


```


```ts
const runtime = new AgentRuntime();
runtime.registerAgents([WikipediaAgent]);
```

Status
### YAML Manifests

```ts
Agents can be declared as YAML files, making them easy to create for end users or LLMs.

```yaml
kind: Agent
name: Wikipedia
skills:
- Query wikipedia for background

interface {
prompt: |
You are an expert wikipedia searcher who helps perform background research. Ground your responses based on the results of the search tool. Do not make anything up. If the search returns a disambiguation page, extract the term from the page and search again.
tools:
- name: search
parameters:
- query:
- type: string
description: The slug to query wikipedia for
source:
type: generate
prompt: Use the `query` parameter to construct a wikipedia url in the format `https://en.wikipedia.org/wiki/{query}`. Make sure to replace the spaces with underscores so it's URL Safe. Then fetch the html of that page. Return the contents of the div with id "mw-content-text".


model:
class: 'highest'
settings:
temperature: 0

}
```

interface AgentStatus {
class: "execution" | "reasoner" | "director";
available: boolean;
invocations: number;
failRate: number;
p95: number;
}

interface SystemStatus {
agents: AgentStatus[];


}

```
22 changes: 22 additions & 0 deletions packages/agents/docs/agents/directors/communicator.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Communicator Agent

This agent is responsible for drafting messages to be sent to the user based on details defined in the task.

## Use Cases

### Responding to Questions

### Asking for clarifications

## Responding
1. Ensures response lines up with question
2. Provides answer, then quick summary of activities to get it.
3. Provides Citations

## Protocol

Messages are formatted in markdown, with several custom directives available.

### Choices UI

If we need the user to choose between options, we can use the markdown directive `[button label="More" variant="outline"](https://)`
15 changes: 15 additions & 0 deletions packages/agents/docs/agents/directors/process-monitor.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Process Monitor

The process monitor tracks metrics relating to Agents, Tasks, and timing.

## Monitoring

Task Objects fire events on creation, assignment, and completion. Appends to a DuckDB table.

## Rabbit Holes

If a task produces many subtasks, or is cycling, this agent will force the task to return or terminate it.

## User Activity

If a task is expected to require multiple subtasks or is complex, the process monitor will issue new tasks to update the 'thinking' text to reflect what activity is occurring based on task assignment events.
12 changes: 12 additions & 0 deletions packages/agents/docs/agents/directors/task-assigner.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Task Assigner Agent

This agent inspects a submitted task, and selects from the list of registered agents the one most appropriate. That agent is then assigned the task.

## Details

### Reassignment
If the model rejects the task, times out or fails to complete the task, the Task Assigner may re-assign it to another Agent.

### Gibberish
If the task is nonsense or malformed, the agent can create a new task to respond to the user generically and assign the task to the Communication Agent.

13 changes: 13 additions & 0 deletions packages/agents/docs/agents/execution/browser_agent.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Browser Agent

## Description
The Browser Agent is responsible for automating web browsing tasks. It can navigate to websites, interact with forms, click buttons, and extract data from web pages.

## Tools
- **Navigate to URL**: Opens a web page and interacts with it.
- **Form Interaction**: Fills out forms and submits data.

## Use Cases
- Automating interactions with web-based dashboards.
- Extracting data from forms or login-restricted content.
- Performing repetitive browsing tasks like checking page updates.
12 changes: 12 additions & 0 deletions packages/agents/docs/agents/execution/cms_agent.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# CMS Agent

## Description
The CMS Agent interacts with Content Management Systems (CMS) to manage and manipulate content. This agent can create, update, delete, or retrieve content from popular CMS platforms.

## Tools
- **Manage CMS Content**: Interacts with CMS systems to handle content changes.

## Use Cases
- Automating content updates in a CMS.
- Fetching and displaying specific content from a CMS.
- Managing large amounts of content across multiple platforms.
1 change: 1 addition & 0 deletions packages/agents/docs/agents/execution/code_agent.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Code Agent
12 changes: 12 additions & 0 deletions packages/agents/docs/agents/execution/crawl_agent.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Crawl Agent

## Description
The Crawl Agent is designed to scrape and crawl through websites to gather data. This agent can handle paginated websites and scrape specific content from HTML pages.

## Tools
- **Web Scraper**: Extracts content from a webpage based on defined selectors.

## Use Cases
- Gathering data for research purposes from a list of websites.
- Crawling e-commerce sites to collect product data.
- Monitoring changes on web pages.
1 change: 1 addition & 0 deletions packages/agents/docs/agents/execution/diagram_agent.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Diagram Agent
12 changes: 12 additions & 0 deletions packages/agents/docs/agents/execution/execution_agent_builder.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Execution Agent Builder

## Description
The Execution Agent Builder creates customized execution agents that perform concrete tasks. These agents are specialized in task completion, with a strong focus on well-defined objectives.

## Tools
- **Task Executor**: Executes tasks based on predefined steps.

## Use Cases
- Creating tailored agents for specific operational tasks.
- Automating repeated workflows.
- Performing scheduled, recurring tasks across systems.
1 change: 1 addition & 0 deletions packages/agents/docs/agents/execution/extractor_agent.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Extractor Agent
12 changes: 12 additions & 0 deletions packages/agents/docs/agents/execution/image_creator.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Image Creator

## Description
The Image Creator Agent generates images based on text descriptions. This agent can create realistic or abstract images using AI image generation models.

## Tools
- **Image Generator**: Creates images from textual prompts.

## Use Cases
- Generating illustrations or concepts for design purposes.
- Producing visuals for marketing campaigns.
- Crafting concept art or visual prototypes.
12 changes: 12 additions & 0 deletions packages/agents/docs/agents/execution/rest_agent.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# REST Agent

## Description
The REST Agent specializes in interacting with RESTful APIs. It can make GET, POST, PUT, DELETE, and other requests, and handle the responses effectively.

## Tools
- **Send API Request**: Makes API calls based on the request method and parameters.

## Use Cases
- Integrating with third-party services via APIs.
- Retrieving or updating data through web services.
- Automating API interactions for testing or data collection.
12 changes: 12 additions & 0 deletions packages/agents/docs/agents/execution/shell_agent.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Shell Agent

## Description
The Shell Agent can execute shell commands on a local or remote system. It interacts with the operating system through the command line, allowing it to manage files, processes, and system configurations.

## Tools
- **Execute Shell Command**: Runs shell commands and retrieves their output.

## Use Cases
- Running maintenance or deployment scripts.
- Monitoring system resource usage or log files.
- Automating repetitive terminal tasks.
12 changes: 12 additions & 0 deletions packages/agents/docs/agents/execution/sourcegraph_agent.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# SourceGraph Agent

## Description
The SourceGraph Agent is specialized in searching and understanding large codebases. It uses SourceGraph's API to locate code snippets, classes, functions, and comments within repositories.

## Tools
- **Code Search**: Search for code snippets, classes, or documentation across repositories.

## Use Cases
- Locating specific code implementations across various repositories.
- Understanding the context of a function or class within large codebases.
- Navigating and indexing complex projects for analysis or refactoring.
12 changes: 12 additions & 0 deletions packages/agents/docs/agents/execution/sql_agent.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# SQL Agent

## Description
The SQL Agent specializes in interacting with databases to perform SQL queries. This agent is capable of retrieving data, updating records, and performing complex data manipulations through SQL statements.

## Tools
- **Execute SQL**: Executes a provided SQL query against a database.

## Use Cases
- Querying large datasets for specific metrics.
- Performing data aggregations and transformations.
- Managing and updating database records efficiently.
12 changes: 12 additions & 0 deletions packages/agents/docs/agents/execution/web_search_agent.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Web Search Agent

## Description
The Web Search Agent performs internet searches using a query. This agent is designed to find information and retrieve relevant links or summaries based on the search results.

## Tools
- **Search**: Queries the web and returns the most relevant results.

## Use Cases
- Researching a topic or gathering information from the web.
- Finding references, documentation, or tutorials.
- Monitoring search results for specific keywords.
64 changes: 0 additions & 64 deletions packages/agents/docs/agents/impl.md

This file was deleted.

Loading

0 comments on commit 1465a85

Please sign in to comment.