File size: 1,711 Bytes
f269105
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
from agno.agent import Agent
from agno.models.openai import OpenAIChat
from agno.team import Team
from agno.tools.duckduckgo import DuckDuckGoTools
from agno.models.ollama import Ollama
from agno.models.groq import Groq
import os
chat=Groq(id='llama-3.1-8b-instant') if os.getenv("GROQ_API_KEY") else Ollama(id="llama3.2" )
# Create individual specialized agents
researcher = Agent(
    name="Researcher",
    role="Expert at finding information by breaking the structure into components",
    tools=[DuckDuckGoTools()],
    show_tool_calls=True,
    model=chat, #OpenAIChat("gpt-4o"),
    #debug_mode=True,
)

engineer = Agent(
    name="Security Engineer",
    role="Security Expert at writing clear, engaging content for hands-on best practices, and common pitfalls with solution",
    model=chat, #OpenAIChat("gpt-4o"),
)

# Create a team with these agents
content_team = Team(
    name="Content Team",
    mode="coordinate",
    members=[researcher, engineer],
    instructions="You are a team of researchers and writers that work together to create high-quality content.",
    model=chat, #OpenAIChat("gpt-4o"),
    markdown=True,
)
def bestPractice(topic):
    r = content_team.run(topic)
    return r.messages[-1].content

if __name__=='__main__':
    from pprint import pprint
    from agno.utils.pprint import pprint_run_response
    r=content_team.run("Docker Containers")
    pprint_run_response(r, markdown=True)
    print([m.content for m in r.messages if m.role == 'assistant'][-1])


    print("")
    pprint(r.messages)
    # Run the team with a task

    #content_team.print_response("Create a common pitfalls with best practice article about application security for using Docker Containers")