File size: 1,847 Bytes
f269105 05222d8 f269105 f2c5257 f269105 f2c5257 f269105 f2c5257 f269105 f2c5257 f269105 f2c5257 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 51 |
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.3-70b-versatile') if os.getenv("GROQ_API_KEY") else Ollama(id="qwen2.5")
# Create individual specialized agents
researcher = Agent(
name="Researcher",
role="Expert at finding information by breaking the structure into components ie) architecture, code, algorithm, linux system",
tools=[DuckDuckGoTools(fixed_max_results=3)],
show_tool_calls=True,
tool_call_limit=1,
model=chat, #OpenAIChat("gpt-4o"),
#debug_mode=True,
)
engineer = Agent(
name="Security Engineer",
role="Security Expert at writing short, 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 [m for m in r.messages if m.role == 'assistant'][-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 for m in r.messages if m.role == 'assistant'][-1].content)
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") |