Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Re-arch hello world #3969

Merged
merged 163 commits into from
Jul 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
163 commits
Select commit Hold shift + click to select a range
d3462ae
Setup new library and testing directory structure for application core
collijk May 2, 2023
516e950
proposed abstract Configuration class definition (#3805)
dwrtz May 5, 2023
9304528
Update Planner Interface (#3790)
rihp May 5, 2023
434230f
Set up the workspace base class (#3795)
collijk May 5, 2023
7bcdc5f
Add language model base and work out interactions with planning manag…
collijk May 7, 2023
3e81d22
Rearch: logging interface (#3853)
rihp May 7, 2023
3180641
Updated docstrings for consistency and conciseness
collijk May 7, 2023
2afe06a
Initial base.py for message broker agent-state-encapsulation (#3831)
rihp May 7, 2023
bd67082
Checkpoint
collijk May 7, 2023
57c4c30
Finish sketching out rough application loop
collijk May 7, 2023
b203de7
re-arch: Initial BudgetManager impl (#3919)
richbeales May 7, 2023
6017090
Command Base Class Interface (#3824)
DarylRodrigo May 7, 2023
3c3d420
Merge branch 'agent-state-encapsulation' of github.com:Significant-Gr…
collijk May 7, 2023
2a803b0
Revise message broker interface
collijk May 7, 2023
1208e88
Pull in revised message broker
collijk May 7, 2023
5f2d54e
Resolve merge weirdness
collijk May 7, 2023
c47f826
Add emitter
collijk May 8, 2023
6063d80
Add emitter
collijk May 8, 2023
543c637
Merge branch 'revise-message-broker-interface' of github.com:collijk/…
collijk May 8, 2023
87fe2f1
Work out more of the message broker details. In good shape now, I think
collijk May 8, 2023
6d29213
This is the last change for a bit, I think
collijk May 8, 2023
f185833
Merge branch 'revise-message-broker-interface' of github.com:collijk/…
collijk May 8, 2023
989a2e1
Sketch out concrete simple budget manager
collijk May 8, 2023
a7b377b
This is the last change for a bit, I think
collijk May 8, 2023
5f6799d
Checkpoint
collijk May 8, 2023
74170c2
Finish sketching out agent provisioning
collijk May 8, 2023
b55d3ff
Added in a click entry point and status report (#4005)
Swiftyos May 9, 2023
b2ffa0a
Revise message broker interface (#3986)
collijk May 9, 2023
3c45505
Merge in upstream
collijk May 9, 2023
2c20cbf
Re-arch: plugins base (#3995)
ntindle May 9, 2023
31fae50
Merge branch 'agent-state-encapsulation' of github.com:Significant-Gr…
collijk May 9, 2023
be87a5a
Work out provisional plugin interface and think through usage in the …
collijk May 9, 2023
935428b
Sketch out a better client/server relationship with an application se…
collijk May 10, 2023
437b448
More work on app server
collijk May 10, 2023
d00f5eb
Put together basic plugin service
collijk May 10, 2023
646a36d
Revise budget manager to work in hello world application (#4040)
collijk May 10, 2023
c5cec44
Merge branch 'agent-state-encapsulation' of github.com:Significant-Gr…
collijk May 10, 2023
6d71656
Some status updates
collijk May 10, 2023
6f741cb
Sketch out objective prompt implementation
collijk May 10, 2023
8340852
Merge branch 'master' of github.com:Significant-Gravitas/Auto-GPT int…
collijk May 10, 2023
4e5370e
Merge branch 'agent-state-encapsulation' of github.com:Significant-Gr…
collijk May 10, 2023
3156404
Revise the initial implementation of the plugin manager interface to …
collijk May 10, 2023
790b113
Merge in plugin base revisions
collijk May 10, 2023
b871227
Can't set attrs on str
collijk May 10, 2023
645ce95
Respond to feedback
collijk May 11, 2023
411e9ce
Refactor llm subpackage
collijk May 11, 2023
1e0a37e
Merge in upstream
collijk May 11, 2023
e7dea81
Update language model init and status
collijk May 11, 2023
d7d2f0a
UPdate plugins
collijk May 11, 2023
b4190fb
Status note update for plugins after discussion with Nick
collijk May 11, 2023
d52b88a
Add credentials manager
collijk May 11, 2023
3960971
Language model for generating initial prompt
collijk May 11, 2023
0271c2f
Add base abstraction for credentials manager
collijk May 11, 2023
3f08acd
Clean up abstract inits
collijk May 11, 2023
d48bdad
Async def everything so far
collijk May 11, 2023
3b9b3b0
A bunch of clean up and organization
collijk May 12, 2023
997c376
Add chat parsing to language model
collijk May 12, 2023
51c3c1c
Workspace setup
collijk May 12, 2023
48a184e
Finish up bootstrapping loop
collijk May 12, 2023
1a48399
Build contexts for agent and agent factory, started working on agent …
collijk May 12, 2023
4627ee9
Fix broken import
collijk May 12, 2023
5eda16b
Re arch/http server (#4152)
dwrtz May 13, 2023
ed2b299
Re arch/cli stuff (#4154)
dwrtz May 13, 2023
0932090
Figure out right abstraction boundaries for model provider, language/…
collijk May 13, 2023
df58089
update status
collijk May 13, 2023
64bc1c7
Clean up model to use pydantic instead of dataclasses
collijk May 14, 2023
a703418
Add credentials service to plugin manager
collijk May 14, 2023
a87c623
Organize model imports
collijk May 14, 2023
cdab9be
Checkpoint
collijk May 14, 2023
e1a4b03
Formatting
collijk May 14, 2023
bcec593
Swap to pydantic in workspace
collijk May 15, 2023
75d79ef
Set up configuration objects with pydantic
collijk May 15, 2023
250cffa
Swap to pydantic in planner
collijk May 15, 2023
5c68db6
Swap to pydantic in model
collijk May 15, 2023
020ef1a
So much model fiddling, but cleaner lines now
collijk May 15, 2023
ff48d2e
Configuration properties should be system settins
collijk May 15, 2023
8563eea
Rework budget and interaction with providers
collijk May 15, 2023
2cf41fe
Reorganize to make resources a primary concern
collijk May 15, 2023
a27c4e8
Change config to agent settings
collijk May 15, 2023
23a32c2
Okay, back to trying to run through as the main test mechanism
collijk May 15, 2023
233f8ea
Configuration compilation works!
collijk May 15, 2023
1260d72
Export openai settings
collijk May 15, 2023
985f149
Setup cli command to write default settings
collijk May 16, 2023
d99bf40
Create default path and thread through
collijk May 16, 2023
c6238dc
Working up through getting the agent goals
collijk May 16, 2023
6c52744
Figure out how to set some configuration as user configurable and hav…
collijk May 16, 2023
77206ef
Fix credentialing
collijk May 16, 2023
94e2df7
Provision an agent
collijk May 16, 2023
2004c5e
app_lib -> client_lib
collijk May 16, 2023
83ef3f7
Clean up cli_web_app
collijk May 16, 2023
f272de5
webserver stuff working again
collijk May 16, 2023
01925d6
Agent loading successfully!
collijk May 16, 2023
a45850d
Merge branch 'master' of github.com:Significant-Gravitas/Auto-GPT int…
collijk May 16, 2023
99f9d2d
Merge branch 'agent-state-encapsulation' of github.com:Significant-Gr…
collijk May 16, 2023
6693007
Status updates
collijk May 16, 2023
a98ceab
Incorporate the language model into the planner directly
collijk May 17, 2023
d368b43
Formatting
collijk May 17, 2023
e9321b0
Do some work on planning
collijk May 18, 2023
c25414c
Start thinking seriously about commands
collijk May 21, 2023
62ded6a
Merge branch 'master' of github.com:Significant-Gravitas/Auto-GPT int…
collijk May 21, 2023
dfe2d86
Merge branch 'master' of github.com:Significant-Gravitas/Auto-GPT int…
collijk May 21, 2023
32d25ee
Merge branch 'agent-state-encapsulation' of github.com:Significant-Gr…
collijk May 21, 2023
4cc3f22
Merge branch 'master' of github.com:Significant-Gravitas/Auto-GPT int…
collijk May 30, 2023
6859008
Merge branch 'agent-state-encapsulation' of github.com:Significant-Gr…
collijk May 30, 2023
39f2f36
Get system running again
collijk May 30, 2023
b66b8c2
Merge branch 'master' of github.com:collijk/Auto-GPT into agent-state…
collijk Jun 1, 2023
24f241d
Merge branch 'agent-state-encapsulation' of github.com:Significant-Gr…
collijk Jun 1, 2023
4e6abeb
New planning strategies
collijk Jun 17, 2023
b01ede0
Remove bad null byte
collijk Jun 17, 2023
1bf04d0
Start sketching abilities
collijk Jun 17, 2023
2a6733a
Some logging
collijk Jun 17, 2023
276885f
Split up planning strategies
collijk Jun 17, 2023
1ed2136
Show logs
collijk Jun 17, 2023
667291a
Merge branch 'master' of github.com:Significant-Gravitas/Auto-GPT int…
collijk Jun 17, 2023
6601d86
Merge branch 'agent-state-encapsulation' of github.com:Significant-Gr…
collijk Jun 17, 2023
08634a3
Update abilities to use gpt function format
collijk Jun 18, 2023
6334ce8
Remove unused imports
collijk Jun 18, 2023
714f524
Remove dead import
collijk Jun 18, 2023
cc0eb5b
Update credentials and models
collijk Jun 18, 2023
2b72667
Name and goals working with new function calling api
collijk Jun 20, 2023
a53ac06
Merge branch 'master' of github.com:Significant-Gravitas/Auto-GPT int…
collijk Jun 20, 2023
e4b151b
Merge branch 'agent-state-encapsulation' of github.com:Significant-Gr…
collijk Jun 20, 2023
2675fe9
sketch remaining create chat completion command
collijk Jun 20, 2023
afff585
Work through ability registry
collijk Jun 20, 2023
209fa44
Formatting
collijk Jun 20, 2023
e85c211
load abilities into the registry
collijk Jun 20, 2023
09384fd
Work through initial plan
collijk Jun 20, 2023
1ddc335
Parse initial plan into tasks
collijk Jun 20, 2023
e315612
Make task context
collijk Jun 20, 2023
0930121
Up to choose next ability
collijk Jun 21, 2023
561d494
Determine next ability
collijk Jun 21, 2023
4f621aa
Work through task execution
collijk Jun 21, 2023
985399f
Add shape for task evaluation
collijk Jun 21, 2023
8d5a4f0
Update task cycle count
collijk Jun 21, 2023
f54e41c
Update task cycle count
collijk Jun 21, 2023
ca70305
Add ability skeleton to create new abilities
collijk Jun 21, 2023
9463bc1
Merge branch 'master' of github.com:Significant-Gravitas/Auto-GPT int…
collijk Jun 21, 2023
d21e4a6
Merge branch 'agent-state-encapsulation' of github.com:Significant-Gr…
collijk Jun 21, 2023
d184792
[re-arch] Ability: Write File (#4787)
ntindle Jun 24, 2023
ed82cfd
Cleanup
collijk Jul 1, 2023
348e42b
Merge branch 'master' of github.com:Significant-Gravitas/Auto-GPT int…
collijk Jul 1, 2023
ff2cdfd
Merge in upstream
collijk Jul 1, 2023
ca09875
Merge branch 're-arch/hello-world' of github.com:Significant-Gravitas…
collijk Jul 1, 2023
3722eb1
Update existing abilities to return all fields in the AbilityResult (…
collijk Jul 2, 2023
a78b3a3
Simplify model provider credentials
collijk Jul 2, 2023
f111958
Fix bad changes to CI files
collijk Jul 4, 2023
f75c625
Delete unused packages
collijk Jul 4, 2023
55b9ac3
Ditch status code
collijk Jul 4, 2023
68089ca
Formatting
collijk Jul 4, 2023
3a01a4d
Autoflake
collijk Jul 4, 2023
cdb79c5
More formatting
collijk Jul 4, 2023
59ca5b9
Update name to default_settings
collijk Jul 4, 2023
e012a35
Fixes to config usage
collijk Jul 4, 2023
99e71dd
Formatting
collijk Jul 4, 2023
0deb658
Merge branch 'master' into re-arch/hello-world
collijk Jul 4, 2023
cc7ec30
Revert change in message history
collijk Jul 4, 2023
8c74069
Make configurable a generic class
collijk Jul 4, 2023
dd26b9a
Merge branch 're-arch/hello-world' of github.com:Significant-Gravitas…
collijk Jul 4, 2023
66c8947
Formatting
collijk Jul 4, 2023
5958f64
Merge branch 'master' into re-arch/hello-world
collijk Jul 4, 2023
c482fba
Add readme with run instructions
collijk Jul 5, 2023
72e2bc6
Merge branch 're-arch/hello-world' of github.com:Significant-Gravitas…
collijk Jul 5, 2023
81a81ca
Merge branch 'master' into re-arch/hello-world
collijk Jul 5, 2023
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
6 changes: 3 additions & 3 deletions autogpt/config/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ class ConfigBuilder(Configurable[Config]):
else:
default_tts_provider = "gtts"

defaults_settings = Config(
default_settings = Config(
name="Default Server Config",
description="This is a default server configuration",
smart_llm_model="gpt-3.5-turbo",
Expand All @@ -121,7 +121,7 @@ class ConfigBuilder(Configurable[Config]):
skip_news=False,
debug_mode=False,
plugins_dir="plugins",
plugins_config=PluginsConfig({}),
plugins_config=PluginsConfig(plugins={}),
speak_mode=False,
skip_reprompt=False,
allow_downloads=False,
Expand Down Expand Up @@ -165,7 +165,7 @@ class ConfigBuilder(Configurable[Config]):
)

@classmethod
def build_config_from_env(cls):
def build_config_from_env(cls) -> Config:
"""Initialize the Config class"""
config_dict = {
"authorise_key": os.getenv("AUTHORISE_COMMAND_KEY"),
Expand Down
54 changes: 54 additions & 0 deletions autogpt/core/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
# Run instructions

There are two client applications for Auto-GPT included.

## CLI Application

:star2: **This is the reference application I'm working with for now** :star2:

The first app is a straight CLI application. I have not done anything yet to port all the friendly display stuff from the `logger.typewriter_log` logic.

- [Entry Point](https://github.com/Significant-Gravitas/Auto-GPT/blob/master/autogpt/core/runner/cli_app/cli.py)
- [Client Application](https://github.com/Significant-Gravitas/Auto-GPT/blob/master/autogpt/core/runner/cli_app/main.py)

To run, you first need a settings file. Run

```
python REPOSITORY_ROOT/autogpt/core/runner/cli_app/cli.py make-settings
```

where `REPOSITORY_ROOT` is the root of the Auto-GPT repository on your machine. This will write a file called `default_agent_settings.yaml` with all the user-modifiable configuration keys to `~/auto-gpt/default_agent_settings.yml` and make the `auto-gpt` directory in your user directory if it doesn't exist). At a bare minimum, you'll need to set `openai.credentials.api_key` to your OpenAI API Key to run the model.

You can then run Auto-GPT with

```
python REPOSITORY_ROOT/autogpt/core/runner/cli_app/cli.py make-settings
```

to launch the interaction loop.

## CLI Web App

The second app is still a CLI, but it sets up a local webserver that the client application talks to rather than invoking calls to the Agent library code directly. This application is essentially a sketch at this point as the folks who were driving it have had less time (and likely not enough clarity) to proceed.

- [Entry Point](https://github.com/Significant-Gravitas/Auto-GPT/blob/master/autogpt/core/runner/cli_web_app/cli.py)
- [Client Application](https://github.com/Significant-Gravitas/Auto-GPT/blob/master/autogpt/core/runner/cli_web_app/client/client.py)
- [Server API](https://github.com/Significant-Gravitas/Auto-GPT/blob/master/autogpt/core/runner/cli_web_app/server/api.py)

To run, you still need to generate a default configuration. You can do

```
python REPOSITORY_ROOT/autogpt/core/runner/cli_web_app/cli.py make-settings
```

It invokes the same command as the bare CLI app, so follow the instructions above about setting your API key.

To run, do

```
python REPOSITORY_ROOT/autogpt/core/runner/cli_web_app/cli.py client
```

This will launch a webserver and then start the client cli application to communicate with it.

:warning: I am not actively developing this application. It is a very good place to get involved if you have web application design experience and are looking to get involved in the re-arch.
Empty file added autogpt/core/__init__.py
Empty file.
4 changes: 4 additions & 0 deletions autogpt/core/ability/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
"""The command system provides a way to extend the functionality of the AI agent."""
from autogpt.core.ability.base import Ability, AbilityRegistry
from autogpt.core.ability.schema import AbilityResult
from autogpt.core.ability.simple import AbilityRegistrySettings, SimpleAbilityRegistry
92 changes: 92 additions & 0 deletions autogpt/core/ability/base.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
import abc
from pprint import pformat
from typing import ClassVar

import inflection
from pydantic import Field

from autogpt.core.ability.schema import AbilityResult
from autogpt.core.configuration import SystemConfiguration
from autogpt.core.planning.simple import LanguageModelConfiguration


class AbilityConfiguration(SystemConfiguration):
"""Struct for model configuration."""

from autogpt.core.plugin.base import PluginLocation

location: PluginLocation
packages_required: list[str] = Field(default_factory=list)
language_model_required: LanguageModelConfiguration = None
memory_provider_required: bool = False
workspace_required: bool = False


class Ability(abc.ABC):
"""A class representing an agent ability."""

default_configuration: ClassVar[AbilityConfiguration]

@classmethod
def name(cls) -> str:
"""The name of the ability."""
return inflection.underscore(cls.__name__)

@classmethod
@abc.abstractmethod
def description(cls) -> str:
"""A detailed description of what the ability does."""
...

@classmethod
@abc.abstractmethod
def arguments(cls) -> dict:
"""A dict of arguments in standard json schema format."""
...

@classmethod
def required_arguments(cls) -> list[str]:
"""A list of required arguments."""
return []

@abc.abstractmethod
async def __call__(self, *args, **kwargs) -> AbilityResult:
...

def __str__(self) -> str:
return pformat(self.dump)

def dump(self) -> dict:
return {
"name": self.name(),
"description": self.description(),
"parameters": {
"type": "object",
"properties": self.arguments(),
"required": self.required_arguments(),
},
}


class AbilityRegistry(abc.ABC):
@abc.abstractmethod
def register_ability(
self, ability_name: str, ability_configuration: AbilityConfiguration
) -> None:
...

@abc.abstractmethod
def list_abilities(self) -> list[str]:
...

@abc.abstractmethod
def dump_abilities(self) -> list[dict]:
...

@abc.abstractmethod
def get_ability(self, ability_name: str) -> Ability:
...

@abc.abstractmethod
def perform(self, ability_name: str, **kwargs) -> AbilityResult:
...
6 changes: 6 additions & 0 deletions autogpt/core/ability/builtins/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
from autogpt.core.ability.builtins.create_new_ability import CreateNewAbility
from autogpt.core.ability.builtins.query_language_model import QueryLanguageModel

BUILTIN_ABILITIES = {
QueryLanguageModel.name(): QueryLanguageModel,
}
102 changes: 102 additions & 0 deletions autogpt/core/ability/builtins/create_new_ability.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
import logging

from autogpt.core.ability.base import Ability, AbilityConfiguration
from autogpt.core.ability.schema import AbilityResult
from autogpt.core.plugin.simple import PluginLocation, PluginStorageFormat


class CreateNewAbility(Ability):
default_configuration = AbilityConfiguration(
location=PluginLocation(
storage_format=PluginStorageFormat.INSTALLED_PACKAGE,
storage_route="autogpt.core.ability.builtins.CreateNewAbility",
),
)

def __init__(
self,
logger: logging.Logger,
configuration: AbilityConfiguration,
):
self._logger = logger
self._configuration = configuration

@classmethod
def description(cls) -> str:
return "Create a new ability by writing python code."

@classmethod
def arguments(cls) -> dict:
return {
"ability_name": {
"type": "string",
"description": "A meaningful and concise name for the new ability.",
},
"description": {
"type": "string",
"description": "A detailed description of the ability and its uses, including any limitations.",
},
"arguments": {
"type": "array",
"items": {
"type": "object",
"properties": {
"name": {
"type": "string",
"description": "The name of the argument.",
},
"type": {
"type": "string",
"description": "The type of the argument. Must be a standard json schema type.",
},
"description": {
"type": "string",
"description": "A detailed description of the argument and its uses.",
},
},
},
"description": "A list of arguments that the ability will accept.",
},
"required_arguments": {
"type": "array",
"items": {
"type": "string",
"description": "The names of the arguments that are required.",
},
"description": "A list of the names of the arguments that are required.",
},
"package_requirements": {
"type": "array",
"items": {
"type": "string",
"description": "The of the Python package that is required to execute the ability.",
},
"description": "A list of the names of the Python packages that are required to execute the ability.",
},
"code": {
"type": "string",
"description": "The Python code that will be executed when the ability is called.",
},
}

@classmethod
def required_arguments(cls) -> list[str]:
return [
"ability_name",
"description",
"arguments",
"required_arguments",
"package_requirements",
"code",
]

async def __call__(
self,
ability_name: str,
description: str,
arguments: list[dict],
required_arguments: list[str],
package_requirements: list[str],
code: str,
) -> AbilityResult:
raise NotImplementedError
Loading