MCPcopy
hub / github.com/TransformerOptimus/SuperAGI / run_superagi_cli

Function run_superagi_cli

test.py:41–106  ·  view source on GitHub ↗
(agent_name=None, agent_description=None, agent_goals=None)

Source from the content-addressed store, hash-verified

39
40
41def run_superagi_cli(agent_name=None, agent_description=None, agent_goals=None):
42 # Create default organization
43 organization = Organisation(name='Default Organization', description='Default organization description')
44 session.add(organization)
45 session.flush() # Flush pending changes to generate the agent's ID
46 session.commit()
47 logger.info(organization)
48
49 # Create default project associated with the organization
50 project = Project(name='Default Project', description='Default project description',
51 organisation_id=organization.id)
52 session.add(project)
53 session.flush() # Flush pending changes to generate the agent's ID
54 session.commit()
55 logger.info(project)
56
57 # Agent
58 if agent_name is None:
59 agent_name = input("Enter agent name: ")
60 if agent_description is None:
61 agent_description = input("Enter agent description: ")
62 agent = Agent(name=agent_name, description=agent_description, project_id=project.id)
63 session.add(agent)
64 session.flush()
65 session.commit()
66 logger.info(agent)
67
68 # Agent Config
69 # Create Agent Configuration
70 agent_config_values = {
71 "goal": ask_user_for_goals() if agent_goals is None else agent_goals,
72 "agent_type": "Type Non-Queue",
73 "constraints": ["~4000 word limit for short term memory. ",
74 "Your short term memory is short, so immediately save important information to files.",
75 "If you are unsure how you previously did something or want to recall past events, thinking about similar events will help you remember.",
76 "No user assistance",
77 "Exclusively use the commands listed in double quotes e.g. \"command name\""
78 ],
79 "tools": [],
80 "exit": "Default",
81 "iteration_interval": 0,
82 "model": "gpt-4",
83 "permission_type": "Default",
84 "LTM_DB": "Pinecone",
85 "memory_window": 10
86 }
87
88 agent_configurations = [
89 AgentConfiguration(agent_id=agent.id, key=key, value=str(value))
90 for key, value in agent_config_values.items()
91 ]
92
93 session.add_all(agent_configurations)
94 session.commit()
95 logger.info("Agent Config : ")
96 logger.info(agent_configurations)
97
98 # Create agent execution in RUNNING state associated with the agent

Callers 1

test.pyFile · 0.85

Calls 7

OrganisationClass · 0.90
ProjectClass · 0.90
AgentClass · 0.90
AgentConfigurationClass · 0.90
AgentExecutionClass · 0.90
ask_user_for_goalsFunction · 0.85
infoMethod · 0.80

Tested by

no test coverage detected