| from typing import List | |
| from pmcp.agents.agent_base import AgentBlueprint | |
| from langchain_core.tools import BaseTool | |
| from langchain_openai import ChatOpenAI | |
| from pmcp.models.state import PlanningState | |
| from loguru import logger | |
| SYSTEM_PROMPT = """ | |
| You are an assistant that can manage Trello boards and projects. | |
| You will be given a set of tools to work with. | |
| """ | |
| class TrelloAgent: | |
| def __init__(self, tools: List[BaseTool], llm: ChatOpenAI): | |
| self.agent = AgentBlueprint( | |
| agent_name="TRELLO_AGENT", | |
| description="The agent that performs actions on Trello", | |
| tools=tools, | |
| system_prompt=SYSTEM_PROMPT.strip(), | |
| llm=llm, | |
| ) | |
| def call_trello_agent(self, state: PlanningState): | |
| logger.info("Calling Trello Agent...") | |
| response = self.agent.call_agent(state.messages) | |
| return {"messages": [response]} | |
| async def acall_trello_agent(self, state: PlanningState): | |
| logger.info("Calling Trello Agent...") | |
| response = await self.agent.acall_agent(state.messages) | |
| return {"messages": [response]} | |