Skip to main content

AgentType

LLM-powered automatic cell type annotation toolkit for single-cell RNA sequencing

PyPI version Python Version License: MIT

中文文档

Installation

pip install agentype

Optional dependencies:

# CellTypist annotation algorithm
pip install agentype[annotation]

# Full installation
pip install agentype[annotation,ml,viz]

Configuration

Create agentype_config.json:

{
  "llm": {
    "api_key": "your-api-key",
    "api_base": "https://api.openai.com/v1",
    "model": "gpt-4o"
  },
  "project": {
    "language": "en",
    "enable_streaming": true,
    "enable_logging": true
  }
}

Or configure via environment variables:

export OPENAI_API_KEY="your-api-key"
export OPENAI_API_BASE="https://api.openai.com/v1"
export OPENAI_MODEL="gpt-4o"

Quick Start

Full Workflow (Recommended)

from agentype.api.main_workflow import process_workflow_sync

result = process_workflow_sync(
    input_data="path/to/data.rds",      # supports RDS, H5AD, H5, CSV
    tissue_type="PBMC",                  # tissue type
    cluster_column="seurat_clusters",    # cluster label column
    api_key="your-api-key",
    api_base="https://api.openai.com/v1",
    model="gpt-4o",
    output_dir="./outputs",
    language="en",                       # 'en' or 'zh'
    enable_streaming=True,
    enable_llm_logging=True,
)

if result["success"]:
    print(f"Session ID:       {result['session_id']}")
    print(f"Iterations:       {result['total_iterations']}")
    print(f"Output files:     {result['output_file_paths']}")
else:
    print(f"Error:            {result['error']}")

Parameters

Parameter Type Description
input_data str Path to input file
tissue_type str Tissue type, e.g. "PBMC", "Liver"
cluster_column str Column name of cluster labels in the data
species str | None Species; auto-detected when None
api_key str LLM API key
api_base str LLM API base URL
model str Model name
output_dir str Directory for output files
language str Prompt language: "en" or "zh"
enable_streaming bool Enable streaming output
enable_thinking bool Enable thinking mode
enable_llm_logging bool Enable LLM call logging

Return Value

Field Type Description
success bool Whether the run succeeded
session_id str Session ID for this run
total_iterations int Number of agent iterations
output_file_paths dict Output paths, including rds_file
result_file str Path to the summary result file
token_stats dict Token usage statistics
error str Error message on failure

Using Individual Agents

AppAgent — cell type annotation:

from agentype.appagent.tools.celltypist_simple import celltypist_annotation

result = celltypist_annotation(
    adata_path="data.h5ad",
    model_name="Immune_All_Low.pkl",
    species="human"
)

SubAgent — cell marker gene query:

from agentype.subagent.tools.fetchers.cellmarker_fetcher import search_cell_markers

markers = search_cell_markers(
    gene_symbols=["CD4", "CD8A", "CD3E"],
    tissue_type="Blood"
)

DataAgent — data format conversion:

from agentype.dataagent.tools.data_converters import convert_rds_to_h5ad

h5ad_path = convert_rds_to_h5ad(
    rds_path="data.rds",
    output_path="output.h5ad"
)

CLI Tools

celltype-server          # Start all MCP servers
celltype-manage status   # Show project status
celltype-manage config   # Show current configuration

License

MIT License

Metadata

Release files for agentype 1.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for agentype 1.1.0
File Size Uploaded Provenance Actions
agentype-1.1.0.tar.gz 381.3 kB Without provenance Details for agentype-1.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for agentype 1.1.0
File Interpreter ABI Platform Actions
agentype-1.1.0-py3-none-any.whl Python 3 none any Details for agentype-1.1.0-py3-none-any.whl

Total release size: 867.3 kB

Release files / agentype-1.1.0.tar.gz

Download URL agentype-1.1.0.tar.gz
Size 381.3 kB
Tags Source
SHA-256 checksum
How to use checksums
e6ce73e484ba7d40e8f9e4877eafc9d2389a56d1239e08d89fef8f14f700137b
BLAKE2b-256 checksum
How to use checksums
65d8500ec2792926f915a91ffb23c09aaa692a851e62625f92ef2c8c4d8dd2e2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.10.12

Release files / agentype-1.1.0-py3-none-any.whl

Download URL agentype-1.1.0-py3-none-any.whl
Size 486.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
0bf1eecefecbd68e93811e6470e2e8832e55b563c7e013fb4f4d054a65905e52
BLAKE2b-256 checksum
How to use checksums
8317a6ae61311e1e967a542af1aea721050fbfbe542fde27dbaff1788fbc5e3b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.10.12

Security for agentype 1.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page