File size: 1,115 Bytes
a438cae
 
 
 
 
0235be8
 
cb09459
 
a438cae
 
 
1cd0db8
a438cae
 
 
 
 
9893f68
a438cae
 
 
 
 
 
 
0235be8
cb09459
 
a438cae
 
0235be8
cb09459
 
a438cae
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
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]}