diff --git a/examples/minimal-agent/Dockerfile b/examples/minimal-agent/Dockerfile new file mode 100644 index 00000000..324cc8df --- /dev/null +++ b/examples/minimal-agent/Dockerfile @@ -0,0 +1,10 @@ +FROM python:3.11-slim + +WORKDIR /app +COPY example_agent.py /app + +RUN useradd -m agent && chown -R agent:agent /app +USER agent + +CMD ["python", "example_agent.py"] + diff --git a/examples/minimal-agent/README.md b/examples/minimal-agent/README.md new file mode 100644 index 00000000..d526dcf5 --- /dev/null +++ b/examples/minimal-agent/README.md @@ -0,0 +1,13 @@ +# Minimal Example Agent + +A tiny example showing how to run an agent inside a container: +- Creates `input.txt` if missing +- Reads it, uppercases content +- Writes the result to `output.txt` + +## Run + +### Linux/macOS +```bash +docker build -t cua-agent-example examples/minimal-agent +docker run --rm -v $(pwd)/examples/minimal-agent:/app cua-agent-example diff --git a/examples/minimal-agent/example_agent.py b/examples/minimal-agent/example_agent.py new file mode 100644 index 00000000..daf7a5e4 --- /dev/null +++ b/examples/minimal-agent/example_agent.py @@ -0,0 +1,22 @@ +import os + +INPUT_FILE = "input.txt" +OUTPUT_FILE = "output.txt" + +def run_agent(): + if not os.path.exists(INPUT_FILE): + with open(INPUT_FILE, "w") as f: + f.write("Hello from Cua!\n") + + with open(INPUT_FILE, "r") as f: + data = f.read() + + processed = data.upper() + + with open(OUTPUT_FILE, "w") as f: + f.write(processed) + + print(f"Processed file written to {OUTPUT_FILE}") + +if __name__ == "__main__": + run_agent() diff --git a/examples/minimal-agent/input.txt b/examples/minimal-agent/input.txt new file mode 100644 index 00000000..04699d73 --- /dev/null +++ b/examples/minimal-agent/input.txt @@ -0,0 +1 @@ +Hello from Cua! diff --git a/examples/minimal-agent/output.txt b/examples/minimal-agent/output.txt new file mode 100644 index 00000000..f51ea39d --- /dev/null +++ b/examples/minimal-agent/output.txt @@ -0,0 +1 @@ +HELLO FROM CUA!