본문 바로가기
WIKI 기술 지식 베이스

Agent tool

원문 보기 위키 갱신

출처: 문서

본문

Agent 도구

2.13에 도입 {: .label .label-purple }

AgentTool은 어떤 에이전트든 실행해요.

1단계: AgentTool이 실행할 에이전트 설정하기

아무 에이전트나 설정하면 돼요. 예를 들어 ML Model Tool 문서의 단계를 따라 MLModelTool을 실행하는 flow agent를 설정하고, 3단계에서 해당 에이전트의 에이전트 ID를 받으세요.

{
  "agent_id": "9X7xWI0Bpc3sThaJdY9i"
}

2단계: AgentTool을 실행할 flow agent 등록하기

flow agent는 여러 도구를 순서대로 실행하고 마지막 도구의 출력을 반환해요. flow agent를 만들려면 이전 단계에서 받은 에이전트 ID를 넣어서 다음 에이전트 등록 요청을 보내세요:

POST /_plugins/_ml/agents/_register
{
  "name": "Test agent tool",
  "type": "flow",
  "description": "this is a test agent",
  "tools": [
    {
      "type": "AgentTool",
      "description": "A general agent to answer any question",
      "parameters": {
        "agent_id": "9X7xWI0Bpc3sThaJdY9i"
      }
    }
  ]
}

{% include copy-curl.html %}

파라미터에 대한 설명은 등록 파라미터를 참고하세요.

OpenSearch는 에이전트 ID를 응답으로 반환해요:

{
  "agent_id": "EQyyZ40BT2tRrkdmhT7_"
}

3단계: 에이전트 실행하기

다음 요청을 보내서 에이전트를 실행해 보세요:

POST /_plugins/_ml/agents/EQyyZ40BT2tRrkdmhT7_/_execute
{
  "parameters": {
    "question": "what's the population increase of Seattle from 2021 to 2023"
  }
}

{% include copy-curl.html %}

OpenSearch는 추론 결과를 반환해요:

{
  "inference_results": [
    {
      "output": [
        {
          "name": "response",
          "result": " I do not have direct data on the population increase of Seattle from 2021 to 2023 in the context provided. As a data analyst, I would need to research population statistics from credible sources like the US Census Bureau to analyze population trends and make an informed estimate. Without looking up actual data, I don't have enough information to provide a specific answer to the question."
        }
      ]
    }
  ]
}

등록 파라미터

다음 표는 에이전트를 등록할 때 사용할 수 있는 모든 도구 파라미터를 정리한 거예요.

파라미터 타입 필수/선택 설명
agent_id String 필수 실행할 에이전트의 에이전트 ID.

실행 파라미터

다음 표는 에이전트를 실행할 때 사용할 수 있는 모든 도구 파라미터를 정리한 거예요.

파라미터 타입 필수/선택 설명
question String 필수 LLM에 보낼 자연어 질문.

도구 테스트하기

이 도구는 에이전트 워크플로의 일부로 실행할 수도 있고, Execute Tool API를 사용해서 독립적으로 실행할 수도 있어요. Execute Tool API는 개별 도구를 테스트하거나 단독 작업을 수행할 때 유용해요.

더 알아보기 (Learn more)