Added cool stuff

pull/609/head
kirill670 3 months ago
parent fbf65094a6
commit 5f879bc180

@ -0,0 +1,115 @@
from swarms import Agent
from swarm_models import OpenAIChat
from swarms_memory import ChromaDB
import os
# Initialize memory for agents
memory_risk = ChromaDB(metric="cosine", output_dir="risk_analysis_results")
memory_sustainability = ChromaDB(metric="cosine", output_dir="sustainability_results")
# Initialize model
model = OpenAIChat(api_key=os.getenv("OPENAI_API_KEY"), model_name="gpt-4o-mini", temperature=0.1)
# Initialize Risk Analysis Agent
risk_analysis_agent = Agent(
agent_name="Delaware-C-Corp-Risk-Analysis-Agent",
system_prompt="You are a specialized risk analysis agent focused on assessing risks.",
agent_description="Performs risk analysis for Delaware C Corps.",
llm=model,
max_loops=3,
autosave=True,
dashboard=False,
verbose=True,
dynamic_temperature_enabled=True,
saved_state_path="delaware_c_corp_risk_analysis_agent.json",
user_name="risk_analyst_user",
retry_attempts=2,
context_length=200000,
long_term_memory=memory_risk,
)
# Initialize Sustainability Agent
sustainability_agent = Agent(
agent_name="Delaware-C-Corp-Sustainability-Agent",
system_prompt="You are a sustainability analysis agent focused on ESG factors.",
agent_description="Analyzes sustainability practices for Delaware C Corps.",
llm=model,
max_loops=2,
autosave=True,
dashboard=False,
verbose=True,
dynamic_temperature_enabled=False,
saved_state_path="delaware_c_corp_sustainability_agent.json",
user_name="sustainability_specialist",
retry_attempts=3,
context_length=180000,
long_term_memory=memory_sustainability,
)
# Run the agents
risk_analysis_agent.run("What are the top financial and operational risks for a Delaware C Corp in healthcare?")
sustainability_agent.run("How can a Delaware C Corp in manufacturing improve its sustainability practices?")
from reflection_tuner import ReflectionTuner
# Initialize Reflection Tuners for each agent
risk_reflection_tuner = ReflectionTuner(risk_analysis_agent, reflection_steps=2)
sustainability_reflection_tuner = ReflectionTuner(sustainability_agent, reflection_steps=2)
# Run the agents with Reflection Tuning
risk_response = risk_reflection_tuner.reflect_and_tune("What are the top financial and operational risks for a Delaware C Corp in healthcare?")
sustainability_response = sustainability_reflection_tuner.reflect_and_tune("How can a Delaware C Corp in manufacturing improve its sustainability practices?")
print("Risk Analysis Agent Response:", risk_response)
print("Sustainability Agent Response:", sustainability_response)
# Initialize agents from agents_with_new.yaml
# Import ReflectionTuner
from reflection_tuner import ReflectionTuner
# Initialize Reflection Tuner for all agents, including existing ones
deduction_agent = Agent(
agent_name="Delaware-C-Corp-Tax-Deduction-Agent",
system_prompt="Provide expert advice on tax deductions for Delaware C Corps.",
agent_description="Analyzes tax deduction strategies.",
llm=model,
max_loops=1,
autosave=True,
dashboard=False,
verbose=True,
dynamic_temperature_enabled=True,
saved_state_path="delaware_c_corp_tax_deduction_agent.json",
user_name="swarms_corp",
retry_attempts=1,
context_length=250000,
long_term_memory=memory_risk, # Reuse memory for testing purposes
)
optimization_agent = Agent(
agent_name="Delaware-C-Corp-Tax-Optimization-Agent",
system_prompt="Provide expert advice on tax optimization strategies for Delaware C Corps.",
agent_description="Analyzes tax optimization.",
llm=model,
max_loops=2,
autosave=True,
dashboard=False,
verbose=True,
dynamic_temperature_enabled=False,
saved_state_path="delaware_c_corp_tax_optimization_agent.json",
user_name="tax_optimization_user",
retry_attempts=3,
context_length=200000,
long_term_memory=memory_risk,
)
# Initialize Reflection Tuners
deduction_reflection_tuner = ReflectionTuner(deduction_agent, reflection_steps=2)
optimization_reflection_tuner = ReflectionTuner(optimization_agent, reflection_steps=2)
# Run agents with Reflection Tuning
deduction_response = deduction_reflection_tuner.reflect_and_tune("What are the most effective tax deduction strategies for a Delaware C Corp in tech?")
optimization_response = optimization_reflection_tuner.reflect_and_tune("How can a Delaware C Corp in finance optimize its tax strategy?")
print("Tax Deduction Agent Response:", deduction_response)
print("Tax Optimization Agent Response:", optimization_response)

@ -0,0 +1,175 @@
from swarms import Agent
from swarm_models import OpenAIChat
from swarms_memory import ChromaDB
import os
# Initialize memory for agents
memory_risk = ChromaDB(metric="cosine", output_dir="risk_analysis_results")
memory_sustainability = ChromaDB(metric="cosine", output_dir="sustainability_results")
# Initialize model
model = OpenAIChat(api_key=os.getenv("OPENAI_API_KEY"), model_name="gpt-4o-mini", temperature=0.1)
# Initialize Risk Analysis Agent
risk_analysis_agent = Agent(
agent_name="Delaware-C-Corp-Risk-Analysis-Agent",
system_prompt="You are a specialized risk analysis agent focused on assessing risks.",
agent_description="Performs risk analysis for Delaware C Corps.",
llm=model,
max_loops=3,
autosave=True,
dashboard=False,
verbose=True,
dynamic_temperature_enabled=True,
saved_state_path="delaware_c_corp_risk_analysis_agent.json",
user_name="risk_analyst_user",
retry_attempts=2,
context_length=200000,
long_term_memory=memory_risk,
)
# Initialize Sustainability Agent
sustainability_agent = Agent(
agent_name="Delaware-C-Corp-Sustainability-Agent",
system_prompt="You are a sustainability analysis agent focused on ESG factors.",
agent_description="Analyzes sustainability practices for Delaware C Corps.",
llm=model,
max_loops=2,
autosave=True,
dashboard=False,
verbose=True,
dynamic_temperature_enabled=False,
saved_state_path="delaware_c_corp_sustainability_agent.json",
user_name="sustainability_specialist",
retry_attempts=3,
context_length=180000,
long_term_memory=memory_sustainability,
)
# Run the agents
risk_analysis_agent.run("What are the top financial and operational risks for a Delaware C Corp in healthcare?")
sustainability_agent.run("How can a Delaware C Corp in manufacturing improve its sustainability practices?")
from reflection_tuner import ReflectionTuner
# Initialize Reflection Tuners for each agent
risk_reflection_tuner = ReflectionTuner(risk_analysis_agent, reflection_steps=2)
sustainability_reflection_tuner = ReflectionTuner(sustainability_agent, reflection_steps=2)
# Run the agents with Reflection Tuning
risk_response = risk_reflection_tuner.reflect_and_tune("What are the top financial and operational risks for a Delaware C Corp in healthcare?")
sustainability_response = sustainability_reflection_tuner.reflect_and_tune("How can a Delaware C Corp in manufacturing improve its sustainability practices?")
print("Risk Analysis Agent Response:", risk_response)
print("Sustainability Agent Response:", sustainability_response)
# Initialize agents from agents_with_new.yaml
# Import ReflectionTuner
from reflection_tuner import ReflectionTuner
# Initialize Reflection Tuner for all agents, including existing ones
deduction_agent = Agent(
agent_name="Delaware-C-Corp-Tax-Deduction-Agent",
system_prompt="Provide expert advice on tax deductions for Delaware C Corps.",
agent_description="Analyzes tax deduction strategies.",
llm=model,
max_loops=1,
autosave=True,
dashboard=False,
verbose=True,
dynamic_temperature_enabled=True,
saved_state_path="delaware_c_corp_tax_deduction_agent.json",
user_name="swarms_corp",
retry_attempts=1,
context_length=250000,
long_term_memory=memory_risk, # Reuse memory for testing purposes
)
optimization_agent = Agent(
agent_name="Delaware-C-Corp-Tax-Optimization-Agent",
system_prompt="Provide expert advice on tax optimization strategies for Delaware C Corps.",
agent_description="Analyzes tax optimization.",
llm=model,
max_loops=2,
autosave=True,
dashboard=False,
verbose=True,
dynamic_temperature_enabled=False,
saved_state_path="delaware_c_corp_tax_optimization_agent.json",
user_name="tax_optimization_user",
retry_attempts=3,
context_length=200000,
long_term_memory=memory_risk,
)
# Initialize Reflection Tuners
deduction_reflection_tuner = ReflectionTuner(deduction_agent, reflection_steps=2)
optimization_reflection_tuner = ReflectionTuner(optimization_agent, reflection_steps=2)
# Run agents with Reflection Tuning
deduction_response = deduction_reflection_tuner.reflect_and_tune("What are the most effective tax deduction strategies for a Delaware C Corp in tech?")
optimization_response = optimization_reflection_tuner.reflect_and_tune("How can a Delaware C Corp in finance optimize its tax strategy?")
print("Tax Deduction Agent Response:", deduction_response)
print("Tax Optimization Agent Response:", optimization_response)
from reflection_tuner import ReflectionTuner
import requests
def duckduckgo_search(query):
# Simple DuckDuckGo search function for Data-Collector agent
url = f"https://api.duckduckgo.com/?q={query}&format=json&pretty=1"
response = requests.get(url)
if response.status_code == 200:
return response.json().get("AbstractText", "No data found")
return "Failed to retrieve data"
# Initialize Planner and Data-Collector agents with DuckDuckGo search capability
planner_agent = Agent(
agent_name="Delaware-C-Corp-Planner-Agent",
system_prompt="Develop a quarterly strategic roadmap for a Delaware C Corp.",
agent_description="Creates detailed plans and schedules.",
llm=model,
max_loops=2,
autosave=True,
dashboard=False,
verbose=True,
dynamic_temperature_enabled=True,
saved_state_path="delaware_c_corp_planner_agent.json",
user_name="planner_user",
retry_attempts=2,
context_length=150000,
long_term_memory=memory_sustainability, # Reuse memory for demonstration purposes
)
data_collector_agent = Agent(
agent_name="Delaware-C-Corp-Data-Collector-Agent",
system_prompt="Collect and synthesize information from DuckDuckGo search.",
agent_description="Gathers data from open-source search engines.",
llm=model,
max_loops=3,
autosave=True,
dashboard=False,
verbose=True,
dynamic_temperature_enabled=True,
saved_state_path="delaware_c_corp_data_collector_agent.json",
user_name="data_collector_user",
retry_attempts=3,
context_length=200000,
long_term_memory=memory_risk, # Reuse memory for demonstration
)
# Initialize Reflection Tuners
planner_reflection_tuner = ReflectionTuner(planner_agent, reflection_steps=2)
data_collector_reflection_tuner = ReflectionTuner(data_collector_agent, reflection_steps=2)
# Run Planner agent with Reflection Tuning
planner_response = planner_reflection_tuner.reflect_and_tune("Create a quarterly strategic roadmap for a Delaware C Corp in biotech.")
print("Planner Agent Response:", planner_response)
# Run Data Collector agent with Reflection Tuning, using DuckDuckGo search
data_collector_task = "Find recent trends in tax strategies for corporations in the US."
search_result = duckduckgo_search(data_collector_task)
data_collector_response = data_collector_reflection_tuner.reflect_and_tune(f"{search_result}")
print("Data Collector Agent Response:", data_collector_response)

@ -0,0 +1,203 @@
from swarms import Agent
from swarm_models import OpenAIChat
from swarms_memory import ChromaDB
import os
# Initialize memory for agents
memory_risk = ChromaDB(metric="cosine", output_dir="risk_analysis_results")
memory_sustainability = ChromaDB(metric="cosine", output_dir="sustainability_results")
# Initialize model
model = OpenAIChat(api_key=os.getenv("OPENAI_API_KEY"), model_name="gpt-4o-mini", temperature=0.1)
# Initialize Risk Analysis Agent
risk_analysis_agent = Agent(
agent_name="Delaware-C-Corp-Risk-Analysis-Agent",
system_prompt="You are a specialized risk analysis agent focused on assessing risks.",
agent_description="Performs risk analysis for Delaware C Corps.",
llm=model,
max_loops=3,
autosave=True,
dashboard=False,
verbose=True,
dynamic_temperature_enabled=True,
saved_state_path="delaware_c_corp_risk_analysis_agent.json",
user_name="risk_analyst_user",
retry_attempts=2,
context_length=200000,
long_term_memory=memory_risk,
)
# Initialize Sustainability Agent
sustainability_agent = Agent(
agent_name="Delaware-C-Corp-Sustainability-Agent",
system_prompt="You are a sustainability analysis agent focused on ESG factors.",
agent_description="Analyzes sustainability practices for Delaware C Corps.",
llm=model,
max_loops=2,
autosave=True,
dashboard=False,
verbose=True,
dynamic_temperature_enabled=False,
saved_state_path="delaware_c_corp_sustainability_agent.json",
user_name="sustainability_specialist",
retry_attempts=3,
context_length=180000,
long_term_memory=memory_sustainability,
)
# Run the agents
risk_analysis_agent.run("What are the top financial and operational risks for a Delaware C Corp in healthcare?")
sustainability_agent.run("How can a Delaware C Corp in manufacturing improve its sustainability practices?")
from reflection_tuner import ReflectionTuner
# Initialize Reflection Tuners for each agent
risk_reflection_tuner = ReflectionTuner(risk_analysis_agent, reflection_steps=2)
sustainability_reflection_tuner = ReflectionTuner(sustainability_agent, reflection_steps=2)
# Run the agents with Reflection Tuning
risk_response = risk_reflection_tuner.reflect_and_tune("What are the top financial and operational risks for a Delaware C Corp in healthcare?")
sustainability_response = sustainability_reflection_tuner.reflect_and_tune("How can a Delaware C Corp in manufacturing improve its sustainability practices?")
print("Risk Analysis Agent Response:", risk_response)
print("Sustainability Agent Response:", sustainability_response)
# Initialize agents from agents_with_new.yaml
# Import ReflectionTuner
from reflection_tuner import ReflectionTuner
# Initialize Reflection Tuner for all agents, including existing ones
deduction_agent = Agent(
agent_name="Delaware-C-Corp-Tax-Deduction-Agent",
system_prompt="Provide expert advice on tax deductions for Delaware C Corps.",
agent_description="Analyzes tax deduction strategies.",
llm=model,
max_loops=1,
autosave=True,
dashboard=False,
verbose=True,
dynamic_temperature_enabled=True,
saved_state_path="delaware_c_corp_tax_deduction_agent.json",
user_name="swarms_corp",
retry_attempts=1,
context_length=250000,
long_term_memory=memory_risk, # Reuse memory for testing purposes
)
optimization_agent = Agent(
agent_name="Delaware-C-Corp-Tax-Optimization-Agent",
system_prompt="Provide expert advice on tax optimization strategies for Delaware C Corps.",
agent_description="Analyzes tax optimization.",
llm=model,
max_loops=2,
autosave=True,
dashboard=False,
verbose=True,
dynamic_temperature_enabled=False,
saved_state_path="delaware_c_corp_tax_optimization_agent.json",
user_name="tax_optimization_user",
retry_attempts=3,
context_length=200000,
long_term_memory=memory_risk,
)
# Initialize Reflection Tuners
deduction_reflection_tuner = ReflectionTuner(deduction_agent, reflection_steps=2)
optimization_reflection_tuner = ReflectionTuner(optimization_agent, reflection_steps=2)
# Run agents with Reflection Tuning
deduction_response = deduction_reflection_tuner.reflect_and_tune("What are the most effective tax deduction strategies for a Delaware C Corp in tech?")
optimization_response = optimization_reflection_tuner.reflect_and_tune("How can a Delaware C Corp in finance optimize its tax strategy?")
print("Tax Deduction Agent Response:", deduction_response)
print("Tax Optimization Agent Response:", optimization_response)
from reflection_tuner import ReflectionTuner
import requests
def duckduckgo_search(query):
# Simple DuckDuckGo search function for Data-Collector agent
url = f"https://api.duckduckgo.com/?q={query}&format=json&pretty=1"
response = requests.get(url)
if response.status_code == 200:
return response.json().get("AbstractText", "No data found")
return "Failed to retrieve data"
# Initialize Planner and Data-Collector agents with DuckDuckGo search capability
planner_agent = Agent(
agent_name="Delaware-C-Corp-Planner-Agent",
system_prompt="Develop a quarterly strategic roadmap for a Delaware C Corp.",
agent_description="Creates detailed plans and schedules.",
llm=model,
max_loops=2,
autosave=True,
dashboard=False,
verbose=True,
dynamic_temperature_enabled=True,
saved_state_path="delaware_c_corp_planner_agent.json",
user_name="planner_user",
retry_attempts=2,
context_length=150000,
long_term_memory=memory_sustainability, # Reuse memory for demonstration purposes
)
data_collector_agent = Agent(
agent_name="Delaware-C-Corp-Data-Collector-Agent",
system_prompt="Collect and synthesize information from DuckDuckGo search.",
agent_description="Gathers data from open-source search engines.",
llm=model,
max_loops=3,
autosave=True,
dashboard=False,
verbose=True,
dynamic_temperature_enabled=True,
saved_state_path="delaware_c_corp_data_collector_agent.json",
user_name="data_collector_user",
retry_attempts=3,
context_length=200000,
long_term_memory=memory_risk, # Reuse memory for demonstration
)
# Initialize Reflection Tuners
planner_reflection_tuner = ReflectionTuner(planner_agent, reflection_steps=2)
data_collector_reflection_tuner = ReflectionTuner(data_collector_agent, reflection_steps=2)
# Run Planner agent with Reflection Tuning
planner_response = planner_reflection_tuner.reflect_and_tune("Create a quarterly strategic roadmap for a Delaware C Corp in biotech.")
print("Planner Agent Response:", planner_response)
# Run Data Collector agent with Reflection Tuning, using DuckDuckGo search
data_collector_task = "Find recent trends in tax strategies for corporations in the US."
search_result = duckduckgo_search(data_collector_task)
data_collector_response = data_collector_reflection_tuner.reflect_and_tune(f"{search_result}")
print("Data Collector Agent Response:", data_collector_response)
from token_cache_and_adaptive_factory import TokenCache, AdaptiveAgentFactory
# Initialize TokenCache and AdaptiveAgentFactory
token_cache = TokenCache(cache_duration_minutes=30) # Cache duration for tokens
adaptive_factory = AdaptiveAgentFactory(model, token_cache)
# Example of creating adaptive agents dynamically
adaptive_risk_agent = adaptive_factory.create_agent(
agent_name="Adaptive-Risk-Agent",
system_prompt="Assess new risk factors for changing economic conditions.",
task="Dynamic risk analysis in evolving markets.",
memory=memory_risk,
)
adaptive_sustainability_agent = adaptive_factory.create_agent(
agent_name="Adaptive-Sustainability-Agent",
system_prompt="Evaluate sustainability strategies in response to new regulations.",
task="Dynamic sustainability strategy for manufacturing.",
memory=memory_sustainability,
)
# Running adaptive agents
adaptive_risk_response = adaptive_risk_agent.run("Analyze potential economic risks for new market conditions.")
adaptive_sustainability_response = adaptive_sustainability_agent.run("Evaluate ESG strategies with upcoming regulation changes.")
print("Adaptive Risk Agent Response:", adaptive_risk_response)
print("Adaptive Sustainability Agent Response:", adaptive_sustainability_response)

@ -0,0 +1,52 @@
from swarms import Agent
from swarm_models import OpenAIChat
from swarms_memory import ChromaDB
import os
# Initialize memory for agents
memory_risk = ChromaDB(metric="cosine", output_dir="risk_analysis_results")
memory_sustainability = ChromaDB(metric="cosine", output_dir="sustainability_results")
# Initialize model
model = OpenAIChat(api_key=os.getenv("OPENAI_API_KEY"), model_name="gpt-4o-mini", temperature=0.1)
# Initialize Risk Analysis Agent
risk_analysis_agent = Agent(
agent_name="Delaware-C-Corp-Risk-Analysis-Agent",
system_prompt="You are a specialized risk analysis agent focused on assessing risks.",
agent_description="Performs risk analysis for Delaware C Corps.",
llm=model,
max_loops=3,
autosave=True,
dashboard=False,
verbose=True,
dynamic_temperature_enabled=True,
saved_state_path="delaware_c_corp_risk_analysis_agent.json",
user_name="risk_analyst_user",
retry_attempts=2,
context_length=200000,
long_term_memory=memory_risk,
)
# Initialize Sustainability Agent
sustainability_agent = Agent(
agent_name="Delaware-C-Corp-Sustainability-Agent",
system_prompt="You are a sustainability analysis agent focused on ESG factors.",
agent_description="Analyzes sustainability practices for Delaware C Corps.",
llm=model,
max_loops=2,
autosave=True,
dashboard=False,
verbose=True,
dynamic_temperature_enabled=False,
saved_state_path="delaware_c_corp_sustainability_agent.json",
user_name="sustainability_specialist",
retry_attempts=3,
context_length=180000,
long_term_memory=memory_sustainability,
)
# Run the agents
risk_analysis_agent.run("What are the top financial and operational risks for a Delaware C Corp in healthcare?")
sustainability_agent.run("How can a Delaware C Corp in manufacturing improve its sustainability practices?")

@ -0,0 +1,65 @@
from swarms import Agent
from swarm_models import OpenAIChat
from swarms_memory import ChromaDB
import os
# Initialize memory for agents
memory_risk = ChromaDB(metric="cosine", output_dir="risk_analysis_results")
memory_sustainability = ChromaDB(metric="cosine", output_dir="sustainability_results")
# Initialize model
model = OpenAIChat(api_key=os.getenv("OPENAI_API_KEY"), model_name="gpt-4o-mini", temperature=0.1)
# Initialize Risk Analysis Agent
risk_analysis_agent = Agent(
agent_name="Delaware-C-Corp-Risk-Analysis-Agent",
system_prompt="You are a specialized risk analysis agent focused on assessing risks.",
agent_description="Performs risk analysis for Delaware C Corps.",
llm=model,
max_loops=3,
autosave=True,
dashboard=False,
verbose=True,
dynamic_temperature_enabled=True,
saved_state_path="delaware_c_corp_risk_analysis_agent.json",
user_name="risk_analyst_user",
retry_attempts=2,
context_length=200000,
long_term_memory=memory_risk,
)
# Initialize Sustainability Agent
sustainability_agent = Agent(
agent_name="Delaware-C-Corp-Sustainability-Agent",
system_prompt="You are a sustainability analysis agent focused on ESG factors.",
agent_description="Analyzes sustainability practices for Delaware C Corps.",
llm=model,
max_loops=2,
autosave=True,
dashboard=False,
verbose=True,
dynamic_temperature_enabled=False,
saved_state_path="delaware_c_corp_sustainability_agent.json",
user_name="sustainability_specialist",
retry_attempts=3,
context_length=180000,
long_term_memory=memory_sustainability,
)
# Run the agents
risk_analysis_agent.run("What are the top financial and operational risks for a Delaware C Corp in healthcare?")
sustainability_agent.run("How can a Delaware C Corp in manufacturing improve its sustainability practices?")
from reflection_tuner import ReflectionTuner
# Initialize Reflection Tuners for each agent
risk_reflection_tuner = ReflectionTuner(risk_analysis_agent, reflection_steps=2)
sustainability_reflection_tuner = ReflectionTuner(sustainability_agent, reflection_steps=2)
# Run the agents with Reflection Tuning
risk_response = risk_reflection_tuner.reflect_and_tune("What are the top financial and operational risks for a Delaware C Corp in healthcare?")
sustainability_response = sustainability_reflection_tuner.reflect_and_tune("How can a Delaware C Corp in manufacturing improve its sustainability practices?")
print("Risk Analysis Agent Response:", risk_response)
print("Sustainability Agent Response:", sustainability_response)

@ -0,0 +1,94 @@
agents:
- agent_name: "Delaware-C-Corp-Tax-Deduction-Agent"
# model:
# model_name: "gpt-4o-mini"
# temperature: 0.1
# max_tokens: 2500
system_prompt: |
You are a highly specialized financial analysis agent focused on Delaware C Corps tax deductions. Your task is to provide expert advice on optimizing tax strategies for Delaware C Corps, ensuring compliance with all relevant tax laws and regulations. You should be well-versed in Delaware state tax codes and federal tax laws affecting C Corps. Your responses should include detailed explanations of tax deductions available to Delaware C Corps, including but not limited to:
- Research and Development (R&D) tax credits
- Depreciation and amortization
- Business expense deductions
- Charitable contributions
- State-specific tax incentives
- Federal tax deductions applicable to C Corps
max_loops: 1
autosave: true
dashboard: false
verbose: true
dynamic_temperature_enabled: true
saved_state_path: "delaware_c_corp_tax_deduction_agent.json"
user_name: "swarms_corp"
retry_attempts: 1
context_length: 250000
return_step_meta: false
output_type: "str" # Can be "json" or any other format
task: "What are the most effective tax deduction strategies for a Delaware C Corp in the technology industry?"
- agent_name: "Delaware-C-Corp-Tax-Optimization-Agent"
# model:
# model_name: "gpt-4o-mini"
# temperature: 0.2
# max_tokens: 2000
system_prompt: |
You are a highly specialized financial analysis agent focused on Delaware C Corps tax optimization. Your task is to provide expert advice on optimizing tax strategies for Delaware C Corps, ensuring compliance with all relevant tax laws and regulations. You should be well-versed in Delaware state tax codes and federal tax laws affecting C Corps. Your responses should include detailed explanations of tax optimization strategies available to Delaware C Corps, including but not limited to:
- Entity structure optimization
- Income shifting strategies
- Loss utilization and carryovers
- Tax-efficient supply chain management
- State-specific tax planning
- Federal tax planning applicable to C Corps
max_loops: 2
autosave: true
dashboard: false
verbose: true
dynamic_temperature_enabled: false
saved_state_path: "delaware_c_corp_tax_optimization_agent.json"
user_name: "tax_optimization_user"
retry_attempts: 3
context_length: 200000
return_step_meta: true
output_type: "str"
task: "How can a Delaware C Corp in the finance industry optimize its tax strategy for maximum savings?"
- agent_name: "Delaware-C-Corp-Risk-Analysis-Agent"
system_prompt: |
You are a specialized risk analysis agent focused on assessing financial, legal, and operational risks for Delaware C Corps.
Provide detailed risk assessments and suggest risk mitigation strategies. Your expertise should cover:
- Market risk analysis
- Operational risk analysis
- Compliance with Delaware and federal regulations
- Financial risk modeling
max_loops: 3
autosave: true
dashboard: false
verbose: true
dynamic_temperature_enabled: true
saved_state_path: "delaware_c_corp_risk_analysis_agent.json"
user_name: "risk_analyst_user"
retry_attempts: 2
context_length: 200000
return_step_meta: true
output_type: "json"
task: "What are the top financial and operational risks for a Delaware C Corp in the healthcare industry?"
- agent_name: "Delaware-C-Corp-Sustainability-Agent"
system_prompt: |
You are a sustainability analysis agent focused on evaluating and enhancing the economic sustainability of Delaware C Corps.
Your recommendations should address:
- Environmental, Social, and Governance (ESG) factors
- Resource management and waste reduction strategies
- Compliance with sustainability regulations and reporting
- Sustainable investment strategies
max_loops: 2
autosave: true
dashboard: false
verbose: true
dynamic_temperature_enabled: false
saved_state_path: "delaware_c_corp_sustainability_agent.json"
user_name: "sustainability_specialist"
retry_attempts: 3
context_length: 180000
return_step_meta: true
output_type: "str"
task: "How can a Delaware C Corp in the manufacturing industry improve its sustainability practices?"

@ -0,0 +1,129 @@
agents:
- agent_name: "Delaware-C-Corp-Tax-Deduction-Agent"
# model:
# model_name: "gpt-4o-mini"
# temperature: 0.1
# max_tokens: 2500
system_prompt: |
You are a highly specialized financial analysis agent focused on Delaware C Corps tax deductions. Your task is to provide expert advice on optimizing tax strategies for Delaware C Corps, ensuring compliance with all relevant tax laws and regulations. You should be well-versed in Delaware state tax codes and federal tax laws affecting C Corps. Your responses should include detailed explanations of tax deductions available to Delaware C Corps, including but not limited to:
- Research and Development (R&D) tax credits
- Depreciation and amortization
- Business expense deductions
- Charitable contributions
- State-specific tax incentives
- Federal tax deductions applicable to C Corps
max_loops: 1
autosave: true
dashboard: false
verbose: true
dynamic_temperature_enabled: true
saved_state_path: "delaware_c_corp_tax_deduction_agent.json"
user_name: "swarms_corp"
retry_attempts: 1
context_length: 250000
return_step_meta: false
output_type: "str" # Can be "json" or any other format
task: "What are the most effective tax deduction strategies for a Delaware C Corp in the technology industry?"
- agent_name: "Delaware-C-Corp-Tax-Optimization-Agent"
# model:
# model_name: "gpt-4o-mini"
# temperature: 0.2
# max_tokens: 2000
system_prompt: |
You are a highly specialized financial analysis agent focused on Delaware C Corps tax optimization. Your task is to provide expert advice on optimizing tax strategies for Delaware C Corps, ensuring compliance with all relevant tax laws and regulations. You should be well-versed in Delaware state tax codes and federal tax laws affecting C Corps. Your responses should include detailed explanations of tax optimization strategies available to Delaware C Corps, including but not limited to:
- Entity structure optimization
- Income shifting strategies
- Loss utilization and carryovers
- Tax-efficient supply chain management
- State-specific tax planning
- Federal tax planning applicable to C Corps
max_loops: 2
autosave: true
dashboard: false
verbose: true
dynamic_temperature_enabled: false
saved_state_path: "delaware_c_corp_tax_optimization_agent.json"
user_name: "tax_optimization_user"
retry_attempts: 3
context_length: 200000
return_step_meta: true
output_type: "str"
task: "How can a Delaware C Corp in the finance industry optimize its tax strategy for maximum savings?"
- agent_name: "Delaware-C-Corp-Risk-Analysis-Agent"
system_prompt: |
You are a specialized risk analysis agent focused on assessing financial, legal, and operational risks for Delaware C Corps.
Provide detailed risk assessments and suggest risk mitigation strategies. Your expertise should cover:
- Market risk analysis
- Operational risk analysis
- Compliance with Delaware and federal regulations
- Financial risk modeling
max_loops: 3
autosave: true
dashboard: false
verbose: true
dynamic_temperature_enabled: true
saved_state_path: "delaware_c_corp_risk_analysis_agent.json"
user_name: "risk_analyst_user"
retry_attempts: 2
context_length: 200000
return_step_meta: true
output_type: "json"
task: "What are the top financial and operational risks for a Delaware C Corp in the healthcare industry?"
- agent_name: "Delaware-C-Corp-Sustainability-Agent"
system_prompt: |
You are a sustainability analysis agent focused on evaluating and enhancing the economic sustainability of Delaware C Corps.
Your recommendations should address:
- Environmental, Social, and Governance (ESG) factors
- Resource management and waste reduction strategies
- Compliance with sustainability regulations and reporting
- Sustainable investment strategies
max_loops: 2
autosave: true
dashboard: false
verbose: true
dynamic_temperature_enabled: false
saved_state_path: "delaware_c_corp_sustainability_agent.json"
user_name: "sustainability_specialist"
retry_attempts: 3
context_length: 180000
return_step_meta: true
output_type: "str"
task: "How can a Delaware C Corp in the manufacturing industry improve its sustainability practices?"
- agent_name: "Delaware-C-Corp-Planner-Agent"
system_prompt: |
You are a planning agent focused on developing schedules, timelines, and strategic roadmaps for Delaware C Corps.
Your planning should account for company milestones, regulatory deadlines, and strategic goals. Provide organized,
step-by-step timelines, and resources.
max_loops: 2
autosave: true
dashboard: false
verbose: true
dynamic_temperature_enabled: true
saved_state_path: "delaware_c_corp_planner_agent.json"
user_name: "planner_user"
retry_attempts: 2
context_length: 150000
return_step_meta: true
output_type: "json"
task: "Create a quarterly strategic roadmap for a Delaware C Corp in the biotech industry."
- agent_name: "Delaware-C-Corp-Data-Collector-Agent"
system_prompt: |
You are a data collection agent specialized in gathering relevant data from open-source search engines, focusing on
market trends, regulatory updates, and industry insights. Use DuckDuckGo to collect accurate and up-to-date information.
max_loops: 3
autosave: true
dashboard: false
verbose: true
dynamic_temperature_enabled: true
saved_state_path: "delaware_c_corp_data_collector_agent.json"
user_name: "data_collector_user"
retry_attempts: 3
context_length: 200000
return_step_meta: true
output_type: "str"
task: "Find recent trends in tax strategies for corporations in the US using DuckDuckGo search."

@ -0,0 +1,26 @@
class ReflectionTuner:
def __init__(self, agent, reflection_steps=3):
self.agent = agent
self.reflection_steps = reflection_steps
def reflect_and_tune(self, initial_task):
response = self.agent.run(initial_task)
for step in range(self.reflection_steps):
# Analyzing the response and adjusting based on findings
feedback = self.analyze_response(response)
if feedback:
print(f"Reflection step {step + 1}: Adjusting response based on feedback.")
response = self.agent.run(feedback) # Rerun with adjusted task or prompt
else:
print(f"No further tuning required at step {step + 1}. Final response achieved.")
break
return response
def analyze_response(self, response):
# Basic logic to analyze the response quality and determine next steps
if "error" in response.lower() or "incomplete" in response.lower():
return "Please refine the explanation and address missing points."
elif "unclear" in response.lower() or "vague" in response.lower():
return "Provide a more detailed and specific analysis."
return None # No adjustment required if response is satisfactory

@ -0,0 +1,58 @@
import os
import json
from datetime import datetime, timedelta
from collections import defaultdict
class TokenCache:
def __init__(self, cache_duration_minutes=30):
self.token_cache = defaultdict(lambda: {"token": None, "expires": datetime.now()})
self.cache_duration = timedelta(minutes=cache_duration_minutes)
def get_token(self, agent_name):
cached_token = self.token_cache[agent_name]
if cached_token["token"] and cached_token["expires"] > datetime.now():
print(f"Using cached token for {agent_name}.")
return cached_token["token"]
return None # Token has expired or does not exist
def set_token(self, agent_name, token):
self.token_cache[agent_name] = {
"token": token,
"expires": datetime.now() + self.cache_duration,
}
class AdaptiveAgentFactory:
def __init__(self, model, token_cache, reflection_steps=2):
self.model = model
self.token_cache = token_cache
self.reflection_steps = reflection_steps
def create_agent(self, agent_name, system_prompt, task, memory):
cached_token = self.token_cache.get_token(agent_name)
if cached_token:
return cached_token
# Create new agent instance with unique parameters
new_agent = Agent(
agent_name=agent_name,
system_prompt=system_prompt,
agent_description=f"Adaptive agent for {task}",
llm=self.model,
max_loops=3,
autosave=True,
dashboard=False,
verbose=True,
dynamic_temperature_enabled=True,
saved_state_path=f"{agent_name.lower().replace(' ', '_')}.json",
user_name="adaptive_user",
retry_attempts=2,
context_length=200000,
long_term_memory=memory,
)
# Generate a token for the new agent and cache it
token = f"{agent_name}_{datetime.now().strftime('%Y%m%d%H%M%S')}"
self.token_cache.set_token(agent_name, token)
print(f"Created new agent {agent_name} with token {token}.")
return new_agent
Loading…
Cancel
Save