forked from CopilotKit/CopilotKit
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathagent.py
More file actions
41 lines (36 loc) · 1 KB
/
Copy pathagent.py
File metadata and controls
41 lines (36 loc) · 1 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
"""Agents"""
from typing import Optional, List, TypedDict
from abc import ABC, abstractmethod
from .types import Message
from .action import ActionDict
class AgentDict(TypedDict):
"""Agent dictionary"""
name: str
description: Optional[str]
class Agent(ABC):
"""Agent class for CopilotKit"""
def __init__(
self,
*,
name: str,
description: Optional[str] = None,
):
self.name = name
self.description = description
@abstractmethod
def execute( # pylint: disable=too-many-arguments
self,
*,
state: dict,
messages: List[Message],
thread_id: Optional[str] = None,
node_name: Optional[str] = None,
actions: Optional[List[ActionDict]] = None,
):
"""Execute the agent"""
def dict_repr(self) -> AgentDict:
"""Dict representation of the action"""
return {
'name': self.name,
'description': self.description or ''
}