> ## Documentation Index
> Fetch the complete documentation index at: https://docs.cartesia.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# SDK 概要

[Line SDK](https://github.com/cartesia-ai/line/) は、音声エージェントを構築するための Python フレームワークです。音声インフラストラクチャ、音声認識、会話フローを処理します。

```bash theme={null}
uv add cartesia-line
```

<Note>
  Line を初めて使う方は、[クイックスタート](/line/start-building/quickstart) から始めて、最初のエージェントを構築・デプロイしましょう。
</Note>

## 主要概念

| コンポーネント                                             | 目的                                              |
| --------------------------------------------------- | ----------------------------------------------- |
| [`Agent`](./agents)                                 | `process` メソッドを介して入出力イベントループを制御します              |
| [`LlmAgent`](./agents#llmagent)                     | LiteLLM を介して 100 以上の LLM プロバイダーをラップする組み込みエージェント |
| [`Tools`](./tools)                                  | エージェントが呼び出せる関数 — データベース参照、ハンドオフ、Web 検索など        |
| [`VoiceAgentApp`](./agents#handling-incoming-calls) | エージェントを Cartesia の音声インフラストラクチャに接続する HTTP サーバー   |

```python theme={null}
import os
from line.llm_agent import LlmAgent, LlmConfig, end_call
from line.voice_agent_app import VoiceAgentApp

async def get_agent(env, call_request):
    return LlmAgent(
        model="anthropic/claude-haiku-4-5-20251001",
        api_key=os.getenv("ANTHROPIC_API_KEY"),
        tools=[end_call],
        config=LlmConfig(
            system_prompt="You are a helpful assistant.",
            introduction="Hello! How can I help you today?",
        ),
    )

app = VoiceAgentApp(get_agent=get_agent)
```

通話開始時にエージェントは `introduction` を話し、その後 LLM を使ってユーザーの発話に応答します。

## 機能

* **リアルタイムの割り込みサポート** — 音声の割り込みやターンテイキングを最初から処理します。
* **ツール呼び出し** — データベース、API、外部サービスに接続
* **マルチエージェントのハンドオフ** — 特化型エージェント間で会話をルーティング
* **Web 検索** — リアルタイム情報検索のための組み込みツール

## 機能を追加する

### 情報を参照する

```python theme={null}
from typing import Annotated
from line.llm_agent import loopback_tool

@loopback_tool
async def get_order_status(ctx, order_id: Annotated[str, "The order ID"]):
    """Look up an order's current status."""
    order = await db.get_order(order_id)
    return f"Order {order_id} is {order.status}"
```

### 別のエージェントへハンドオフする

```python theme={null}
from line.llm_agent import LlmAgent, LlmConfig, agent_as_handoff, end_call

spanish_agent = LlmAgent(
    model="gpt-5-nano",
    api_key=os.getenv("OPENAI_API_KEY"),
    tools=[end_call],
    config=LlmConfig(
        system_prompt="You speak only in Spanish.",
        introduction="¡Hola! ¿Cómo puedo ayudarte?",
    ),
)

main_agent = LlmAgent(
    model="anthropic/claude-haiku-4-5-20251001",
    api_key=os.getenv("ANTHROPIC_API_KEY"),
    tools=[
        end_call,
        agent_as_handoff(
            spanish_agent,
            name="transfer_to_spanish",
            description="Transfer when user requests Spanish.",
        ),
    ],
    config=LlmConfig(...),
)
```

### Web を検索する

```python theme={null}
from line.llm_agent import end_call, web_search

agent = LlmAgent(
    tools=[end_call, web_search],  # Add built-in web search
    ...
)
```

完全なガイドは [ツール](./tools) を参照してください。

## コード例

| 例                                                                                         | 説明                         |
| ----------------------------------------------------------------------------------------- | -------------------------- |
| [Basic Chat](https://github.com/cartesia-ai/line/tree/main/examples/basic_chat)           | シンプルな会話エージェント              |
| [Chat Supervisor](https://github.com/cartesia-ai/line/tree/main/examples/chat_supervisor) | 高速なチャットモデルと強力な推論へのエスカレーション |
| [Form Filler](https://github.com/cartesia-ai/line/tree/main/examples/form_filler)         | 会話を通じて構造化データを収集            |
| [Multi-Agent](https://github.com/cartesia-ai/line/tree/main/examples/transfer_agent)      | 特化型エージェント間でハンドオフ           |

### インテグレーション

| インテグレーション                                                                                     | 説明              |
| --------------------------------------------------------------------------------------------- | --------------- |
| [Exa Web Research](https://github.com/cartesia-ai/line/tree/main/example_integrations/exa)    | リアルタイム Web 検索   |
| [Browserbase](https://github.com/cartesia-ai/line/tree/main/example_integrations/browserbase) | 音声で Web フォームを入力 |

## 次のステップ

<CardGroup cols={2}>
  <Card title="エージェント" icon="robot" href="./agents">
    プロンプト、LLM、会話フローを設定する
  </Card>

  <Card title="ツール" icon="wrench" href="./tools">
    カスタムツールやマルチエージェントのハンドオフを追加する
  </Card>
</CardGroup>
