multi agent
Browse files- app.py +45 -0
- multi.py +50 -0
- requirements.txt +17 -14
app.py
CHANGED
@@ -8,6 +8,7 @@ from knowledge import graph
|
|
8 |
from pii import derisk
|
9 |
from rag import rbc_product
|
10 |
from tool import rival_product
|
|
|
11 |
import os
|
12 |
os.system("pip freeze | tee requirements_log.txt")
|
13 |
|
@@ -135,6 +136,50 @@ By leveraging AI, market intelligence, and competitive analysis tools, you can t
|
|
135 |
|
136 |
With the right competitive research, you don’t just react to the market—you anticipate it.
|
137 |
""")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
138 |
with gr.Tab("Graphrag Marketing"):
|
139 |
gr.Markdown("""
|
140 |
Objective: Develop a Targeted Marketing Plan Aligned with Customer Personas
|
|
|
8 |
from pii import derisk
|
9 |
from rag import rbc_product
|
10 |
from tool import rival_product
|
11 |
+
from multi import bestPractice
|
12 |
import os
|
13 |
os.system("pip freeze | tee requirements_log.txt")
|
14 |
|
|
|
136 |
|
137 |
With the right competitive research, you don’t just react to the market—you anticipate it.
|
138 |
""")
|
139 |
+
|
140 |
+
with gr.Tab("Multi Agent"):
|
141 |
+
|
142 |
+
in_verbatim = gr.Textbox(label="Application Security Best Practice on Topic")
|
143 |
+
out_product = gr.Textbox(label="Best Practice")
|
144 |
+
|
145 |
+
gr.Examples(
|
146 |
+
[
|
147 |
+
[
|
148 |
+
"Docker Containers", "REST API", "Python"]
|
149 |
+
],
|
150 |
+
[in_verbatim]
|
151 |
+
)
|
152 |
+
btn_recommend = gr.Button("Research")
|
153 |
+
btn_recommend.click(fn=bestPractice, inputs=in_verbatim, outputs=out_product)
|
154 |
+
|
155 |
+
gr.Markdown("""
|
156 |
+
The faster we build, the higher the risk of introducing vulnerabilities—especially in applications tied to personal banking workflows, where financial fraud can directly impact customer trust.
|
157 |
+
=====================
|
158 |
+
Yet most security tools today are reactive, slow, and generic—they don't reflect specific infrastructure, threat profile, or code patterns.
|
159 |
+
|
160 |
+
So here’s the core question we should be asking:
|
161 |
+
|
162 |
+
How can we turn application security from a bottleneck into a competitive advantage—one that provides developers with fast, context-aware, and proactive feedback tailored to unique environment?
|
163 |
+
|
164 |
+
### ✅ Reframed Customer Need
|
165 |
+
- Developers want actionable feedback during the build process—not after deployment.
|
166 |
+
|
167 |
+
- Security teams need to detect and explain vulnerabilities in specific patterns—across containers, APIs, and legacy integrations.
|
168 |
+
|
169 |
+
Product & revenue teams need confidence that customer-facing banking apps will not just ship fast—but also protect users and unlock new monetization opportunities.
|
170 |
+
|
171 |
+
### 💡 Proposed Solution
|
172 |
+
A multi-agent GenAI system trained on RBC’s codebase, policy docs, and threat data—
|
173 |
+
that provides real-time, localized security feedback, explains why something’s a risk, and suggests secure-by-default alternatives.
|
174 |
+
|
175 |
+
Agents include:
|
176 |
+
- Code risk explainer agent: Detects common security flaws (e.g., insecure API calls) and provides context-specific impact analysis.
|
177 |
+
|
178 |
+
- Infrastructure policy checker agent: Validates use of containers and deployment patterns against RBC’s internal compliance standards.
|
179 |
+
|
180 |
+
- Refactor assistant agent: Suggests how to fix the issue, with references to existing secure modules.
|
181 |
+
""")
|
182 |
+
|
183 |
with gr.Tab("Graphrag Marketing"):
|
184 |
gr.Markdown("""
|
185 |
Objective: Develop a Targeted Marketing Plan Aligned with Customer Personas
|
multi.py
ADDED
@@ -0,0 +1,50 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from agno.agent import Agent
|
2 |
+
from agno.models.openai import OpenAIChat
|
3 |
+
from agno.team import Team
|
4 |
+
from agno.tools.duckduckgo import DuckDuckGoTools
|
5 |
+
from agno.models.ollama import Ollama
|
6 |
+
from agno.models.groq import Groq
|
7 |
+
import os
|
8 |
+
chat=Groq(id='llama-3.1-8b-instant') if os.getenv("GROQ_API_KEY") else Ollama(id="llama3.2" )
|
9 |
+
# Create individual specialized agents
|
10 |
+
researcher = Agent(
|
11 |
+
name="Researcher",
|
12 |
+
role="Expert at finding information by breaking the structure into components",
|
13 |
+
tools=[DuckDuckGoTools()],
|
14 |
+
show_tool_calls=True,
|
15 |
+
model=chat, #OpenAIChat("gpt-4o"),
|
16 |
+
#debug_mode=True,
|
17 |
+
)
|
18 |
+
|
19 |
+
engineer = Agent(
|
20 |
+
name="Security Engineer",
|
21 |
+
role="Security Expert at writing clear, engaging content for hands-on best practices, and common pitfalls with solution",
|
22 |
+
model=chat, #OpenAIChat("gpt-4o"),
|
23 |
+
)
|
24 |
+
|
25 |
+
# Create a team with these agents
|
26 |
+
content_team = Team(
|
27 |
+
name="Content Team",
|
28 |
+
mode="coordinate",
|
29 |
+
members=[researcher, engineer],
|
30 |
+
instructions="You are a team of researchers and writers that work together to create high-quality content.",
|
31 |
+
model=chat, #OpenAIChat("gpt-4o"),
|
32 |
+
markdown=True,
|
33 |
+
)
|
34 |
+
def bestPractice(topic):
|
35 |
+
r = content_team.run(topic)
|
36 |
+
return r.messages[-1].content
|
37 |
+
|
38 |
+
if __name__=='__main__':
|
39 |
+
from pprint import pprint
|
40 |
+
from agno.utils.pprint import pprint_run_response
|
41 |
+
r=content_team.run("Docker Containers")
|
42 |
+
pprint_run_response(r, markdown=True)
|
43 |
+
print([m.content for m in r.messages if m.role == 'assistant'][-1])
|
44 |
+
|
45 |
+
|
46 |
+
print("")
|
47 |
+
pprint(r.messages)
|
48 |
+
# Run the team with a task
|
49 |
+
|
50 |
+
#content_team.print_response("Create a common pitfalls with best practice article about application security for using Docker Containers")
|
requirements.txt
CHANGED
@@ -3,15 +3,15 @@ requests
|
|
3 |
duckduckgo_search
|
4 |
pandas
|
5 |
#sentence_transformers
|
6 |
-
langchain
|
7 |
-
langgraph
|
8 |
litellm==1.63
|
9 |
openai==1.61.0
|
10 |
-
dspy
|
11 |
-
llama-index
|
12 |
faiss-cpu
|
13 |
tavily-python
|
14 |
-
anthropic
|
15 |
|
16 |
#GRAPHRAG
|
17 |
#llama-index-llms-litellm
|
@@ -21,24 +21,27 @@ anthropic
|
|
21 |
|
22 |
networkx
|
23 |
matplotlib
|
24 |
-
langchain-experimental
|
25 |
-
langchain-groq
|
26 |
-
langchain-community
|
27 |
pandas
|
28 |
#gradio-client
|
29 |
pillow
|
30 |
-
numpy
|
31 |
|
32 |
#KNOWLEDGE GRAPH
|
33 |
graphviz
|
34 |
-
pydantic
|
35 |
instructor[groq]==1.7.9
|
36 |
|
37 |
#LLM evals
|
38 |
#inspect_ai
|
39 |
|
40 |
#PII
|
41 |
-
presidio_analyzer
|
42 |
-
presidio_anonymizer
|
43 |
-
spacy
|
44 |
-
https://github.com/explosion/spacy-models/releases/download/en_core_web_lg-3.8.0/en_core_web_lg-3.8.0-py3-none-any.whl
|
|
|
|
|
|
|
|
3 |
duckduckgo_search
|
4 |
pandas
|
5 |
#sentence_transformers
|
6 |
+
langchain==0.3.26
|
7 |
+
langgraph==0.5.0
|
8 |
litellm==1.63
|
9 |
openai==1.61.0
|
10 |
+
dspy==2.6.27
|
11 |
+
llama-index==0.12.38
|
12 |
faiss-cpu
|
13 |
tavily-python
|
14 |
+
anthropic==0.55.0
|
15 |
|
16 |
#GRAPHRAG
|
17 |
#llama-index-llms-litellm
|
|
|
21 |
|
22 |
networkx
|
23 |
matplotlib
|
24 |
+
langchain-experimental==0.3.4
|
25 |
+
langchain-groq==0.3.3
|
26 |
+
langchain-community==0.3.26
|
27 |
pandas
|
28 |
#gradio-client
|
29 |
pillow
|
30 |
+
numpy==2.2.6
|
31 |
|
32 |
#KNOWLEDGE GRAPH
|
33 |
graphviz
|
34 |
+
pydantic==2.11.7
|
35 |
instructor[groq]==1.7.9
|
36 |
|
37 |
#LLM evals
|
38 |
#inspect_ai
|
39 |
|
40 |
#PII
|
41 |
+
presidio_analyzer==2.2.358
|
42 |
+
presidio_anonymizer==2.2.358
|
43 |
+
spacy==3.8.7
|
44 |
+
https://github.com/explosion/spacy-models/releases/download/en_core_web_lg-3.8.0/en_core_web_lg-3.8.0-py3-none-any.whl
|
45 |
+
|
46 |
+
#MULTI
|
47 |
+
agno
|