GithubHelp home page GithubHelp logo

Comments (4)

nalbion avatar nalbion commented on August 17, 2024

This API also fits well with my StoryManager concept illustrated in #83

from gpt-pilot.

nalbion avatar nalbion commented on August 17, 2024

There's only a partial alignment with the current naming:

GPT PilotAgent Protocol
db.model.UserStoriesTask
project.user_stories
{app_id}-{i} or {app_id}#{jira/github issue}task_id
story titleinput
app_id, user_id, sprintadditional_input
steps
artifacts
db.model.DevelopmentStepsStep
(just used for replaying?)
as abovetask_id
idstep_id
is_last
messages (role=user)?input
previous_step?additional_input
name
status: created/completed
messages (role=assistant)?output
llm_responseadditional_output
llm_response.function_calls (type=code_change) (not c_c_description?)artifacts
artifacts[0].artifact_id
nameartifacts[0].file_name
pathartifacts[0].relative_path
content
db.model.FileArtifact
{app_id}-idartifact_id
namefile_name
pathrelative_path
full_path
description
app

from gpt-pilot.

nalbion avatar nalbion commented on August 17, 2024

For maximum compatibility & seamless interaction with arbitrary clients (IDE plugins, web UIs, CLI tools...) the endpoints should make minimal assumptions about how they will be called, other than what is strictly described in the Agent Protocol spec.

My interpretation is that a Task is simply a container for the client to add Steps which are a mechanism to interact between the user and AI.

additional_input can be used for GPT Pilot specific args, config, options etc, but should work with defaults.

Use case: New Project

POST /agent/tasks
{
   "input": "chat app"
   "additional_input": {}
}

Response:

{
  "task_id": "chat_app", 
  "artifacts": []
}

Use case: "TestWriteFile" benchmark

POST /agent/tasks/chat_app/steps
{
   "input": "Write the word 'Washington' to a .txt file"
}

Response:

{
  "task_id": "chat_app", 
  "step_id": "1",
  "name": "Implement code change",
  "status": "created",
  "output": "File `washington.txt` saved to the disk and currently looks like this:\n```\nWashington\n```",
  "additional_output": {},

  "artifacts": [{
    "artifact_id": "1",
    "agent_created": true,
    "file_name": "washington.txt",
    "relative_path": ""
  }]
  "is_last": true,
}

Use case: "Project description for a non-trivial app"

POST /agent/tasks/chat_app/steps
{
   "input": "A simple chat app with real time communication"
}

Response:

{
  "task_id": "chat_app", 
  "step_id": "1",
  "name": "Project clarification",
  "status": "running or completed?",
  "output": "Should the chat app support chat groups as well as one-to-one messaging?",
  "additional_output": {},
  "artifacts": []
  "is_last": false,
}

The conversation continues using POST /agent/tasks/chat_app/steps { "input": prompt } -> { "output": Pilot/LLM response/question }

UserStory and DevelopmentStep

...so contrary to what I've said above, the Task is the App and every user interaction is a Step. So how can we work with Epic, Sprint, Story and DevelopmentStep?

Use case: User suggests New Feature as first prompt

POST /agent/tasks/chat_app/steps
{
  "input": "Users should be sent a notification when they are tagged in a chat message",
  "additional_input": {
  },
}

{ "name": "FeatureClarification",

Use case: Schedule sync with Jira/GitHub Issues

For this use case it's acceptable to assume the client has knowledge of additional_input.

POST /agent/tasks
{
  "input": "Implement Agent Protocol",
  "additional_input": {
    "task_type": "UserStory",
    "app_id": "chat_app",
    "issue": "89",
    "description": "As a 3rd party developer I want to be able to Interact with Pilot Agent from an API so that users can use the agent from their IDE etc",
    "comments": [{ "user": "saltman", "message": "Yeah, great idea!" }],
    "labels": ["gpt-pilot"],
    "milestone": ""
  },
}

The TechLead may use the artifacts to list BDD scenarios that have been written , or maybe list DevelopmentSteps?

Response:

{
  "task_id": "chat_app#89",
  "artifacts": [{
    "artifact_id": "chat_app#89-1",
    "agent_created": true,
    "file_name": "scenario-1.feature",
    "relative_path": "features/89-Implement_Agent_Protocol"
  }]
}

Use case: SprintManager dispatches UserStory to Developer

NOTE it would be possible to have multiple Developers distributed in separate processes/machines.

GET /agent/tasks?app_id=chat_app&sprint=1&include=steps&label=gpt-pilot

Could also ask to include artifacts, but that is probably more useful when testing.

Response:

[{
  "task_id": "chat_app#89",
  "input": "Implement Agent Protocol",
  "additional_input": {
    "task_type": "UserStory",
    "app_id": "chat_app",
    "issue": "89",
    "description": "As a 3rd party developer I want to be able to Interact with Pilot Agent from an API so that users can use the agent from their IDE etc",
    "comments": [{ "user": "saltman", "message": "Yeah, great idea!" }]
  },
  "steps": [{...}, ...],
}, ...]

Use case: Client wants to monitor the progress of the DevelopmentSteps

GET /agent/tasks/chat_app/steps/stream?task_type=UserStory

The /stream suffix is for subscribing to Server Sent Events.

If task_type=UserStory is not specified, the stream would yield the user interaction steps:

Should the chat app support chat groups as well as one-to-one messaging?

With the task_type=UserStory, client receives a stream of:

{
  "task_id": "chat_app#89",   // or "chat_app-1" for in-memory UserStories
  "step_id": "1",
  "name": "Implement code change",
  "status": "created",
  "output": "File `washington.txt` saved to the disk and currently looks like this:\n```\nWashington\n```",
  "additional_output": {
    // line number or diff may be handy
  },
  "artifacts": [{
    "artifact_id": "1",
    "agent_created": true,
    "file_name": "washington.txt",
    "relative_path": ""
  }]
  "is_last": true,
}

Use case: User interacts with story through conversation

It's simpler for the user (and clients) if the user interacts with the single Project task chat_app rather than the UserStory task.

POST /agent/tasks/chat_app/steps
{
   "input": "Issue 89 is done"
}

Issue Manager closes issue #89.

Response:

{
  "task_id": "chat_app", 
  "step_id": "2341234",
  "name": "IssueResolved",
  "status": "completed",
  "output": "That's great",
  "additional_output": {
    "issue_url": "https://github.com/Pythagora-io/gpt-pilot/issues/89",
    "status": "DONE"
  },
  "artifacts": []
  "is_last": true,
}

from gpt-pilot.

nalbion avatar nalbion commented on August 17, 2024

Note, the AutoGPT UI sends the same message to the initial POST /task and POST task/id/steps. This allows a UX similar to ChatGPT where your first message is used to generate a name for the conversation.

It doesn't allow for the agent to initiate the conversation with an instructional greeting like "what's the project name/description".

We should cater for both scenarios:

  • initial task message includes the project description. LLM suggests a name
  • Initial task message is empty. Agent prompts for name and description

https://github.com/Significant-Gravitas/AutoGPT/blob/c77ade5b2f62c5373fc7573e5c45581f003c77a3/frontend/lib/views/chat/chat_view.dart#L124

String newTaskId = await taskViewModel.createTask(message);
                    widget.viewModel.setCurrentTaskId(newTaskId);
                    widget.viewModel.sendChatMessage(
                        (message == "") ? null : message,
                        continuousModeSteps: Provider.of<SettingsViewModel>(
                                context,
                                listen: false)
                            .continuousModeSteps);

from gpt-pilot.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.