mirror of https://github.com/kortix-ai/suna.git
wip
This commit is contained in:
parent
c606e9555a
commit
0b6f6fd103
|
@ -55,6 +55,7 @@ pip install agentpress
|
||||||
thread_id=thread_id,
|
thread_id=thread_id,
|
||||||
system_message=system_message,
|
system_message=system_message,
|
||||||
model_name="gpt-4o",
|
model_name="gpt-4o",
|
||||||
|
use_tools=True,
|
||||||
execute_model_tool_calls=True
|
execute_model_tool_calls=True
|
||||||
)
|
)
|
||||||
print("Response:", response)
|
print("Response:", response)
|
||||||
|
|
50
agent.py
50
agent.py
|
@ -5,12 +5,23 @@ from tools.files_tool import FilesTool
|
||||||
from agentpress.state_manager import StateManager
|
from agentpress.state_manager import StateManager
|
||||||
from tools.terminal_tool import TerminalTool
|
from tools.terminal_tool import TerminalTool
|
||||||
|
|
||||||
async def run_agent(
|
async def run_agent():
|
||||||
thread_manager: ThreadManager,
|
# Initialize managers and tools
|
||||||
thread_id: int,
|
thread_manager = ThreadManager()
|
||||||
state_manager: StateManager,
|
state_manager = StateManager("state.json")
|
||||||
max_iterations: int = 10
|
thread_id = await thread_manager.create_thread()
|
||||||
):
|
|
||||||
|
thread_manager.add_tool(FilesTool)
|
||||||
|
thread_manager.add_tool(TerminalTool)
|
||||||
|
|
||||||
|
await thread_manager.add_message(
|
||||||
|
thread_id,
|
||||||
|
{
|
||||||
|
"role": "user",
|
||||||
|
"content": "Let's create a marketing website."
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
async def init():
|
async def init():
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
@ -34,6 +45,8 @@ async def run_agent(
|
||||||
await init()
|
await init()
|
||||||
|
|
||||||
iteration = 0
|
iteration = 0
|
||||||
|
max_iterations = 1
|
||||||
|
|
||||||
while iteration < max_iterations:
|
while iteration < max_iterations:
|
||||||
iteration += 1
|
iteration += 1
|
||||||
await pre_iteration()
|
await pre_iteration()
|
||||||
|
@ -66,6 +79,8 @@ async def run_agent(
|
||||||
execute_model_tool_calls=True
|
execute_model_tool_calls=True
|
||||||
)
|
)
|
||||||
|
|
||||||
|
print(response)
|
||||||
|
|
||||||
await after_iteration()
|
await after_iteration()
|
||||||
|
|
||||||
await finalizer()
|
await finalizer()
|
||||||
|
@ -73,26 +88,5 @@ async def run_agent(
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
async def main():
|
async def main():
|
||||||
thread_manager = ThreadManager()
|
await run_agent()
|
||||||
state_manager = StateManager("state.json")
|
|
||||||
thread_id = await thread_manager.create_thread()
|
|
||||||
|
|
||||||
thread_manager.add_tool(FilesTool)
|
|
||||||
thread_manager.add_tool(TerminalTool)
|
|
||||||
|
|
||||||
await thread_manager.add_message(
|
|
||||||
thread_id,
|
|
||||||
{
|
|
||||||
"role": "user",
|
|
||||||
"content": "Let's create a marketing website."
|
|
||||||
}
|
|
||||||
)
|
|
||||||
|
|
||||||
await run_agent(
|
|
||||||
thread_manager=thread_manager,
|
|
||||||
thread_id=thread_id,
|
|
||||||
state_manager=state_manager,
|
|
||||||
max_iterations=5
|
|
||||||
)
|
|
||||||
|
|
||||||
asyncio.run(main())
|
asyncio.run(main())
|
||||||
|
|
Loading…
Reference in New Issue