from upsonic import Task, Agent
# Docker-based MCP server
class DatabaseMCP:
command = "docker"
args = [
"run",
"--rm",
"-i",
"--network", "host",
"your-mcp-server-image:latest"
]
env = {
"DATABASE_URL": "postgresql://localhost/mydb"
}
# Create task
task = Task(
description="Connect to the PostgreSQL database container, query the latest 100 transactions, and analyze them for potential anomalies.",
tools=[DatabaseMCP]
)
# Create agent
agent = Agent(
name="Database Agent",
model="openai/gpt-4o"
)
# Execute
result = agent.do(task)
print(result)