Files
ckb/l1.py
2025-05-28 16:34:20 +01:00

49 lines
1.3 KiB
Python

import asyncio
from langchain_core.tools import tool
from agents.agent_tasks.scan_file import tools
from agents.agent_templates import AgentTemplate
from utils.db_connections import init_db
from agents.prompts import general_prompt_param_builder
from utils.ssh_connections.ssh_operations import is_file_exist
@tool
def get_daily_string(salt: str):
"""
:param salt: a random string
:return:get today's string
"""
return "assss"
async def main():
init_db()
temp1 = AgentTemplate()
temp1.set_model("gpt-4.1-nano", "openai")
temp1.set_mcp_server("terminal_tools", {
'transport': 'sse',
'headers': {
"X-Api-Key": "bd303c2f2a515b4ce70c1f07ee85530c2"
},
'url': 'http://localhost:5050/sse'
})
temp1.set_builtin_tools(tools)
temp1.set_template_params(general_prompt_param_builder(
agent_role="assistant",
task_description="test, call update_code_result_to_db tool with arbitrary valid input"
))
agent = await temp1.async_get_instance()
r1 = await agent.ainvoke({
'user_msg': 'test'
})
# for t in tools:
# if t.name == 'update_code_result_to_db':
# print(t)
print(r1)
print(is_file_exist("./Guide"))
if __name__ == '__main__':
asyncio.run(main())