Artificial Intelligence
AgentOps ã«ããèªåŸãšãŒãžã§ã³ã: AI ã¢ããªã±ãŒã·ã§ã³ã®å¯èŠ³æž¬æ§ã远跡å¯èœæ§ããããŠãã以äžã®æ©èœ

å€§èŠæš¡èšèªã¢ãã« (LLM) ã®ãããªåºç€ã¢ãã« (FM) ã«ããèªåŸãšãŒãžã§ã³ãã®æé·ã«ãããè€éã§è€æ°ã®ã¹ãããããæãåé¡ã解決ããæ¹æ³ãæ¹é©ãããŸããããããã®ãšãŒãžã§ã³ãã¯ãæšè«ãããŒã«ã®äœ¿çšãã¡ã¢ãªãçµã¿åãããè€éãªã¯ãŒã¯ãããŒãããã²ãŒãããªããã顧客ãµããŒããããœãããŠã§ã¢ ãšã³ãžãã¢ãªã³ã°ãŸã§ããŸããŸãªã¿ã¹ã¯ãå®è¡ããŸãã
ãã ãããããã®ã·ã¹ãã ã®æ©èœãšè€éããå¢ãã«ã€ããŠã芳枬å¯èœæ§ãä¿¡é Œæ§ãã³ã³ãã©ã€ã¢ã³ã¹ã«é¢ãã課é¡ãçããŸãã
ããã§ AgentOps ãç»å ŽããŸããããã¯ãDevOps ãš MLOps ãã¢ãã«ã«ããæŠå¿µã§ãããFM ããŒã¹ã®ãšãŒãžã§ã³ãã®ã©ã€ããµã€ã¯ã«ã管çããããã«ã«ã¹ã¿ãã€ãºãããŠããŸãã
AgentOps ãšã¯äœã§ãã?
AgentOps ãšã¯ãéçšç°å¢ã§ FM ããŒã¹ã®èªåŸãšãŒãžã§ã³ããèšèšãå±éãç£èŠãæé©åããããã«å¿ èŠãªãšã³ãããŒãšã³ãã®ããã»ã¹ãããŒã«ããã¬ãŒã ã¯ãŒã¯ãæããŸãããã®ç®æšã¯æ¬¡ã®ãšããã§ãã
- å¯èŠ³æž¬æ§ïŒ ãšãŒãžã§ã³ãã®å®è¡ãšæææ±ºå®ã®ããã»ã¹ãå®å šã«å¯èŠåããŸãã
- ãã¬ãŒãµããªãã£ïŒ ãããã°ãæé©åãã³ã³ãã©ã€ã¢ã³ã¹ã®ããã«ããšãŒãžã§ã³ãã®ã©ã€ããµã€ã¯ã«å šäœã«ããã£ãŠè©³çŽ°ãªææç©ããã£ããã£ããŸãã
- ä¿¡é Œæ§ïŒ ç£èŠãšå ç¢ãªã¯ãŒã¯ãããŒãéããŠãäžè²«æ§ãšä¿¡é Œæ§ã®é«ãåºåãä¿èšŒããŸãã
AgentOps ã¯ãå埩çãªãã«ãã¹ããã ã¯ãŒã¯ãããŒãããŒã«çµ±åãé©å¿åã¡ã¢ãªãéèŠããªããã峿 Œãªè¿œè·¡ãšç£èŠãç¶æããæ¬è³ªçã«åŸæ¥ã® MLOps ãè¶ ããŠããŸãã
AgentOps ã解決ããäž»ãªèª²é¡
1. ã®è€éã ãšãŒãžã§ã³ãã·ã¹ãã
èªåŸãšãŒãžã§ã³ãã¯ãåºå€§ãªã¢ã¯ã·ã§ã³ ã¹ããŒã¹å šäœã§ã¿ã¹ã¯ãåŠçããåã¹ãããã§æ±ºå®ãäžãå¿ èŠããããŸãããã®è€éãã«ãããé«åºŠãªèšç»ãšç£èŠã®ã¡ã«ããºã ãå¿ èŠã«ãªããŸãã
2. å¯èŠ³æž¬æ§ã®èŠä»¶
å»ç蚺æãæ³çåæãªã©ã®éèŠãªãŠãŒã¹ã±ãŒã¹ã§ã¯ããã现ããªè¿œè·¡å¯èœæ§ãæ±ããããŸããEU AI æ³ãªã©ã®èŠå¶ã«æºæ ããããšã§ãå ç¢ãªå¯èŠ³æž¬æ§ãã¬ãŒã ã¯ãŒã¯ã®å¿ èŠæ§ãããã«åŒ·èª¿ãããŸãã
3. ãããã°ãšæé©å
ãšãŒãžã§ã³ãã®ã¢ã¯ã·ã§ã³ã®è©³çްãªãã¬ãŒã¹ããªããã°ãè€æ°ã¹ãããã®ã¯ãŒã¯ãããŒã§ãšã©ãŒãç¹å®ããããäžéåºåãè©äŸ¡ãããããããšã¯å°é£ã§ãã
4. ã¹ã±ãŒã©ããªãã£ãšã³ã¹ã管ç
ãšãŒãžã§ã³ããæ¬çªç°å¢ã«ã¹ã±ãŒãªã³ã°ããã«ã¯ãå質ãæãªãããšãªãå¹çã確ä¿ããããã«ãã¬ã€ãã³ã·ãããŒã¯ã³äœ¿çšéãéçšã³ã¹ããªã©ã®ã¡ããªãã¯ãç£èŠããå¿ èŠããããŸãã
AgentOps ãã©ãããã©ãŒã ã®ã³ã¢æ©èœ
1. ãšãŒãžã§ã³ãã®äœæãšã«ã¹ã¿ãã€ãº
éçºè ã¯ãã³ã³ããŒãã³ãã®ã¬ãžã¹ããªã䜿çšããŠãšãŒãžã§ã³ããæ§æã§ããŸãã
- 圹å²ïŒ 責任ãå®çŸ©ããŸãïŒäŸïŒç ç©¶è ããã©ã³ããŒïŒã
- ã¬ãŒãã¬ãŒã«ïŒ å«ççã§ä¿¡é Œã§ããè¡åã確ä¿ããããã«å¶çŽãèšå®ããŸãã
- ããŒã«ããã: APIãããŒã¿ããŒã¹ããŸãã¯ãã¬ããžã°ã©ããšã®çµ±åãæå¹ã«ããŸãã
ãšãŒãžã§ã³ãã¯ãäºåå®çŸ©ãããã«ãŒã«ãžã®æºæ ãç¶æããªãããç¹å®ã®ããŒã¿ã»ãããããŒã«ãããã³ãããšå¯Ÿè©±ããããã«æ§ç¯ãããŠããŸãã
2. å¯èŠ³æž¬æ§ãšãã¬ãŒã¹
AgentOps ã¯è©³çްãªå®è¡ãã°ããã£ããã£ããŸãã
- ãã¬ãŒã¹ïŒ LLM åŒã³åºãããããŒã«ã®äœ¿çšãŸã§ããšãŒãžã§ã³ãã®ã¯ãŒã¯ãããŒã®ãã¹ãŠã®ã¹ããããèšé²ããŸãã
- ã¹ãã³: ãã¬ãŒã¹ããååŸãåã蟌ã¿çæãããŒã«ã®åŒã³åºããªã©ã®çްããã¹ãããã«åè§£ããŸãã
- ã¢ãŒãã£ãã¡ã¯ãïŒ ãããã°ãæ¯æŽããããã«ãäžéåºåãã¡ã¢ãªç¶æ ãããã³ãã ãã³ãã¬ãŒãã远跡ããŸãã
Langfuse ã Arize ãªã©ã®å¯èŠ³æž¬æ§ããŒã«ã¯ããããã®ãã¬ãŒã¹ãèŠèŠåããããã·ã¥ããŒããæäŸããããã«ããã¯ããšã©ãŒã®ç¹å®ã«åœ¹ç«ã¡ãŸãã
3. è¿ éãªç®¡ç
ããã³ãã ãšã³ãžãã¢ãªã³ã°ã¯ããšãŒãžã§ã³ãã®åäœã圢æããäžã§éèŠãªåœ¹å²ãæãããŸããäž»ãªæ©èœã¯æ¬¡ã®ãšããã§ãã
- ããŒãžã§ãã³ã°ïŒ ããã©ãŒãã³ã¹æ¯èŒã®ããã«ããã³ãââãã®å埩ã远跡ããŸãã
- ã€ã³ãžã§ã¯ã·ã§ã³æ€åº: ããã³ããå ã®æªæã®ããã³ãŒããŸãã¯å ¥åãšã©ãŒãèå¥ããŸãã
- æé©åïŒ Chain-of-Thought (CoT) ã Tree-of-Thought ãªã©ã®ææ³ã¯æšè«èœåãåäžãããŸãã
4. ãã£ãŒãããã¯çµ±å
人éããã®ãã£ãŒãããã¯ã¯ãå埩çãªæ¹åã«ãšã£ãŠäŸç¶ãšããŠéèŠã§ãã
- æç€ºçãªãã£ãŒãããã¯: ãŠãŒã¶ãŒã¯åºåãè©äŸ¡ããããã³ã¡ã³ããæäŸãããããŸãã
- æé»ã®ãã£ãŒãããã¯: ã¿ã¹ã¯æéãã¯ãªãã¯ã¹ã«ãŒçãªã©ã®ææšãåæããŠãå¹æãæž¬å®ããŸãã
ãã®ãã£ãŒããã㯠ã«ãŒãã«ããããšãŒãžã§ã³ãã®ããã©ãŒãã³ã¹ãšãã¹ãã«äœ¿çšãããè©äŸ¡ãã³ãããŒã¯ã®äž¡æ¹ãæ¹åãããŸãã
5.è©äŸ¡ãšãã¹ã
AgentOps ãã©ãããã©ãŒã ã¯ã以äžã®åéã«ããã峿 Œãªãã¹ãã容æã«ããŸãã
- ãã³ãããŒã¯ïŒ ãšãŒãžã§ã³ãã®ããã©ãŒãã³ã¹ãæ¥çæšæºãšæ¯èŒããŸãã
- ã¹ããããã€ã¹ãããã®è©äŸ¡: ã¯ãŒã¯ãããŒã®äžéã¹ããããè©äŸ¡ããŠæ£ç¢ºæ§ã確èªããŸãã
- è»éè©äŸ¡: ãšãŒãžã§ã³ããåã£ãæææ±ºå®ãã¹ãæ€èšŒããŸãã
6. èšæ¶ãšç¥èã®çµ±å
ãšãŒãžã§ã³ãã¯ãã³ã³ããã¹ãïŒäŒè©±å±¥æŽãªã©ïŒã«ã¯çæèšæ¶ã掻çšããéå»ã®ã¿ã¹ã¯ããã®æŽå¯ãä¿åããããã«é·æèšæ¶ã掻çšããŸããããã«ããããšãŒãžã§ã³ãã¯æéã®çµéãšãšãã«äžè²«æ§ãç¶æããªããåçã«é©å¿ã§ããŸãã
7. ã¢ãã¿ãªã³ã°ãšã¡ããªã¯ã¹
å æ¬çãªç£èŠãã©ãã¯:
- ã¬ã€ãã³ã·ïŒ æé©åã®ããã«å¿çæéãæž¬å®ããŸãã
- ããŒã¯ã³ã®äœ¿çšæ³: ãªãœãŒã¹ã®æ¶è²»ãç£èŠããŠã³ã¹ãã管çããŸãã
- åè³ªææš: é¢é£æ§ãæ£ç¢ºæ§ãæ¯æ§ãè©äŸ¡ããŸãã
ãããã®ã¡ããªãã¯ã¯ããŠãŒã¶ãŒ ã»ãã·ã§ã³ãããã³ãããã¯ãŒã¯ãããŒãªã©ã®ãã£ã¡ã³ã·ã§ã³å šäœã§èŠèŠåããããªã¢ã«ã¿ã€ã ã®ä»å ¥ãå¯èœã«ãªããŸãã
远跡å¯èœãªéºç©ã®åé¡
ãã®è«æã§ã¯ãAgentOps ã®å¯èŠ³æž¬æ§ãæ¯ããã¢ãŒãã£ãã¡ã¯ãã®äœç³»çãªå顿³ã玹ä»ããŠããŸãã
- ãšãŒãžã§ã³ãäœæã¢ãŒãã£ãã¡ã¯ã: 圹å²ãç®æšãå¶çŽã«é¢ããã¡ã¿ããŒã¿ã
- å®è¡ã¢ãŒãã£ãã¡ã¯ã: ããŒã«åŒã³åºãããµãã¿ã¹ã¯ ãã¥ãŒãããã³æšè«æé ã®ãã°ã
- è©äŸ¡ã¢ãŒãã£ãã¡ã¯ã: ãã³ãããŒã¯ããã£ãŒããã㯠ã«ãŒããã¹ã³ã¢ãªã³ã° ã¡ããªãã¯ã
- ãã¬ãŒã¹ã¢ãŒãã£ãã¡ã¯ã: 詳现ãªç£èŠã®ããã®ã»ãã·ã§ã³ IDããã¬ãŒã¹ IDãã¹ãã³ã
ãã®åé¡ã«ããããšãŒãžã§ã³ãã®ã©ã€ããµã€ã¯ã«å šäœã§äžè²«æ§ãšæç¢ºæ§ã確ä¿ããããããã°ãšã³ã³ãã©ã€ã¢ã³ã¹ã®ç®¡çã容æã«ãªããŸãã
ãšãŒãžã§ã³ããªãã¬ãŒã·ã§ã³ (ããŒã«) ãŠã©ãŒã¯ã¹ã«ãŒ
ããã§ã¯ãAgentOps ãèšå®ããŠäœ¿çšããAI ãšãŒãžã§ã³ããç£èŠããã³æé©åããæ¹æ³ã«ã€ããŠèª¬æããŸãã
ã¹ããã1: AgentOps SDKãã€ã³ã¹ããŒã«ãã
奜ã¿ã® Python ããã±ãŒãž ãããŒãžã£ãŒã䜿çšã㊠AgentOps ãã€ã³ã¹ããŒã«ããŸãã
pip install agentops
ã¹ããã2: AgentOpsãåæåãã
ãŸããAgentOpsãã€ã³ããŒãããAPIããŒã䜿çšããŠåæåããŸããAPIããŒã .env
ã»ãã¥ãªãã£çšã®ãã¡ã€ã«:
# Initialize AgentOps with API Key import agentops import os from dotenv import load_dotenv # Load environment variables load_dotenv() AGENTOPS_API_KEY = os.getenv("AGENTOPS_API_KEY") # Initialize the AgentOps client agentops.init(api_key=AGENTOPS_API_KEY, default_tags=["my-first-agent"])
ãã®ã¹ãããã§ã¯ãã¢ããªã±ãŒã·ã§ã³å ã®ãã¹ãŠã® LLM ã€ã³ã¿ã©ã¯ã·ã§ã³ã®å¯èŠ³æž¬æ§ãèšå®ããŸãã
ã¹ããã3: ãã³ã¬ãŒã¿ã䜿çšããŠã¢ã¯ã·ã§ã³ãèšé²ãã
ç¹å®ã®é¢æ°ãèšæž¬ããã«ã¯ã @record_action
ãã³ã¬ãŒã¿ã¯ããã©ã¡ãŒã¿ãå®è¡æéãåºåã远跡ããŸããæ¬¡ã«äŸã瀺ããŸãã
from agentops import record_action @record_action("custom-action-tracker") def is_prime(number): """Check if a number is prime.""" if number < 2: return False for i in range(2, int(number**0.5) + 1): if number % i == 0: return False return True
ãã®é¢æ°ã¯ AgentOps ããã·ã¥ããŒãã«èšé²ãããå®è¡æéãšå ¥åºå远跡ã®ã¡ããªãã¯ãæäŸãããŸãã
ã¹ããã4: æåãšãŒãžã§ã³ãã远跡ãã
ååä»ããšãŒãžã§ã³ãã䜿çšããŠããå Žåã¯ã @track_agent
ãã¹ãŠã®ã¢ã¯ã·ã§ã³ãšã€ãã³ããç¹å®ã®ãšãŒãžã§ã³ãã«çµã³ä»ãããã³ã¬ãŒã¿ã
from agentops import track_agent @track_agent(name="math-agent") class MathAgent: def __init__(self, name): self.name = name def factorial(self, n): """Calculate factorial recursively.""" return 1 if n == 0 else n * self.factorial(n - 1)
ãã®ãšãŒãžã§ã³ãå
ã®ã¢ã¯ã·ã§ã³ãLLMåŒã³åºãã¯ã "math-agent"
ã¿ã°ã
ã¹ããã5: ãã«ããšãŒãžã§ã³ããµããŒã
è€æ°ã®ãšãŒãžã§ã³ãã䜿çšããã·ã¹ãã ã§ã¯ããšãŒãžã§ã³ãéã§ã€ãã³ãã远跡ããŠãç£èŠæ§ãåäžãããããšãã§ããŸããæ¬¡ã«äŸã瀺ããŸãã
@track_agent(name="qa-agent") class QAAgent: def generate_response(self, prompt): return f"Responding to: {prompt}" @track_agent(name="developer-agent") class DeveloperAgent: def generate_code(self, task_description): return f"# Code to perform: {task_description}" qa_agent = QAAgent() developer_agent = DeveloperAgent() response = qa_agent.generate_response("Explain observability in AI.") code = developer_agent.generate_code("calculate Fibonacci sequence")
åé話ã¯ãããããã®ãšãŒãžã§ã³ãã®ãã¬ãŒã¹ã®äžã® AgentOps ããã·ã¥ããŒãã«è¡šç€ºãããŸãã
ã¹ããã6: ã»ãã·ã§ã³ãçµäºãã
ã»ãã·ã§ã³ã®çµäºãç¥ãããã«ã¯ã end_session
ã¡ãœããããªãã·ã§ã³ã§ã»ãã·ã§ã³ç¶æ
ïŒSuccess
or Fail
ïŒãšçç±ã
# End of session agentops.end_session(state="Success", reason="Completed workflow")
ããã«ããããã¹ãŠã®ããŒã¿ããã°ã«èšé²ãããAgentOps ããã·ã¥ããŒãã§ã¢ã¯ã»ã¹ã§ããããã«ãªããŸãã
ã¹ããã7: AgentOpsããã·ã¥ããŒãã§èŠèŠåãã
ãã±ãŒã·ã§ã³éžæ AgentOpsããã·ã¥ããŒã æ¢çŽ¢ããïŒ
- ã»ãã·ã§ã³ãªãã¬ã€: ã¹ãããããšã®å®è¡ãã¬ãŒã¹ã
- ã¢ããªãã£ã¯ã¹ïŒ LLM ã³ã¹ããããŒã¯ã³äœ¿çšéãããã³ã¬ã€ãã³ã· ã¡ããªãã¯ã
- ãšã©ãŒæ€åºïŒ é害ãååž°ã«ãŒããèå¥ããŠãããã°ããŸãã
匷åãããäŸ: ååž°çæèæ€åº
AgentOps ã¯ããšãŒãžã§ã³ã ã¯ãŒã¯ãããŒã®ååž°ã«ãŒãã®æ€åºããµããŒãããŠããŸããåã®äŸãååž°æ€åºã§æ¡åŒµããŠã¿ãŸãããã