Skip to content

Commit c020eb5

Browse files
committed
New panels for running prefect and fixing various functionality, updated the README
1 parent 7e68b2e commit c020eb5

21 files changed

+941
-128
lines changed

‎.prefectignore

Whitespace-only changes.

‎README.md

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,10 +54,42 @@ Open a browser to the default Gradio port: http://127.0.0.1:7860/
5454

5555
After the interface is launched, select or create a new agent and start chatting as shown in the image below:
5656
![Playground](./images/gptplayground.png)
57-
The interface consists of the following components:
57+
The main interface tab consists of the following components:
5858
* The Assistants panel where you can select, update and create assistants
5959
* The conversation panel which is multi-modal and supports uploading files and for the assistant to generate and show files.
6060
* The Assistant log panel shows how the assistant is working with and consuming tools behind the scenes. This includes showing the code it runs within its code interpreter.
61+
Other interface tabs:
62+
* Logs - allows you to view any internal conversations by the assistant, this includes how and which actions (tools/functions) it is using.
63+
* Agentic Behavior Tree (new) - this panel allows you to load, visualize, run and deploy agentic behavior trees
64+
* Prefect Flow Runner - is a window to the Prefect web interface. You must have Prefect running to see this.
65+
66+
## Installing the assistants
67+
You can install several of the demo assistants located in the assistants.db Sqlite database. To do this follow these instructions:
68+
* Create a new or use an existing assistant.
69+
* Give the assistant the action - create_manager_assistant (found under the Actions section)
70+
* Ask the assistant to create the manager assistant (ie. "please create the manager assistant")
71+
* Refresh your browser to reload the assistants selector
72+
* Select the new Manager Assistant - this assistant has the instructions and actions that will allow it to install assistants from the assistants.db database
73+
74+
## Agentic Behavior Trees
75+
This tab allows you to open and run/deploy agentic behavior trees and includes the following functionality:
76+
* Load - load a yaml file that contains your tree definition. The folder btrees, contains some examples. Be sure to have the required assistants installed before running a btree.
77+
* Editing the YAML, as you edit the yaml, the graph displaying the btree will also update to show how your yaml is being parsed
78+
* Save - saving functionality is currently broken, it you make changes in a file it is recommended to copy paste the edits into the file directly.
79+
* Run - this will run the btree with the Playground, you can check the progress of the run by viewing the Logs tab
80+
* Deploy - (note: Prefect server must be running) - this will deploy the btree to Prefect and allow you to run, suspend, and schedule new runs using the web interface. Note, the Playground must be currently running in order to host the btree run. In the future their will be an option to deplay a btree to a Docker container.
81+
82+
## Prefect (installation and running)
83+
Prefect is now automatically installed along with the other package requirements.
84+
85+
In order to use the Prefect Web UI you will need to run a server instance by executing the following in a new terminal window:
86+
```bash
87+
prefect server start
88+
```
89+
This will launch a server instance. You can then access Prefect through the tab in the Playground interface.
90+
91+
More info on Prefect can be found here: https://github.com/PrefectHQ/prefect
92+
6193

6294
## Learning Resources
6395
- [OpenAI Documentation](https://beta.openai.com/docs/)

‎assistants.db

40 KB
Binary file not shown.

‎blogging_agents_v3_prefect.py

Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
import time
2+
3+
from prefect import flow
4+
import py_trees
5+
6+
from playground.behavior_trees import (
7+
create_assistant_action,
8+
)
9+
10+
11+
@flow(log_prints=True)
12+
def run_tree():
13+
# Create the root node (sequence)
14+
root = py_trees.composites.Sequence("RootSequence", memory=True)
15+
16+
selector = py_trees.composites.Selector("Search Selector", memory=True)
17+
root.add_child(selector)
18+
19+
def get_search_instructions():
20+
return """
21+
Use the function/tool get_search_term to load a search term from the list of search terms.
22+
Query the "{search_term}" to search for "this week" videos on YouTube.
23+
Use the filter "this week" to search for videos on YouTube.
24+
then for each video download the transcript and determine relevance to the {search_term}
25+
then select a single video that is most relevant to the search term.
26+
Summarize the content of the video into 5 paragraphs,
27+
be sure to include a link to the video and highlight the link as a reference for the content.
28+
and then save the transcript summarizations to a file called youtube_transcripts.txt
29+
Make sure to save the search term at the top of the file.
30+
Always make sure to use save_file tool/function to save the file before moving on.
31+
If you encounter any errors, please return just the word FAILURE.
32+
"""
33+
34+
search_youtube_action = create_assistant_action(
35+
action_name="Search YouTube",
36+
assistant_name="YouTube Researcher v3",
37+
assistant_instructions=get_search_instructions(),
38+
)
39+
selector.add_child(search_youtube_action)
40+
41+
write_blog_action = create_assistant_action(
42+
action_name="Write blog",
43+
assistant_name="Medium Blogger",
44+
assistant_instructions="""
45+
Load the file called youtube_transcripts.txt,
46+
analyze the contents for references to the search term
47+
at the top of the file and then select
48+
the most exciting and relevant content related to the search term but also:
49+
educational, tutorial, informative, demonstation, to blog on Medium.
50+
51+
Write a blog in Word docx that is relevant to the content of the summarization,
52+
Be sure the blog captures the spirit of the themes and topic content,
53+
The name of the file should be {search term}_blog_{timestamp}.docx (You can get the timestamp using the get_current_timestamp() tool/function.)
54+
RULES:
55+
Avoid quoting individuals or organizations but rather generalize their statements.
56+
IMPORTANT: Be sure to add a reference to the video link in the blog post.
57+
Focus on new and innovative content.
58+
Be sure to highlight the technology theme/topic that was summarized.
59+
Make sure and add a compelling title for the blog post.
60+
61+
At the top of the blog under the first section add the following disclainer in full:
62+
Disclaimer: this blog is entirely written by a team of agents including the images, layout and content. The process works by having the agents search, review and summarize the transcripts of YouTube videos, the summarized content is then written into a blog. If you want to understand more check out my book AI Agents In Action. My contribution is the selection of the stories to publish, copy/pasting content and writing the agents.
63+
As your last operation write the blog filename to a file called blog_filenames.txt.
64+
If you encounter any errors, please return just the word FAILURE.
65+
""",
66+
)
67+
root.add_child(write_blog_action)
68+
69+
post_action = create_assistant_action(
70+
action_name="Post",
71+
assistant_name="Medium Post Writer",
72+
assistant_instructions="""
73+
Load the blog_filenames.txt file and to located Word docx file to load the blog content.
74+
Load the blog content for the Word docx file.
75+
Write a post about the blog content for the following platforms: LinkedIn, Twitter, Reddit.
76+
Save each of the post contents to a file called {word docx filename}_post_{platform name}.txt.
77+
If you encounter any errors, please return just the word FAILURE.
78+
""",
79+
)
80+
root.add_child(post_action)
81+
82+
cleanup_action = create_assistant_action(
83+
action_name="Cleanup",
84+
assistant_name="File Manager",
85+
assistant_instructions="""
86+
Delete the youtube_transcripts.txt file.
87+
Delete the blog_filenames.txt file.
88+
If you encounter any errors, please return just the word FAILURE.
89+
""",
90+
)
91+
root.add_child(cleanup_action)
92+
93+
# Create the behavior tree
94+
tree = py_trees.trees.BehaviourTree(root)
95+
96+
# Tick the tree to run it
97+
while True:
98+
tree.tick()
99+
time.sleep(30) # Simulate time between ticks
100+
101+
102+
if __name__ == "__main__":
103+
run_tree()

‎btrees/medium_blogger.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@ behavior_tree:
4242
Focus on new and innovative content.
4343
Be sure to highlight the technology theme/topic that was summarized.
4444
Make sure and add a compelling title for the blog post.
45+
Use the social strategy of 'the one good paragraph' to make the article stand out. A single condensed paragraph that is punchy and retweetable somewhere in the newsletter that summarizes the content of the entire blog and can be used as a tweetable quote.
46+
Be sure to add a quote from "the one good paragraph" into the blog as a paragraph section.
4547
4648
At the top of the blog under the first section add the following disclainer in full:
4749
Disclaimer: this blog is entirely written by a team of agents including the images, layout and content. The process works by having the agents search, review and summarize the transcripts of YouTube videos, the summarized content is then written into a blog. If you want to understand more check out my book AI Agents In Action. My contribution is the selection of the stories to publish, copy/pasting content and writing the agents.

‎btrees/medium_blogger_v2.yaml

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
behavior_tree:
2+
name: "ComplexBehaviorTree"
3+
root:
4+
type: "Selector"
5+
memory: true
6+
children:
7+
- type: "Sequence"
8+
name: "Search Selector"
9+
memory: true
10+
children:
11+
- type: "Action"
12+
name: "Search YouTube"
13+
agent: "YouTube Researcher v3"
14+
instructions: |
15+
Use the function/tool get_search_term to load a search term from the list of search terms.
16+
Query the "{search_term}" to search for "this week" videos on YouTube.
17+
Use the filter "this week" to search for videos on YouTube.
18+
then for each video download the transcript and determine relevance to the {search_term}
19+
then select a single video that is most relevant to the search term.
20+
Summarize the content of the video into 5 paragraphs,
21+
be sure to include a link to the video and highlight the link as a reference for the content.
22+
and then save the transcript summarizations to a file called youtube_transcripts.txt
23+
Make sure to save the search term at the top of the file.
24+
Always make sure to use save_file tool/function to save the file before moving on.
25+
If you encounter any errors, please return just the word FAILURE.
26+
- type: "Action"
27+
name: "Write blog"
28+
agent: "Medium Blogger"
29+
instructions: |
30+
Load the file called youtube_transcripts.txt,
31+
analyze the contents for references to the search term
32+
at the top of the file and then select
33+
the most exciting and relevant content related to the search term but also:
34+
educational, tutorial, informative, demonstation, to blog on Medium.
35+
36+
Write a blog in Word docx that is relevant to the content of the summarization,
37+
Be sure the blog captures the spirit of the themes and topic content,
38+
The name of the file should be {search term}_blog_{timestamp}.docx (You can get the timestamp using the get_current_timestamp() tool/function.)
39+
RULES:
40+
Avoid quoting individuals or organizations but rather generalize their statements.
41+
IMPORTANT: Be sure to add a reference to the video link in the blog post.
42+
Focus on new and innovative content.
43+
Be sure to highlight the technology theme/topic that was summarized.
44+
Make sure and add a compelling title for the blog post.
45+
Use the social strategy of 'the one good paragraph' to make the article stand out. A single condensed paragraph that is punchy and retweetable somewhere in the newsletter that summarizes the content of the entire blog and can be used as a tweetable quote.
46+
Be sure to add a quote from "the one good paragraph" into the blog as a paragraph section.
47+
48+
At the top of the blog under the first section add the following disclainer in full:
49+
Disclaimer: this blog is entirely written by a team of agents including the images, layout and content. The process works by having the agents search, review and summarize the transcripts of YouTube videos, the summarized content is then written into a blog. If you want to understand more check out my book AI Agents In Action. My contribution is the selection of the stories to publish, copy/pasting content and writing the agents.
50+
As your last operation write the blog filename to a file called blog_filenames.txt.
51+
If you encounter any errors, please return just the word FAILURE.
52+
- type: "Action"
53+
name: "Post"
54+
agent: "Medium Post Writer"
55+
instructions: |
56+
Load the blog_filenames.txt file and to located Word docx file to load the blog content.
57+
Load the blog content for the Word docx file.
58+
Write a post about the blog content for the following platforms: LinkedIn, Twitter, Reddit.
59+
Save each of the post contents to a file called {word docx filename}_post_{platform name}.txt.
60+
If you encounter any errors, please return just the word FAILURE.
61+
- type: "Action"
62+
name: "Cleanup"
63+
agent: "File Manager"
64+
instructions: |
65+
Delete the youtube_transcripts.txt file.
66+
Delete the blog_filenames.txt file.
67+
If you encounter any errors, please return just the word FAILURE.
68+
- type: "Action"
69+
name: "Cleanup"
70+
agent: "File Manager"
71+
instructions: |
72+
Delete the youtube_transcripts.txt file.
73+
Delete the blog_filenames.txt file.
74+
If you encounter any errors, please return just the word FAILURE.

‎btrees/repo_blogger_v2.yaml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
behavior_tree:
2+
name: "Repository Blogger"
3+
root:
4+
type: "Selector"
5+
memory: true
6+
children:
7+
- type: "Sequence"
8+
name: "Search Selector"
9+
memory: true
10+
children:
11+
- type: "Action"
12+
name: "Search GitHub"
13+
agent: "GitHub Researcher"
14+
instructions: |
15+
Research GitHub repositories on AI Agents.
16+
Make sure to only select repositories that are relevant to AI Agents and use Python.
17+
If you encounter any errors, please return just the word FAILURE.
18+
- type: "Action"
19+
name: "Write blog"
20+
agent: "GitHub Blogger"
21+
instructions: |
22+
Load the file called top_github_repo.txt,
23+
extract the GitHub repository name and url from the file.
24+
Use the readme file information to write a getting started blog post on the repository.
25+
Be sure to demonstrate plenty of code examples and explanations of the code.
26+
27+
As your last operation write the blog filename to a file called blog_filenames.txt.
28+
If you encounter any errors, please return just the word FAILURE.
29+
- type: "Action"
30+
name: "Cleanup"
31+
agent: "File Manager"
32+
instructions: |
33+
Delete the top_github_repo.txt file.
34+
Delete the blog_filenames.txt file.
35+
If you encounter any errors, please return just the word FAILURE.
36+
- type: "Action"
37+
name: "Cleanup"
38+
agent: "File Manager"
39+
instructions: |
40+
Delete the top_github_repo.txt file.
41+
Delete the blog_filenames.txt file.
42+
If you encounter any errors, please return just the word FAILURE.

‎btrees/repo_blogger_v3.yaml

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
behavior_tree:
2+
name: "Repository Blogger"
3+
root:
4+
type: "Selector"
5+
memory: true
6+
children:
7+
- type: "Sequence"
8+
name: "Search Selector"
9+
memory: true
10+
children:
11+
- type: "Action"
12+
name: "Search GitHub"
13+
agent: "GitHub Researcher"
14+
instructions: |
15+
Research GitHub repositories on AI Agents.
16+
Make sure to only select repositories that are relevant to AI Agents and use Python.
17+
If you encounter any errors, please return just the word FAILURE.
18+
- type: "Action"
19+
name: "Search YouTube"
20+
agent: "YouTube Project Researcher"
21+
instructions: |
22+
Load the file called top_github_repo.txt, extract the GitHub repository name and use it as the search term.
23+
Query the "{search_term}" to search for "this month" videos on YouTube.
24+
Use the filter "this month" to search for videos on YouTube.
25+
then for each video download the transcript and determine relevance to the {search_term}
26+
then select a single video that is most relevant to the search term.
27+
Summarize the content of the video into 5 sections with 2-3 paragraphs per section.,
28+
be sure to include a link to the video and highlight the link as a reference for the content.
29+
and then save the transcript summarizations to a file called youtube_transcripts.txt
30+
Make sure to save the search term at the top of the file.
31+
Always make sure to use save_file tool/function to save the file before moving on.
32+
If you encounter any errors, please return just the word FAILURE.
33+
- type: "Action"
34+
name: "Write blog"
35+
agent: "GitHub Blogger"
36+
instructions: |
37+
Load the file called top_github_repo.txt,
38+
extract the GitHub repository name and url from the file.
39+
Load the file called youtube_transcripts.txt, to see what related videos are about.
40+
If either file does not exist, return FAILURE.
41+
Use video transcripts and readme file information to write a getting started blog post on the repository.
42+
43+
As your last operation write the blog filename to a file called blog_filenames.txt.
44+
If you encounter any errors, please return just the word FAILURE.
45+
- type: "Action"
46+
name: "Cleanup"
47+
agent: "File Manager"
48+
instructions: |
49+
Delete the top_github_repo.txt file.
50+
Delete the blog_filenames.txt file.
51+
Delete the youtube_transcripts.txt file.
52+
If you encounter any errors, please return just the word FAILURE.
53+
- type: "Action"
54+
name: "Cleanup"
55+
agent: "File Manager"
56+
instructions: |
57+
Delete the top_github_repo.txt file.
58+
Delete the blog_filenames.txt file.
59+
Delete the youtube_transcripts.txt file.
60+
If you encounter any errors, please return just the word FAILURE.

0 commit comments

Comments
 (0)