forked from TheCarBun/GitHub-Agent
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgithub_agent.py
More file actions
68 lines (58 loc) · 1.82 KB
/
github_agent.py
File metadata and controls
68 lines (58 loc) · 1.82 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
from agno.agent import Agent
from agno.tools.github import GithubTools
from agno.models.openai import OpenAIChat
from agno.playground import Playground, serve_playground_app
from instructions.main_agent_instructions import main_agent, stat_agent
from instructions.team_instructions import process_instruction
from github_tools.github_tools import get_contribution_stats, get_repo_stats, get_user_stats
import os
from dotenv import load_dotenv
load_dotenv()
OPENAI_API_KEY = os.getenv("OPENAI_API_KEY")
GITHUB_ACCESS_TOKEN = os.getenv("GITHUB_ACCESS_TOKEN")
model = OpenAIChat(
id="gpt-4o-mini",
api_key=OPENAI_API_KEY
)
# Agno GitHub Tools
github_tools = GithubTools(
access_token=GITHUB_ACCESS_TOKEN,
create_issue=False,
create_repository=False
)
# GitHub Stats Agent
github_stats_agent = Agent(
name="GitHub Stats Agent",
model=model,
instructions= process_instruction,
tools=[get_contribution_stats, get_repo_stats, get_user_stats],
show_tool_calls=True,
read_chat_history=True,
markdown=True,
debug_mode=True
)
# Main GitHub Agent
github_main_agent = Agent(
name="GitHub Agent",
model=model,
# instructions=main_agent, # for main agent
instructions=stat_agent, # for getting stats
tools= [github_tools], # Use tools when using main_agent instruction
team= [github_stats_agent], # Use Team when using own github functions and stat_agent instruction
show_tool_calls=True,
read_chat_history=True,
add_history_to_messages=True,
markdown=True,
debug_mode=True
)
# # CLI
# while True:
# prompt = input("You: ")
# if prompt.lower().strip() == 'exit':
# break
# response = github_stat_agent.run(prompt)
# print(response.content)
#Agno Playground
app = Playground(agents=[github_main_agent]).get_app()
if __name__ == "__main__":
serve_playground_app("github_agent:app", reload=True) # Agno Playground