メインコンテンツまでスキップ

はじめてのエージェント

agenticstar-platform SDK を使って、最小構成のカスタムエージェントを作成・実行するまでの手順です。

前提条件

  • Python 3.12 以上
  • pip

手順

1. SDK のインストール

curl
pip install agenticstar-platform

2. エージェントの作成

my_agent.py を作成します。

Python
from agenticstar import Agent, AgentConfig

config = AgentConfig(
name="my-first-agent",
description="はじめてのカスタムエージェント",
llm_model="gpt-4",
)

class MyAgent(Agent):
async def run(self, message: str) -> str:
# LLM を呼び出してレスポンスを生成
response = await self.llm.chat(message)
return response.content

if __name__ == "__main__":
agent = MyAgent(config)
agent.serve()

3. エージェントの起動

curl
python my_agent.py

エージェントが http://localhost:8000 で起動します。

4. 動作確認

curl
curl -X POST http://localhost:8000/chat \
-H "Content-Type: application/json" \
-d '{"message": "こんにちは"}'

次のステップ