GerlandoRex's picture
add(agents): loggers + system prompt in base agent + filtering AI Messages in human resume
cb09459
from typing import List, Optional
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 GithubAgent:
def __init__(self, llm: ChatOpenAI, tools: Optional[List[BaseTool]] = None):
self.agent = AgentBlueprint(
agent_name="GITHUB_AGENT",
description="The agent that performs actions on Github",
tools=tools,
system_prompt=SYSTEM_PROMPT.strip(),
llm=llm,
)
def call_github_agent(self, state: PlanningState):
logger.info("Calling Github agent...")
response = self.agent.call_agent(state.messages)
return {"messages": [response]}
async def acall_github_agent(self, state: PlanningState):
logger.info("Calling Github agent...")
response = await self.agent.acall_agent(state.messages)
return {"messages": [response]}