Metadata-Version: 2.4
Name: sinapsis-anthropic
Version: 0.2.0
Summary: Sinapsis templates for Anthropic Claude models.
Author-email: SinapsisAI <dev@sinapsis.tech>
Project-URL: Homepage, https://sinapsis.tech
Project-URL: Documentation, https://docs.sinapsis.tech/docs
Project-URL: Tutorials, https://docs.sinapsis.tech/tutorials
Project-URL: Repository, https://github.com/Sinapsis-AI/sinapsis-chatbots.git
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: anthropic>=0.51.0
Requires-Dist: sinapsis>=0.2.26
Requires-Dist: sinapsis-chatbots-base
Provides-Extra: multimodal
Requires-Dist: pillow>=11.3.0; extra == "multimodal"
Provides-Extra: sinapsis-data-readers
Requires-Dist: sinapsis-data-readers[opencv]>=0.1.28; extra == "sinapsis-data-readers"
Provides-Extra: all
Requires-Dist: sinapsis-anthropic[multimodal]; extra == "all"
Requires-Dist: sinapsis-anthropic[sinapsis-data-readers]; extra == "all"
Dynamic: license-file

<h1 align="center">
<br>
<a href="https://sinapsis.tech/">
  <img
    src="https://github.com/Sinapsis-AI/brand-resources/blob/main/sinapsis_logo/4x/logo.png?raw=true"
    alt="" width="300">
</a>
<br>
Sinapsis Anthropic
<br>
</h1>

<h4 align="center">Sinapsis templates for Anthropic Claude text, multimodal, and MCP workflows.</h4>

<p align="center">
<a href="#installation">🐍 Installation</a> •
<a href="#features">🚀 Features</a> •
<a href="#example">📚 Usage example</a> •
<a href="#documentation">📙 Documentation</a> •
<a href="#license">🔍 License</a>
</p>

The `sinapsis-anthropic` package provides packet-native templates for running Claude models with
`LLMConversationPacket`, including standard text generation, multimodal inputs, and MCP tool flows.

<h2 id="installation">🐍 Installation</h2>

Install using your preferred package manager. We strongly recommend using <code>uv</code>.

Install the base package:

```bash
uv pip install sinapsis-anthropic --extra-index-url https://pypi.sinapsis.tech
```

Or with raw <code>pip</code>:

```bash
pip install sinapsis-anthropic --extra-index-url https://pypi.sinapsis.tech
```

> [!IMPORTANT]
> Anthropic templates require an API key. Set it before running your agent:
>
> ```bash
> export ANTHROPIC_API_KEY="your-api-key"
> ```

> [!IMPORTANT]
> `AnthropicMultiModal` requires the optional `multimodal` extra:
>
> ```bash
> uv pip install sinapsis-anthropic[multimodal] --extra-index-url https://pypi.sinapsis.tech
> ```
>
> Or install all optional dependencies:
>
> ```bash
> uv pip install sinapsis-anthropic[all] --extra-index-url https://pypi.sinapsis.tech
> ```

<h2 id="features">🚀 Features</h2>

<h3>Templates Supported</h3>

- **AnthropicTextGeneration**: Standard Claude text generation on top of `LLMConversationPacket`.
- **AnthropicMultiModal**: Multimodal completion that reads image packets from `container.images`.
- **AnthropicWithMCP**: Packet-native MCP orchestration using `LLMConversationPacket.tools`,
  `tool_calls`, and `tool_results`.

<details>
<summary><strong><span style="font-size: 1.25em;">🧩 Common Attributes</span></strong></summary>

- `init_args` (`LLMInitArgs`, required): Anthropic model selection arguments.
  - `llm_model_name` (`str`, required): Claude model identifier.
- `completion_args` (`AnthropicCompletionArgs`, required): Request-time generation parameters such as
  `max_tokens`, `temperature`, `top_p`, `top_k`, `service_tier`, and `stop_sequences`.
- `extended_thinking` (`AnthropicThinkingArgs`, optional): Extended-thinking configuration.
- `web_search` (`bool`, optional): Enables Anthropic's built-in web search tool for supported models.
- `cleanup_response` (`bool`, optional): Whether to clean leaked transport or template markers from the final response.
- `reasoning_start_tag` / `reasoning_end_tag` (`str | None`, optional): Optional tags used to extract reasoning into the
  packet `reasoning` field and keep the final answer in `response`.

</details>

> [!TIP]
> Use `sinapsis info --all-template-names` to inspect the templates installed in your environment.

<h2 id="example">📚 Usage example</h2>

The following configuration runs one Claude text-generation step from an `LLMConversationPacket`.

<details id='usage'><summary><strong><span style="font-size: 1.0em;"> Config</span></strong></summary>

```yaml
agent:
  name: my_claude_agent
  description: Agent with support for text-to-text conversational chat using Anthropic Claude models

templates:
  - template_name: InputTemplate
    class_name: InputTemplate
    attributes: {}

  - template_name: LLMConversationInput
    class_name: LLMConversationInput
    template_input: InputTemplate
    attributes:
      prompt: "Give three short tips for staying organized during a busy week."
      system_prompt: "You are a helpful assistant."

  - template_name: AnthropicTextGeneration
    class_name: AnthropicTextGeneration
    template_input: LLMConversationInput
    attributes:
      init_args:
        llm_model_name: "claude-sonnet-4-6"
      completion_args:
        max_tokens: 1024
        temperature: 0.7
        service_tier: standard_only
      extended_thinking:
        type: disabled
      web_search: false
```

</details>

To run a config:

```bash
sinapsis run path_to_config.yaml
```

<h2 id="documentation">📙 Documentation</h2>

Documentation for this and other sinapsis packages is available on the [sinapsis website](https://docs.sinapsis.tech/docs)

Tutorials for different projects within sinapsis are available at [sinapsis tutorials page](https://docs.sinapsis.tech/tutorials)

<h2 id="license">🔍 License</h2>

This project is licensed under the AGPLv3 license, which encourages open collaboration and sharing. For more details, please refer to the [LICENSE](LICENSE) file.

For commercial use, please refer to our [official Sinapsis website](https://sinapsis.tech) for information on obtaining a commercial license.
