-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Expand file tree
/
Copy pathmain.py
More file actions
58 lines (50 loc) · 1.78 KB
/
main.py
File metadata and controls
58 lines (50 loc) · 1.78 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
import asyncio
from textwrap import dedent
import os
from dotenv import load_dotenv
from agno.agent import Agent
from agno.models.nebius import Nebius
from agno.tools.mcp import MCPTools
load_dotenv()
async def run_gibsonai_agent(message: str):
"""Run the GibsonAI agent with the given message."""
mcp_tools = MCPTools(
"uvx --from gibson-cli@latest gibson mcp run",
timeout_seconds=300, # Extended timeout for GibsonAI operations
)
# Connect to the MCP server
await mcp_tools.connect()
agent = Agent(
name="GibsonAIAgent",
model=Nebius(
id="meta-llama/Meta-Llama-3.1-70B-Instruct",
api_key=os.getenv("NEBIUS_API_KEY") # Explicitly pass the API key
),
tools=[mcp_tools],
description="Agent for managing database projects and schemas",
instructions=dedent("""\
You are a GibsonAI database assistant. Help users manage their database projects and schemas.
Your capabilities include:
- Creating new GibsonAI projects
- Managing database schemas (tables, columns, relationships)
- Deploying schema changes to hosted databases
- Querying database schemas and data
- Providing insights about database structure and best practices
"""),
markdown=True,
show_tool_calls=True,
)
# Run the agent
await agent.aprint_response(message, stream=True)
# Close the MCP connection
await mcp_tools.close()
# Example usage
if __name__ == "__main__":
asyncio.run(
run_gibsonai_agent(
"""
Create a new GibsonAI project for my Blog Application.
You can decide the schema of the tables without double checking with me.
"""
)
)