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

# Python Agent Template

The Python template is the simplest way to build a Charm agent. It is a good fit for agents that call APIs, transform text, run lightweight data processing, or wrap an existing Python function.

## Use Case

Use this template for a minimal Python agent with a small dependency surface.

## Prerequisites

* Python 3.10+.
* Charm CLI.
* Optional: Docker for isolated local runs.

## Configuration Surface

The important `charm.yaml` fields are:

* `persona`
* `interface`
* `runtime.adapter`
* `runtime.lifecycle`
* `policies`

Typical runtime configuration:

```yaml theme={"theme":{"light":"min-light","dark":"min-dark"}}
runtime:
  adapter:
    type: "custom"
    entry_point: "src.main:agent"
  lifecycle: "serverless"
```

The entry point should resolve to an object or callable that the runner can invoke.

## Expected Project Shape

```text theme={"theme":{"light":"min-light","dark":"min-dark"}}
my-agent/
├── charm.yaml
├── requirements.txt
└── src/
    └── main.py
```

## Local Development

Run with a simple input:

```bash theme={"theme":{"light":"min-light","dark":"min-dark"}}
charm run . --input "Summarize this idea"
```

Run with JSON input:

```bash theme={"theme":{"light":"min-light","dark":"min-dark"}}
charm run . --json '{"message": "Summarize this idea"}'
```

Validate before publishing:

```bash theme={"theme":{"light":"min-light","dark":"min-dark"}}
charm validate .
```

## Run and Publish

```bash theme={"theme":{"light":"min-light","dark":"min-dark"}}
charm run
charm validate
charm push
```

## When to Choose Another Template

* Use [Interactive Agent](/templates/interactive) for streaming chat.
* Use [Daemon Agent](/templates/daemon) for always-on execution.
* Use [OpenClaw Skill Agent](/templates/openclaw) for heavy browser or tool automation.
