Commit Graph

20 Commits

Author SHA1 Message Date
Nicholas Tindle
785a40ff9d feat(server, autogpt): Add Example files and update build option (#7271) 2024-06-27 09:56:21 -05:00
Zamil Majdy
2bc22c5450 feat(rnd): Add support for dynamic input as list for AgentServer Block (#7268)
On AgentServer, To create a Block like StringFormatterBlock or LllmCallBlock, we need some way to dynamically link input pins and aggregate them into a single list input. This will give a better experience for the user to construct an input and link it from the output of the other nodes. The scope of this change is adding support for that in the least intrusive way.

Proposal
To differentiate the input list name and its singular entry we are using the $_<index> prefix. For example:
For the input items: list[int], you can set a pin items with values like [1,2,3,4]. But you can also add input pins like items_$_0 or items_$_4 with values 1 or 2, which will be appended to the items input in alphabetical order.
The execution engine will guarantee to wait for the execution until all the input pin value is produced, so input pin with list input will produce fix-sized list.
2024-06-27 21:51:34 +07:00
Krzysztof Czerwinski
6e1c9d44a4 Update Agent Server README.md 2024-06-26 19:41:12 +02:00
Zamil Majdy
26bcb26bb7 feat(rnd): Refactor AgentServer Node Input/Output Relation & Block output interface (#7231)
### Background

The current implementation of AgentServer doesn't allow for a single pin to be connected to multiple nodes, this will be problematic when you have a single output node that needs to be propagated into many nodes. Or multiple nodes that possibly feed the data into a single pin (first come first serve).

This infra change is also part of the preparation for changing the `block` interface to return a stream of output instead of a single output.  Treating blocks as streams requires this capability.

### Changes 🏗️

* Update block run interface from returning `(output_name, output_data)` to `Generator[(output_name, output_data)]`
* Removed `agent` term in the API, replace it with `graph` for consistency.
* Reintroduced `AgentNodeExecutionInputOutput`. `AgentNodeExecution` input & output will be a list of `AgentNodeExecutionInputOutput` which describes the input & output data of its execution. Making an execution has 1-many relation to its input output data.
* Propagating the relation and block interface change into the execution engine.
2024-06-26 12:41:55 +02:00
Zamil Majdy
9f1e521857 feat(rnd): Add AutoGPT server scheduling service (#7226)
### Background

Agent execution should be able to be triggered in a recurring manner.
This PR introduced an ExecutionScheduling service, a process responsible for managing the execution schedule and triggering its execution based on a predefined cron expression.

### Changes 🏗️

* Added `scheduler.py` / `ExecutionScheduler` implementation.
* Added scheduler test.
* Added `AgentExecutionSchedule` table and its logical model & prisma queries.
* Moved `add_execution` from API server to `execution_manager`
2024-06-24 09:41:02 +07:00
Zamil Majdy
d9226888b2 feat(rnd): Add node metadata on Agent Server Node object (#7237) 2024-06-21 17:50:50 +01:00
Zamil Majdy
210d7738b9 feat(rnd): Add IPC support on autogpt_server (#7212)
### Background

This PR adds support on IPC on autogpt_server.
To make this happen, there are a couple of refactoring efforts being made (will be described in the `Changes` section).
Currently, there are three independent processes:

```
AgentServer ----> ExecutionManager
    | 
     --> ExecutionScheduler
```


### Changes 🏗️

* Added Pyro5 for IPC support.
* Introduced `AppService`: a class to construct an independent process that can expose a method to other running processes (this is analogous to a microservice).
* Introduced `AppProcess`: used by `AppService` a class for creating a child process that can be executed in the background.
* Adapting existing codebase to user `AppService`.
2024-06-19 22:49:47 +07:00
Nicholas Tindle
8f3ed733b9 chore(rnd): Fix warning during server tests (#7213) 2024-06-14 06:56:53 -05:00
Nicholas Tindle
6ec708c771 ci(server): Agent Server CI (#7193) 2024-06-12 00:29:23 +07:00
Zamil Majdy
af3febd79f feat(rnd): Add missing code on execution logic for AutoGPT Server (#7209)
Add missing changes from previous commit
2024-06-11 16:15:52 +02:00
SwiftyOS
60e0d4c530 fix(rnd): fixed cli repeated star cmd quality of life 2024-06-11 13:10:53 +02:00
SwiftyOS
4aeae53a61 fixed typo 2024-06-11 12:29:13 +02:00
SwiftyOS
d5c4eca739 Check if pid exists 2024-06-11 12:27:19 +02:00
Swifty
fd18877dae feat(rnd): CLI to Run and Stop the Server (#7195) 2024-06-11 11:21:34 +02:00
Zamil Majdy
e688cc31f0 feat(rnd): Implement agent block execution logic for AutoGPT Server (#7194)
### Background

This PR implements the main logic of the block execution engine for AutoGPT-Server.
An integration test is added to test the behavior.

*What you can do now with this PR*:
You can manually create a graph, by using the existing blocks as nodes (or write your own). Then execute the graph with an input.

*What you can't do yet*:
Listen to the graph execution result/update (you can follow the `AgentNodeExecution` table result, though).

### Changes 🏗️
* Split `data.py` (model file) into three modules:
    * `execution`: a model for node execution.
    * `graph`: a model for graph structure.
    * `block`: a model for agent block/component.
* Implemented executor main logic
* Simplify db structure:
    * Remove `AgentBlockInputOutput` in favor of `inputSchema` & `outputSchema` using serialized json/dict structure.
    * Remove `id` on `AgentBlock` in favor of using name (class name of the block) as its identifier.
    * Added `constantInput` column for `AgentNode` for hard-coded input/block configuration. Hence, removing`executionStateData` on `AgentNodeExecution`.
    * Rename AgentNodeLink input/output to source/sink to avoid confusion
* Change multithreading to multiprocessing, to allow the use of multiple `prisma` asynchronous client.
2024-06-10 19:30:34 +07:00
Swifty
39084192ff fix(agent server): Update file layout for autogpt server (#7190) 2024-06-05 12:53:54 +02:00
Nicholas Tindle
23dfdad454 feat(autogpt,autogpt_server): Build AutoGPT's Constituent Parts for deployment (#7188) 2024-06-05 12:14:08 +07:00
Zamil Majdy
4de0fd8cbd feat(db): Initialize Database Schema for AutoGPT server (#7168)
### Background

Introduced initial database schema for AutoGPT server.
It currently consists of 7 tables:

* `AgentGraph`: This model describes the Agent Graph/Flow (Multi Agent System).
    * `AgentNode`: This model describes a single node in the Agent Graph/Flow (Multi Agent System).
        * `AgentNodeLink`: This model describes the link between two AgentNodes.
        * `AgentNodeExecution`: This model describes the execution of an AgentNode.
* `AgentBlock`: This model describes a component that will be executed by the AgentNode (all the details required, like name, code, input/output).
    * `AgentBlockInputOutput`: This model describes the output (produced event) or input (consumed event) of an AgentBlock.
* `FileDefinition`: This model describe a file that can be used as input/output of an AgentNodeExecution.

### Changes 🏗️

* Add Prisma
* Add sqlite3
* Initialize database.
2024-06-05 12:09:58 +07:00
Swifty
e3a5663a05 fix(agent server): Updated function names and type checking (#7185)
* fix agent server

* renamed functions

* simplified dir naming
2024-06-04 11:02:38 +02:00
Zamil Majdy
7a932cdf00 feat(rnd): add FastAPI support to existing project outline (#7165)
### Background

###### Project Outline
Currently, the project mainly consists of these components:

*agent_api*
A component that will expose API endpoints for the creation & execution of agents.
This component will make connections to the database to persist and read the agents.
It will also trigger the agent execution by pushing its execution request to the ExecutionQueue.

*agent_executor*
A component that will execute the agents.
This component will be a pool of processes/threads that will consume the ExecutionQueue and execute the agent accordingly. 
The result and progress of its execution will be persisted in the database.

###### How to test
Execute `poetry run app`. 
Access the swagger page `http://localhost:8000/docs`, there is one API to trigger an execution of one dummy slow task, you fire the API a couple of times and see the `agent_executor` executes the multiple slow tasks concurrently by the pool of Python processes.
The pool size is currently set to `5` (hardcoded in app.py, the code entry point).

##### Changes 🏗️

* Initialize FastAPI for the AutoGPT server project.
* Reduced number of queues to 1 and abstracted into `ExecutionQueue` class.
* Reduced the number of main components into two `api` and `executor`.
2024-06-02 23:39:01 -05:00