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

Add API mode #356

Closed
wants to merge 436 commits into from
Closed

Add API mode #356

wants to merge 436 commits into from

Conversation

jakubno
Copy link

@jakubno jakubno commented Jul 23, 2023

API mode

This PR adds an API to the babyagi by using the e2b agent protocol SDK that implements the Agent Communication Protocol.

Here is a short preview how to use the API that I also added to the README

To start the server run (from classic directory):

python api.py

and then you can call the API using either the following commands:

To create a task run:

curl --request POST \
  --url http://localhost:8000/agent/tasks \
  --header 'Content-Type: application/json' \
  --data '{
	"input": "Find the Answer to the Ultimate Question of Life, the Universe, and Everything."
}'

You will get a response like this:

{"input":"Find the Answer to the Ultimate Question of Life, the Universe, and Everything.","task_id":"d2c4e543-ae08-4a97-9ac5-5f9a4459cb19","artifacts":[]}

Then to execute one step of the task copy the task_id you got from the previous request and run:

curl --request POST \
  --url http://localhost:8000/agent/tasks/<task-id>/steps

or you can use Python client library:

from agent_protocol_client import AgentApi, ApiClient, TaskRequestBody

...

prompt = "Find the Answer to the Ultimate Question of Life, the Universe, and Everything."

async with ApiClient() as api_client:
    # Create an instance of the API class
    api_instance = AgentApi(api_client)
    task_request_body = TaskRequestBody(input=prompt)

    task = await api_instance.create_agent_task(
        task_request_body=task_request_body
    )
    task_id = task.task_id
    response = await api_instance.execute_agent_task_step(task_id=task_id)

...

androchentw and others added 30 commits April 15, 2023 00:15
@yoheinakajima asked me to create and maintain a list of projects the community has created inspired by the original concept of BabyAGI
…ranslation

docs: add Traditional Chinese (zh-TW 🇹🇼) translation to README
Include spanish translation README
add Simplified Chinese translation README
added BabyAGI as a service
zeelsheladiya and others added 28 commits May 5, 2023 12:23
Link to 7-day github activity reports
Add missing openai config in tools scripts
Uploading another mod of OG BabyAGI (original commit). Just because it's easier to experiment with framework as a simple script. Would love to hear feedback - this one might be getting stable enough to discuss pulling into core.
continous -> continuous
Add twitter-agent🐣 to inspired projects lists
BabyDeerAGI is a mod of BabyCatAGI, which is a mod of BabyBeeAGI, which is a mod of OG BabyAGI. BabyDeerAGI is at ~350 lines of code.

This was built as a continued iteration on the original BabyAGI code in a lightweight way. New to BabyDeerAGI are:

- only requires 3.5-turbo (better prompts)
- parallel task runs when not dependent on each other
- web search tool includes query rewrite
- simple user input tool (ask user for input)

Follow BabyAGI on Twitter: http://twitter.com/babyAGI_
Join the Discord: https://discord.gg/9RCW87R5QX
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.