에이전트 저장소를 사용하여 팀과 프로젝트 전반에 걸쳐 에이전트를 공유하고 재사용하는 방법을 알아보세요
생각: 이제 훌륭한 답변을 드릴 수 있습니다.
최종 답변:
Agent Repositories는 엔터프라이즈 사용자가 팀과 프로젝트 전반에 걸쳐 agent 정의를 저장, 공유, 재사용할 수 있도록 합니다. 이 기능을 통해 조직은 표준화된 agent의 중앙 라이브러리를 유지할 수 있어 일관성을 높이고 중복 작업을 줄일 수 있습니다.
코드에서 from_repository 파라미터를 사용하여 리포지토리에서 에이전트를 불러올 수 있습니다:
Copy
Ask AI
from crewai import Agent# Create an agent by loading it from a repository# The agent is loaded with all its predefined configurationsresearcher = Agent( from_repository="market-research-agent")
researcher = Agent( from_repository="market-research-agent", goal="Research the latest trends in AI development", # Override the repository goal verbose=True # Add a setting not in the repository)
from crewai import Crew, Agent, Task# Load agents from repositoriesresearcher = Agent( from_repository="market-research-agent")writer = Agent( from_repository="content-writer-agent")# Create tasksresearch_task = Task( description="Research the latest trends in AI", agent=researcher)writing_task = Task( description="Write a comprehensive report based on the research", agent=writer)# Create the crewcrew = Crew( agents=[researcher, writer], tasks=[research_task, writing_task], verbose=True)# Run the crewresult = crew.kickoff()
kickoff() 메서드를 이용해 repository agent를 직접 사용하여 보다 간단하게 상호작용할 수도 있습니다:
Copy
Ask AI
from crewai import Agentfrom pydantic import BaseModelfrom typing import List# 구조화된 출력 형식 정의class MarketAnalysis(BaseModel): key_trends: List[str] opportunities: List[str] recommendation: str# 저장소에서 agent 불러오기analyst = Agent( from_repository="market-analyst-agent", verbose=True)# 자유 형식 응답 받기result = analyst.kickoff("Analyze the AI market in 2025")print(result.raw) # 원시 응답 접근# 구조화된 출력 받기structured_result = analyst.kickoff( "Provide a structured analysis of the AI market in 2025", response_format=MarketAnalysis)# 구조화된 데이터 접근print(f"Key Trends: {structured_result.pydantic.key_trends}")print(f"Recommendation: {structured_result.pydantic.recommendation}")