Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
60 commits
Select commit Hold shift + click to select a range
ae1d4be
feat(agents): agents follow the env's clock the way computers do (FD-…
williamloo-scale Nov 16, 2026
eea933c
refactor(agents): leave the Claude Code image to its own PR; agents s…
williamloo-scale Nov 17, 2026
608a93d
Merge origin/main
williamloo-scale Nov 17, 2026
182cef0
feat(agents): the Claude Code image follows the env's clock (FD-5916)
williamloo-scale Nov 17, 2026
bce00d4
fix(agents): agent clock review: new config's status, one clock per a…
williamloo-scale Nov 17, 2026
84381b8
fix(agents): keep each agent's clock record on a key of its own; a re…
williamloo-scale Nov 17, 2026
56dac45
fix(agents): agent clock keys can't collide; one clock env per agent;…
williamloo-scale Nov 17, 2026
c726743
chore: drop test run output committed by mistake
williamloo-scale Nov 17, 2026
5e8c756
Merge #714
williamloo-scale Nov 17, 2026
3b6f499
test(agents): the Claude Code image follows the env's clock end to en…
williamloo-scale Nov 17, 2026
cecc686
fix(agents): a failed agent sync retires its follower; the task's zon…
williamloo-scale Nov 17, 2026
afe55b4
Merge origin/main
williamloo-scale Nov 17, 2026
d523a6e
Merge #714
williamloo-scale Nov 17, 2026
ac0a39e
fix(agents): libfaketime's init can't deadlock the CLI; the CLI goes …
williamloo-scale Nov 17, 2026
c8ed6e1
fix(agents): a later clock sync leaves agents teardown_sandboxes took…
williamloo-scale Nov 17, 2026
b5d3b4b
fix(ci): the agent clock e2e skips as a declared capability gap; the …
williamloo-scale Nov 17, 2026
25af21a
chore: drop test-run output committed again, and ignore where the pro…
williamloo-scale Nov 17, 2026
7216c7c
fix(agents): route the CLI through egress by the clock page's armed f…
williamloo-scale Nov 17, 2026
fc3134b
Merge #714
williamloo-scale Nov 17, 2026
f8bd9ff
feat(a2a-agent): validate clock/v1 by the time the agent's own comman…
earakely-scale Nov 17, 2026
f9af1b6
refactor(a2a-agent): name the clock validation's timeouts and error l…
williamloo-scale Nov 17, 2026
43fdb97
fix(gateway): get_time says the machine's clock may not be synchroniz…
earakely-scale Nov 18, 2026
8bf8e4c
refactor(a2a-agent): move agent_clock to a2a_agent/clock.py, beside t…
earakely-scale Nov 18, 2026
810f42e
Merge #714
williamloo-scale Nov 18, 2026
686fdf1
test(agents): the agent clock e2e imports FOLLOWING_KEY from a2a_agen…
williamloo-scale Nov 18, 2026
9d7d6c0
Merge origin/main (#714 merged)
williamloo-scale Nov 18, 2026
1ff90bd
fix(agents): the Claude Code image installs protocol 0.1.575, the fir…
earakely-scale Nov 18, 2026
ca97b37
fix(computers): the clock follower follows a changed config while its…
earakely-scale Nov 18, 2026
0875e06
fix(agents): an armed clock keeps the agent's own NO_PROXY hosts dire…
williamloo-scale Nov 18, 2026
bb4f07f
test(agents): the agent clock checks run over every clocked agent ima…
williamloo-scale Nov 18, 2026
7980e27
feat(agents): the Letta Code image follows the env's clock (FD-5916)
williamloo-scale Nov 18, 2026
a3f9e34
Merge main into #726: the clock and egress proxy now live in utils (#…
earakely-scale Nov 18, 2026
3c60fda
refactor(agents): the Claude Code image takes the clock and egress pr…
earakely-scale Nov 18, 2026
b916e31
Merge #726: the clock and egress proxy come from utils
williamloo-scale Nov 18, 2026
150c563
test(agents): Claude Code's contract test takes the folders shared_so…
williamloo-scale Nov 18, 2026
a7e2a69
refactor(agents): the image takes the clock and egress proxy from uti…
williamloo-scale Nov 18, 2026
4ddfca5
Merge #726
williamloo-scale Nov 18, 2026
aed27ee
fix(agents): a private HTTPS model endpoint is reached directly on an…
williamloo-scale Nov 18, 2026
1fa4e62
fix(agents): a private HTTPS model endpoint is reached directly on an…
williamloo-scale Nov 18, 2026
4b76192
Merge #726
williamloo-scale Nov 18, 2026
a6f3720
fix(agents): the model host's lookup is bounded and kept, so a slow r…
williamloo-scale Nov 18, 2026
6b0e01f
fix(agents): the model host's lookup is bounded and kept, as #726's is
williamloo-scale Nov 18, 2026
1b71135
Merge #726
williamloo-scale Nov 18, 2026
34e2f5a
Merge main (#726 merged)
williamloo-scale Nov 18, 2026
733a2f3
refactor(agents): follow the merged Claude Code image (#726): the pro…
williamloo-scale Nov 18, 2026
36a2293
fix(agents): keep a provider's CA bundle trusted, and send HTTPS MCP …
williamloo-scale Nov 18, 2026
1cb1094
Merge main: the control token (#780, #784)
williamloo-scale Nov 19, 2026
6beca46
Merge remote-tracking branch 'origin/main' into wloo/letta-code-clock…
williamloo-scale Nov 19, 2026
7be2292
Merge remote-tracking branch 'origin/main' into wloo/letta-code-clock…
williamloo-scale Nov 19, 2026
e7bc8c0
refactor(letta-code): take the shared egress rule (#818)
williamloo-scale Nov 19, 2026
d18c38e
Merge remote-tracking branch 'origin/main' into wloo/letta-code-clock…
williamloo-scale Nov 20, 2026
d885daf
Merge remote-tracking branch 'origin/main' into wloo/letta-code-clock…
earakely-scale Nov 20, 2026
f32e965
fix(agents): Letta Code's workspace changelog takes its tar baseline …
earakely-scale Nov 20, 2026
7b32cc9
test(agents): pin Letta Code's clock wiring at the bridge's call site…
earakely-scale Nov 20, 2026
504d0ce
docs(agents): Letta Code's README says how the image follows the env'…
earakely-scale Nov 20, 2026
5dcb1c2
Merge remote-tracking branch 'origin/main' into wloo/letta-code-clock…
earakely-scale Nov 20, 2026
c363f58
Merge remote-tracking branch 'origin/main' into wloo/letta-code-clock…
earakely-scale Nov 20, 2026
602e31e
test(agents): Letta Code's clock e2e runs a real CLI turn, an install…
earakely-scale Nov 20, 2026
6f97a78
Merge remote-tracking branch 'origin/main' into wloo/letta-code-clock…
earakely-scale Nov 21, 2026
eb890df
fix(agents): Letta Code's container ends when its A2A server exits, a…
earakely-scale Nov 21, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/agent_env/agents/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,8 @@ The A2A server starts with the real-time marker, so it and its records stay on r
- **One rule for every clocked agent.** That rule is `agent_egress.py` in `utils/agent_clock`, which only agent images
take (`agent_clock = "utils/agent_clock"` in `shared_sources.toml`), so changing it rebuilds no computer base. The
bridge imports it, and the image and `install.sh` copy it beside the bridge with the clock's `clockpage.py`, whose
layout and check it reads the page by, so every agent put on the clock, OpenCode's too, goes out the same way.
layout and check it reads the page by, so every agent put on the clock, OpenCode's and Letta Code's too, goes out
the same way.

Started as a user other than root, the image runs the A2A server alone, on real time, as before.

Expand Down
46 changes: 42 additions & 4 deletions src/agent_env/agents/agents/letta-code/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
# The env's clock: the egress proxy, one static Go binary, and agent-env's libfaketime and its TLS shim, taken from
# agent-env's sources as clock/ and egress/ (shared_sources.toml) and built for this image's libc (Debian bookworm) in
# stages of their own, so no toolchain is left in the image.
FROM public.ecr.aws/docker/library/golang:1.26.11-bookworm@sha256:dc40a13b61304647ed7e5d581d246b86413dfc29d63c6d018310feb93cd98fc0 AS egress
COPY egress/ /egress/
RUN cd /egress && go vet ./... && go test -count=1 ./... \
&& CGO_ENABLED=0 GOFLAGS=-mod=readonly go build -trimpath -ldflags=-s -o /out/egress .

FROM public.ecr.aws/docker/library/python:3.11-slim@sha256:c20888b6acdd1e63e1c433a185bf3ad162c0288fe484616ce062e0d28add2900 AS clock
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
build-essential patch curl ca-certificates
COPY clock/ /clock/
RUN sh /clock/build.sh /out

FROM public.ecr.aws/docker/library/python:3.11-slim@sha256:c20888b6acdd1e63e1c433a185bf3ad162c0288fe484616ce062e0d28add2900
# Node to install the Letta Code CLI, a native binary, and for the model's commands, checked against its published
# checksum; install.sh brings the same. poppler-utils renders a PDF attachment to the page images the model reads.
Expand Down Expand Up @@ -25,14 +39,38 @@ COPY requirements.txt ./
RUN pip install --no-cache-dir -r requirements.txt
# install.sh and run.sh are install/v1's: in the image, so they stay in its build context.
COPY mcp_tools.ts a2a_server.py letta_code_bridge.py letta_code_kit.py entrypoint.sh install.sh run.sh ./
# The CLI's cwd, /app, and its state under /data, fixed so neither follows the uid: Modal runs the image as root.
# Every clocked agent's egress rule, which the bridge imports, and the clock page's format it reads (shared_sources.toml).
COPY agent_clock/agent_egress.py clock/clockpage.py ./
# The CLI's cwd, /app, and its state under /data, fixed so neither follows the uid.
RUN useradd --create-home --uid 10001 agent && mkdir -p /app /data \
&& chown agent:agent /app /data && chmod 0755 entrypoint.sh \
&& find /opt/agent \( ! -perm -044 -o \( -perm /111 ! -perm -011 \) \) -exec chmod go+rX {} +
# The env's clock: the follower and the egress proxy, each as its own user, under root's supervisord (root.conf), and
# agent-env's libfaketime and its TLS shim preloaded into every process, faking only the agent's (clock.conf). The
# follower's config is the agent's user's to write (agentenv_protocol.a2a_agent.clock) and the follower's to read.
RUN pip install --no-cache-dir supervisor==4.2.5 \
&& useradd --system --no-create-home --home-dir /nonexistent --shell /usr/sbin/nologin agentenv-clock \
&& useradd --system --no-create-home --home-dir /nonexistent --shell /usr/sbin/nologin agentenv-egress \
&& mkdir -p /usr/local/lib/agentenv-clock /usr/local/lib/agentenv-egress /etc/agentenv \
&& install -d -o agent -g agentenv-clock -m 2750 /etc/agentenv/clock \
&& touch /etc/agentenv/ca.pem \
&& cp /etc/ssl/certs/ca-certificates.crt /etc/agentenv/ca-bundle.pem \
&& cp /etc/ssl/certs/ca-certificates.crt /usr/local/lib/agentenv-egress/roots.pem
COPY --from=clock /out/libfaketimeMT.so.1 /out/libtls_realtime.so /usr/local/lib/agentenv-clock/
COPY --from=egress /out/egress /usr/local/lib/agentenv-egress/egress
COPY clock/clockpage.py clock/clock-follower /usr/local/lib/agentenv-clock/
COPY clock/clock.conf /etc/agentenv/clock.conf
COPY root.conf /etc/agentenv/root.conf
COPY start-agent /usr/local/bin/start-agent
RUN sed -i -e "s/^AGENTENV_SESSION_UID=.*/AGENTENV_SESSION_UID=$(id -u agent)/" \
-e "s/^AGENTENV_CLOCK_PAGE_UID=.*/AGENTENV_CLOCK_PAGE_UID=$(id -u agentenv-clock)/" /etc/agentenv/clock.conf \
&& chmod 0755 /usr/local/lib/agentenv-clock/clock-follower /usr/local/bin/start-agent \
&& printf '%s\n' /usr/local/lib/agentenv-clock/libfaketimeMT.so.1 /usr/local/lib/agentenv-clock/libtls_realtime.so \
> /etc/ld.so.preload
ENV A2A_PORT=8000 PYTHONPATH=/opt/agent HOME=/data XDG_CONFIG_HOME=/data/config XDG_CACHE_HOME=/data/cache \
XDG_DATA_HOME=/data/share XDG_STATE_HOME=/data/state
USER agent
WORKDIR /app
EXPOSE 8000
# CMD rather than ENTRYPOINT: Modal passes a sandbox's env to the image's CMD only.
CMD ["/opt/agent/entrypoint.sh"]
# Starts as root, which start-agent needs for the clock; the A2A server and the CLI run as the agent's user. CMD rather
# than ENTRYPOINT: Modal passes a sandbox's env to the image's CMD only.
CMD ["/usr/local/bin/start-agent"]
38 changes: 35 additions & 3 deletions src/agent_env/agents/agents/letta-code/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,42 @@ direct Letta Code tools through `letta.tools.register`; each tool executes `lett
| `install/v1` | Template installer brings checksum-verified Node and uv, the pinned CLI, and a private Python into a container or a Linux host with glibc. Installs git if missing. |
| `staging/v1` | SDK default. |

The image runs as user `agent` in `/app`, with state under `/data`, and includes git and `pdftoppm`. PDF attachments
are rendered as page images; other attachments are materialized and their paths passed to the CLI. Headless mode
never loads node-pty, so installation skips dependency scripts and rebuilds only the CLI, sharp and protobufjs.
The image starts as root (`start-agent`), whose supervisord runs the A2A server as user `agent` in `/app`, with state
under `/data`; started as another user, it runs the server alone, as before. Either way the container ends when the
server exits, as before: supervisord never restarts it, and stops once it exits. It includes git and `pdftoppm`. PDF
attachments are rendered as page images; other attachments are materialized and their paths passed to the CLI. Headless
mode never loads node-pty, so installation skips dependency scripts and rebuilds only the CLI, sharp and protobufjs.
The end of CLI stderr is included in failures. Cancellation and shutdown kill the CLI's process tree.

The image follows a task env's clock as the agents README describes, only once a `sync_env_clock` sets `agent_clock`.
Letta Code's local backend runs inside each `letta` process, so the whole CLI follows the clock, the "Local time" line
of the environment context it gives the model included, as do the commands the model runs; the A2A server, its model
relay and its records stay on real time. The CLI reaches the model through that relay on loopback, directly, and the env's
MCP servers over TLS through the egress proxy, `letta mcp call` included. The workspace changelog's tar runs on real
time, as file times do. Nothing on the CLI's headless path ages conversations or tool output by file times. What still
reads the env's clock against other times:
- A commit to the git-backed memory, the bridge's or the CLI's, carries the env's date. Before 1970 git stores an
overflowed time, and after 2099 a broken time zone, which `git fsck` flags; `commit`, `ls-tree`, `show`, `log` and
`status`, which the bridge and the CLI run on it, work.
- The memory tool's listing of a folder shows its 10 most recently edited entries, dating committed ones by their
commits, on the env's clock, and uncommitted ones by their files' times, which are real. A clock ahead of real time,
or before 1970, lists committed entries first and one behind it uncommitted ones, which changes the 10 a larger
folder shows.
- A jump back across a compaction makes the CLI's pre-turn compaction check estimate the context's size from its text
rather than from the last reported usage.
- Messages written on 2026-01-01 UTC, the CLI's placeholder date, get timestamps interpolated from the transcript
file's times when loaded, which changes neither their content nor their order.
- A `Retry-After` given as a date (LiteLLM and the providers give seconds) is read against the env's date, and the CLI
waits at most 60 s.
- File locks time out, and those that don't go by their owner's process go stale, on the env's clock, so a rate above
1 or a jump forward shortens both. A context's own commands are the only ones to take its locks. A jump back
lengthens both: a lock a killed CLI left, the reflection transcript's say, goes stale only once the env's clock
passes the time it was taken plus 90 s, and until then every turn waits 10 s for it at its end and leaves its messages
out of that transcript, logging `Failed to append transcript delta` in the context's `.letta/logs/debug`. A jump back
while a command waits for a held lock stretches the wait by the jump, and a frozen clock (rate 0) stretches it to the
turn's timeout.
- On a frozen clock, every assistant message from a provider that gives no response id (LiteLLM gives one) takes the
same id, made from the time.

Run `agent-env run agents --task letta-code-smoke` for the shell smoke task and
`agent-env a2a-agent validate --id letta-code --sandbox local` for the repository's validator.
10 changes: 8 additions & 2 deletions src/agent_env/agents/agents/letta-code/a2a_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -506,7 +506,7 @@ async def _capture_changelog(self) -> None:
["tar", f"--listed-incremental={pending_snar}",
*_changelog_backup_exclusions(),
f"--exclude={_CHANGELOG_DIR}", "-czf", str(archive), *roots, str(record)],
check=True, stdout=subprocess.DEVNULL, stderr=subprocess.PIPE,
check=True, stdout=subprocess.DEVNULL, stderr=subprocess.PIPE, env=_real_time_env(),
)
await config["uploader"].upload(f"{sequence:06d}.tgz", archive)
pending_snar.replace(_CHANGELOG_SNAR)
Expand Down Expand Up @@ -631,6 +631,12 @@ def _removable(path: object) -> bool:
and path not in _SYSTEM_DIRS and os.path.lexists(path))


def _real_time_env() -> dict[str, str]:
"""The changelog's tar runs on real time, as file times are: on an env clock ahead, a tar that read it would record
its dump time in the snapshot file ahead of every real change, and the next increment would miss them."""
return {**os.environ, "AGENTENV_REAL_TIME": "1"}


def _baseline_changelog(roots: list[str]) -> None:
_CHANGELOG_DIR.mkdir(parents=True, exist_ok=True)
_CHANGELOG_SNAR.unlink(missing_ok=True)
Expand All @@ -639,7 +645,7 @@ def _baseline_changelog(roots: list[str]) -> None:
["tar", f"--listed-incremental={_CHANGELOG_SNAR}",
*_changelog_backup_exclusions(),
"-cf", "/dev/null", *present],
check=True, stdout=subprocess.DEVNULL, stderr=subprocess.PIPE,
check=True, stdout=subprocess.DEVNULL, stderr=subprocess.PIPE, env=_real_time_env(),
)


Expand Down
4 changes: 2 additions & 2 deletions src/agent_env/agents/agents/letta-code/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ START_TIMEOUT_S=120
STOP_TIMEOUT_S=10
dockerfile_arg() { sed -n "s/^ARG $1=//p" "$here/Dockerfile"; }
NODE_VERSION=$(dockerfile_arg NODE_VERSION)
AGENT_FILES="mcp_tools.ts a2a_server.py letta_code_bridge.py letta_code_kit.py requirements.txt run.sh"
AGENT_FILES="mcp_tools.ts a2a_server.py letta_code_bridge.py letta_code_kit.py requirements.txt run.sh agent_clock/agent_egress.py clock/clockpage.py"

# put SRC DEST replaces DEST by a rename, so a binary an earlier install's agent still runs can be replaced; put_dir SRC
# DEST copies a folder to DEST, which isn't there.
Expand Down Expand Up @@ -145,7 +145,7 @@ put "$stage/agent.env" "$root/agent.env"
put "$here/package.json" "$root/npm/package.json"
put "$here/package-lock.json" "$root/npm/package-lock.json"
for file in $AGENT_FILES; do
put "$here/$file" "$root/app/$file"
put "$here/$file" "$root/app/${file##*/}"
done
on "chmod 0600 $r/agent.env && chmod 0755 $r/bin/uv $r/bin/letta $r/app/run.sh"

Expand Down
13 changes: 9 additions & 4 deletions src/agent_env/agents/agents/letta-code/letta_code_bridge.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
import tarfile
import tempfile
import threading
from collections.abc import Callable, Mapping
from collections.abc import Callable, Iterable, Mapping
from contextlib import asynccontextmanager
from dataclasses import dataclass, field
from datetime import datetime, timezone
Expand All @@ -23,6 +23,8 @@
from aiohttp import ClientSession, ClientTimeout, web
from jsonschema import Draft202012Validator, SchemaError, ValidationError

from agent_egress import clock_armed, egress_env

logger = logging.getLogger(__name__)

# The model a run uses when neither the task nor the agent-config names one; the
Expand Down Expand Up @@ -57,11 +59,14 @@ def context_data_dir(context_id: str) -> Path:
return Path(SESSIONS_ROOT) / ctx_hash


def _context_env(context_id: str) -> dict[str, str]:
def _context_env(context_id: str, urls: Iterable[str] = (), *, armed: bool = False) -> dict[str, str]:
"""The CLI's environment for a context: its own data dir as HOME, and on an armed clock (``armed``) the egress
proxy (``egress_env``) for what the CLI and what it starts reach: the model relay, on loopback, which stays direct,
and the env's MCP servers (``urls``), which the CLI connects to itself."""
home = context_data_dir(context_id)
home.mkdir(parents=True, exist_ok=True)
return {**os.environ, "HOME": str(home), "LETTA_LOCAL_BACKEND_DIR": str(home / ".letta/lc-local-backend"),
"LETTA_LOCAL_BACKEND_EXPERIMENTAL": "1"}
"LETTA_LOCAL_BACKEND_EXPERIMENTAL": "1", **egress_env(os.environ, urls, armed=armed)}


async def _communicate(*cmd: str, env: Mapping[str, str], timeout_s: int) -> tuple[int, bytes, bytes]:
Expand Down Expand Up @@ -435,7 +440,7 @@ async def _turn(prompt, context_id, session_id, model, mcp_servers, system_promp
project_id, task_id, role, attachment_paths, effort, event_callback, workspace):
model = model or DEFAULT_MODEL
handle = "openai-compatible/" + model
env = _context_env(context_id)
env = _context_env(context_id, [info["url"] for info in (mcp_servers or {}).values()], armed=clock_armed())
home = Path(env["HOME"])
(home / "context.json").write_text(json.dumps({"home": str(home)}))
attribution = _attribution_headers(project_id, task_id)
Expand Down
71 changes: 71 additions & 0 deletions src/agent_env/agents/agents/letta-code/root.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
; Root's supervisord (start-agent): the clock follower and the egress proxy, each as its own user, on real
; time, and the A2A server as the agent's user. The server starts with the real-time marker, which agent-env's
; libfaketime takes out of its environment, so the server's own records keep real timestamps and everything it starts,
; the CLI and the model's commands, reads the env's time. Its socket and logs are root's alone, so the agent's user can
; neither stop nor restart any of them. The follower follows nothing until the server writes its config, which
; sync_env_clock has it do when the task sets agent_clock, then picks it up within a quarter second.
[supervisord]
nodaemon=true
user=root
logfile=/var/log/agentenv-root/supervisord.log
pidfile=/run/agentenv-root/supervisord.pid
childlogdir=/var/log/agentenv-root

[unix_http_server]
file=/run/agentenv-root/supervisor.sock
chmod=0700

[rpcinterface:supervisor]
supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface

[supervisorctl]
serverurl=unix:///run/agentenv-root/supervisor.sock

[program:clock]
command=/usr/local/bin/python3 -I /usr/local/lib/agentenv-clock/clock-follower
user=agentenv-clock
directory=/
priority=3
autorestart=true
startsecs=1
startretries=1000
redirect_stderr=true
stdout_logfile=/var/log/agentenv-root/clock.log
environment=HOME="/nonexistent",USER="agentenv-clock",LOGNAME="agentenv-clock"

[program:egress]
command=/usr/local/lib/agentenv-egress/egress serve
user=agentenv-egress
directory=/
priority=3
autorestart=true
startsecs=1
startretries=1000
redirect_stderr=true
stdout_logfile=/var/log/agentenv-root/egress.log
environment=HOME="/nonexistent",USER="agentenv-egress",LOGNAME="agentenv-egress",AGENTENV_EGRESS_PRIVATE="allow"

; uvicorn itself, not entrypoint.sh: the marker holds for the process it's given to alone, and a shell that execs
; uvicorn would hand uvicorn an environment without it. HOME is the image's, /data, under which the CLI's state lives.
; Not restarted: agent-exit ends the container when it exits.
[program:agent]
command=/usr/local/bin/python3 -m uvicorn a2a_server:app --host 0.0.0.0 --port %(ENV_A2A_PORT)s --timeout-graceful-shutdown 5
user=agent
directory=/app
priority=10
autorestart=false
stopasgroup=true
killasgroup=true
stopwaitsecs=30
redirect_stderr=true
stdout_logfile=/dev/stdout
stdout_logfile_maxbytes=0
environment=HOME="/data",USER="agent",LOGNAME="agent",AGENTENV_REAL_TIME="1",AGENTENV_EGRESS_PROXY="http://127.0.0.1:3128",NODE_EXTRA_CA_CERTS="/etc/agentenv/ca.pem",SSL_CERT_FILE="/etc/agentenv/ca-bundle.pem",REQUESTS_CA_BUNDLE="/etc/agentenv/ca-bundle.pem"

; The A2A server is the container, as it was before the clock: when it exits, or never gets going, this stops
; supervisord, which ends the container, rather than have a fresh server, without the dead one's MCP servers, peers and
; tasks, take its place while the dead one's CLI goes on. A stop of the container stops the server without an exit
; event, and the follower and the proxy restart in place. supervisord exits 0 either way.
[eventlistener:agent-exit]
command=/usr/local/bin/python3 -I -c "while 1: import os, signal, sys; print('READY', flush=True); header = dict(f.split(':', 1) for f in sys.stdin.readline().split()); event = dict(f.split(':', 1) for f in sys.stdin.read(int(header['len'])).split()); event['processname'] == 'agent' and os.kill(os.getppid(), signal.SIGTERM); print('RESULT 2', end='\nOK', flush=True)"
events=PROCESS_STATE_EXITED,PROCESS_STATE_FATAL
5 changes: 5 additions & 0 deletions src/agent_env/agents/agents/letta-code/shared_sources.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# What this image's build context takes from agent-env's own sources, at the name its Dockerfile copies it from: one
# copy of each, shared with the other images that take it (utils/docker/context.py). Paths are under src/agent_env.
clock = "utils/faketime_clock"
egress = "utils/egress_proxy"
Comment thread
greptile-apps[bot] marked this conversation as resolved.
Resolved
agent_clock = "utils/agent_clock"
Loading
Loading