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

feat(rnd): AutoGPT Agent wrapper for Agent Server #7365

Merged
merged 17 commits into from
Jul 13, 2024

Conversation

kcze
Copy link
Contributor

@kcze kcze commented Jul 10, 2024

Changes 🏗️

Add AutoGPT Agent wrapper block for the Agent Server that allows running a temporary agent with full AutoGPT capabilities. You can limit components and commands it has access to, specify task and input data.

  • Add autogpt and forge dependency to the autogpt_server
  • Add AutoGPTAgentBlock that initializes and runs a single agent loop on execution
  • Add BlockAgent that inherits from autogpt Agent and is a thin extension on the agent that allows to disable components
  • Add OutputComponent that adds output command for the agent

PR Quality Scorecard ✨

  • Have you used the PR description template?   +2 pts
  • Is your pull request atomic, focusing on a single change?   +5 pts
  • Have you linked the GitHub issue(s) that this PR addresses?   +5 pts
  • Have you documented your changes clearly and comprehensively?   +5 pts
  • Have you changed or added a feature?   -4 pts
    • Have you added/updated corresponding documentation?   +4 pts
    • Have you added/updated corresponding integration tests?   +5 pts
  • Have you changed the behavior of AutoGPT?   -5 pts
    • Have you also run agbenchmark to verify that these changes do not regress performance?   +10 pts

@kcze kcze requested a review from a team as a code owner July 10, 2024 15:07
@kcze kcze requested review from ntindle and majdyz and removed request for a team July 10, 2024 15:07
Copy link

netlify bot commented Jul 10, 2024

Deploy Preview for auto-gpt-docs ready!

Name Link
🔨 Latest commit f1eff55
🔍 Latest deploy log https://app.netlify.com/sites/auto-gpt-docs/deploys/66926407e5de690009b7f4fd
😎 Deploy Preview https://deploy-preview-7365--auto-gpt-docs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Comment on lines +177 to +181
include_os_info = (
self.code_executor.config.execute_local_commands
if hasattr(self, "code_executor")
else False
)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Without this it throws errors when code_executor is removed.

@@ -33,6 +33,7 @@ gTTS = "^2.3.1"
jinja2 = "^3.1.2"
jsonschema = "*"
litellm = "^1.17.9"
numpy = ">=1.26.0,<2.0.0"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Incompatible dependencies when using ^2

Comment on lines 31 to 32
class BlockAgentSettings(AgentSettings):
disabled_components: list[str] = Field(default_factory=list)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

If we move this to autogpt AgentSettings then I think we can remove BlockAgent

Copy link

codecov bot commented Jul 10, 2024

Codecov Report

Attention: Patch coverage is 0% with 1 line in your changes missing coverage. Please review.

Project coverage is 54.20%. Comparing base (bffb92b) to head (f1eff55).
Report is 3 commits behind head on master.

Files Patch % Lines
autogpt/autogpt/agents/agent.py 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #7365      +/-   ##
==========================================
- Coverage   54.21%   54.20%   -0.01%     
==========================================
  Files         122      122              
  Lines        6875     6876       +1     
  Branches      881      881              
==========================================
  Hits         3727     3727              
- Misses       3015     3016       +1     
  Partials      133      133              
Flag Coverage Δ
Linux 53.95% <0.00%> (-0.01%) ⬇️
Windows 54.53% <ø> (+3.79%) ⬆️
autogpt-agent 33.99% <0.00%> (-0.03%) ⬇️
forge 58.63% <ø> (ø)
macOS 53.25% <0.00%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@kcze kcze requested review from Pwuts and removed request for ntindle July 10, 2024 15:14
@kcze kcze requested a review from a team as a code owner July 12, 2024 11:52
majdyz
majdyz previously approved these changes Jul 12, 2024
@@ -1,5 +1,6 @@
from autogpt_server.blocks import sample, reddit, text, ai, wikipedia, discord
from autogpt_server.data.block import Block
from autogpt_server.data.agent_block import AutoGPTAgentBlock
Copy link
Contributor

Choose a reason for hiding this comment

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

from autogpt_server.data import agent_block and add agent_block to all ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I moved agent_block.py to blocks/agent.py and added agent module to __all__

class Input(BlockSchema):
task: str
input: str
disabled_components: list[str] = Field(default_factory=list)
Copy link
Contributor

Choose a reason for hiding this comment

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

Is it easier to exclude than to include ?
If I want to execute the agent with only two tools, how many entries should I add here ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

For now it's be better to have enabled_componets, I updated it. However, SystemComponent is force-enabled because agent may not work well without it.

input: str
disabled_components: list[str] = Field(default_factory=list)
disabled_commands: list[str] = Field(default_factory=list)
fast_mode: bool = False
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we also pass the api_key here?
Same thing as:
https://github.com/Significant-Gravitas/AutoGPT/pull/7373/files#diff-8bc0ec9590a3208160360ef6789128eae490a405fa67349418d414dd0f2c4261R19

it will autoload it from env with the key OPENAI_API_KEY

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

@ntindle
Copy link
Member

ntindle commented Jul 12, 2024

Failure "fixed" by actions/toolkit#1723 and caused by actions/upload-artifact#485

@Torantulino
Copy link
Member

Torantulino commented Jul 12, 2024

If we have a choice @kcze then I much prefer better results slower (better LLM) than worse results quickly (fast LLM) by default.

@kcze
Copy link
Contributor Author

kcze commented Jul 12, 2024

If we have a choice @kcze then I much prefer better results slower (better LLM) than worse results quickly (fast LLM) by default.

There's a switch on the block now :) I just made it fast for the test, it's smart by default for the block.

@kcze kcze requested a review from majdyz July 13, 2024 11:27
@kcze kcze merged commit 6550bdc into master Jul 13, 2024
31 of 37 checks passed
@kcze kcze deleted the kpczerwinski/open-1186-agent-wrapper branch July 13, 2024 18:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

4 participants