AgentType
LLM-powered automatic cell type annotation toolkit for single-cell RNA sequencing
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
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
agentype-1.1.0.tar.gz
(381.3 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
agentype-1.1.0-py3-none-any.whl
(486.0 kB
view details)
File details
Details for the file agentype-1.1.0.tar.gz.
File metadata
- Download URL: agentype-1.1.0.tar.gz
- Upload date:
- Size: 381.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/6.2.0 CPython/3.10.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e6ce73e484ba7d40e8f9e4877eafc9d2389a56d1239e08d89fef8f14f700137b
|
|
| MD5 |
49f0d5f69fbfe912ab8eccc968b3d6d7
|
|
| BLAKE2b-256 |
65d8500ec2792926f915a91ffb23c09aaa692a851e62625f92ef2c8c4d8dd2e2
|
File details
Details for the file agentype-1.1.0-py3-none-any.whl.
File metadata
- Download URL: agentype-1.1.0-py3-none-any.whl
- Upload date:
- Size: 486.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/6.2.0 CPython/3.10.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0bf1eecefecbd68e93811e6470e2e8832e55b563c7e013fb4f4d054a65905e52
|
|
| MD5 |
7e6c63b62d3fb1e5fe078418c96a0d75
|
|
| BLAKE2b-256 |
8317a6ae61311e1e967a542af1aea721050fbfbe542fde27dbaff1788fbc5e3b
|