You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Upstream change: MervinPraison/PraisonAI PR #1655 ("fix: check agent server readiness timeout return value (fixes #1631)") — merged into main on 2026-05-13.
New test file: praisonaiagents/tests/unit/agents/test_server_registry_timeout.py
What changed in the SDK (user-facing)
When you call Agent.launch(...) or AgentTeam.launch(...) (or run praisonai serve agents), the SDK starts a FastAPI server in a background thread and waits for it to become ready before returning. Previously that wait used a hard-coded 5-second timeout and silently ignored a timeout — if the server never became ready, the caller had no way to know.
PR #1655 makes two user-visible improvements:
The readiness timeout is now configurable via a new environment variable:
Name: PRAISONAI_SERVER_READY_TIMEOUT
Type: float (seconds)
Default: 5.0
Invalid values (e.g. "abc") fall back to 5.0 and log a WARNING: "Invalid PRAISONAI_SERVER_READY_TIMEOUT value. Using default 5.0s."
A diagnostic WARNING is logged when the server does not become ready within the timeout:
Agent server on port <port> did not become ready within <timeout>s.
Proceeding, but some features may not work correctly. Check server logs for startup errors.
Behaviour is otherwise unchanged — .launch() still returns True and execution proceeds. This is purely additional observability for a previously silent failure mode.
Exact SDK snippet (ground truth)
# praisonaiagents/agents/agents.py — _AgentServerRegistry.start_server_if_neededtry:
timeout=float(os.environ.get("PRAISONAI_SERVER_READY_TIMEOUT", "5.0"))
exceptValueError:
logger.warning("Invalid PRAISONAI_SERVER_READY_TIMEOUT value. Using default 5.0s.")
timeout=5.0became_ready=ready_event.wait(timeout=timeout)
ifnotbecame_ready:
logger.warning(
"Agent server on port %s did not become ready within %.1fs. ""Proceeding, but some features may not work correctly. ""Check server logs for startup errors.",
port,
timeout,
)
Decision: update existing pages (no new page)
Per AGENTS.md, we don't create dedicated pages for single env vars / trivial config knobs. Three existing pages currently hard-code the phrase "5s timeout" and must be updated. We should also add the env var to the troubleshooting / configuration tables.
Pages that MUST be updated
1. docs/deploy/servers/agents.mdx
Current text (Note block, ~line 73):
Server readiness is signalled deterministically (no fixed sleep); .launch() returns only after the port is accepting connections (5s timeout).
Required change: Replace (5s timeout) with text that reflects that the timeout is configurable, e.g.:
Server readiness is signalled deterministically (no fixed sleep); .launch() returns only after the port is accepting connections. The wait defaults to 5 seconds and is configurable via the PRAISONAI_SERVER_READY_TIMEOUT environment variable. If the server doesn't become ready in time, .launch() still returns and a warning is logged — check server logs for startup errors.
Also update the ## Troubleshooting table to add a row:
Issue
Fix
Agent server slow to start / "did not become ready" warning
Set PRAISONAI_SERVER_READY_TIMEOUT=10 (seconds) before launching, or check server logs for the underlying startup error.
Optional but recommended: add a short subsection ### Environment Variables near ## CLI Commands:
## Environment Variables| Variable | Default | Description ||----------|---------|-------------||`PRAISONAI_SERVER_READY_TIMEOUT`|`5.0`| Seconds to wait for the FastAPI server to become ready after `.launch()` / `praisonai serve agents`. A warning is logged if exceeded; startup continues. |
Plus one user-friendly code example:
# Give the server more time on slow machinesexport PRAISONAI_SERVER_READY_TIMEOUT=15
praisonai serve agents --port 8000
2. docs/features/agent-api-launch.mdx
Current text (Note block, after Example 4):
Server readiness is signalled deterministically (no fixed sleep); .launch() returns only after the port is accepting connections (5s timeout).
Required change: Same as page 1 — soften "(5s timeout)" to "default 5s, configurable via PRAISONAI_SERVER_READY_TIMEOUT".
Also add a new accordion in the ## Troubleshooting<AccordionGroup>:
<Accordiontitle="Server slow to start / readiness warning in logs">
If you see `Agent server on port N did not become ready within 5.0s` in the logs, the FastAPI server took longer than the default 5s to come up. This is usually safe (`.launch()` still returns and the server keeps starting), but you can raise the wait:
```bashexport PRAISONAI_SERVER_READY_TIMEOUT=15 # seconds
Common causes: slow imports, cold-start on resource-constrained machines, blocking startup hooks.
**Also extend the `## Launch Parameters` section with a short "Environment variables" subsection** (do not invent a `timeout=` keyword arg — it doesn't exist in the SDK; control is via env var only):
```markdown
### Environment Variables
| Variable | Default | Description |
|----------|---------|-------------|
| `PRAISONAI_SERVER_READY_TIMEOUT` | `5.0` | Seconds `.launch()` waits for the HTTP server to be ready. On timeout, a warning is logged and execution continues. |
3. docs/features/thread-safety.mdx
Current text (### Multi-team HTTP launch section):
Server readiness is signalled deterministically (no fixed sleep); .launch() returns only after the port is accepting connections (5s timeout).
Required change: Replace (5s timeout) with:
default 5s wait, configurable via the PRAISONAI_SERVER_READY_TIMEOUT environment variable; a warning is logged on timeout instead of silently proceeding
No other changes needed on this page.
Pages to grep for stale references (sanity sweep)
Before submitting the PR, grep the whole docs/ tree for any of:
5s timeout
5.0s timeout
timeout=5.0 (in prose, not code)
ready_event.wait
and update wording where appropriate.
Style / formatting requirements (per AGENTS.md)
✅ Keep wording user-focused and beginner-friendly — readers shouldn't need to know what ready_event or _AgentServerRegistry is.
✅ Do NOT put any of these changes in docs/concepts/ (that folder is human-only).
✅ Use Mintlify components (<Note>, <AccordionGroup>, etc.) consistent with the rest of each page.
✅ Active voice, one-sentence section intros, no forbidden phrases ("In this section…", "As you can see…", "It's important to note that…").
✅ Every code example should run as-is — no placeholder values.
✅ Match SDK ground truth exactly: variable name PRAISONAI_SERVER_READY_TIMEOUT, default 5.0, type float, no equivalent constructor / kwarg exists.
❌ Do not create a new dedicated page for this env var.
❌ Do not edit docs.json "Concepts" group entries.
❌ Do not invent a timeout keyword argument on .launch() — it doesn't exist.
Suggested user-flow diagram (optional, only if it improves clarity)
If you add a diagram to agent-api-launch.mdx, follow the AGENTS.md color scheme:
sequenceDiagram
participant User
participant Launch as .launch()
participant Server as FastAPI server
User->>Launch: agent.launch(port=8000)
Launch->>Server: start in background thread
Note over Launch,Server: waits up to<br/>PRAISONAI_SERVER_READY_TIMEOUT (5s default)
alt ready in time
Server-->>Launch: ready
Launch-->>User: returns True
else timed out
Launch-->>User: returns True + WARNING logged
Server-->>User: server may still come up shortly after
end
Loading
Acceptance criteria for the follow-up PR
docs/deploy/servers/agents.mdx no longer hard-codes "5s timeout"; env var is documented.
Context
Upstream change: MervinPraison/PraisonAI PR #1655 ("fix: check agent server readiness timeout return value (fixes #1631)") — merged into
mainon 2026-05-13.60b45407962488a916d399122e3362858958f19cpraisonaiagents/agents/agents.py(method_AgentServerRegistry.start_server_if_needed)praisonaiagents/tests/unit/agents/test_server_registry_timeout.pyWhat changed in the SDK (user-facing)
When you call
Agent.launch(...)orAgentTeam.launch(...)(or runpraisonai serve agents), the SDK starts a FastAPI server in a background thread and waits for it to become ready before returning. Previously that wait used a hard-coded 5-second timeout and silently ignored a timeout — if the server never became ready, the caller had no way to know.PR #1655 makes two user-visible improvements:
The readiness timeout is now configurable via a new environment variable:
PRAISONAI_SERVER_READY_TIMEOUT5.0"abc") fall back to5.0and log a WARNING:"Invalid PRAISONAI_SERVER_READY_TIMEOUT value. Using default 5.0s."A diagnostic WARNING is logged when the server does not become ready within the timeout:
Behaviour is otherwise unchanged —
.launch()still returnsTrueand execution proceeds. This is purely additional observability for a previously silent failure mode.Exact SDK snippet (ground truth)
Decision: update existing pages (no new page)
Per AGENTS.md, we don't create dedicated pages for single env vars / trivial config knobs. Three existing pages currently hard-code the phrase "5s timeout" and must be updated. We should also add the env var to the troubleshooting / configuration tables.
Pages that MUST be updated
1.
docs/deploy/servers/agents.mdxCurrent text (Note block, ~line 73):
Required change: Replace
(5s timeout)with text that reflects that the timeout is configurable, e.g.:Also update the
## Troubleshootingtable to add a row:PRAISONAI_SERVER_READY_TIMEOUT=10(seconds) before launching, or check server logs for the underlying startup error.Optional but recommended: add a short subsection
### Environment Variablesnear## CLI Commands:Plus one user-friendly code example:
2.
docs/features/agent-api-launch.mdxCurrent text (Note block, after Example 4):
Required change: Same as page 1 — soften "(5s timeout)" to "default 5s, configurable via
PRAISONAI_SERVER_READY_TIMEOUT".Also add a new accordion in the
## Troubleshooting<AccordionGroup>:Common causes: slow imports, cold-start on resource-constrained machines, blocking startup hooks.
3.
docs/features/thread-safety.mdxCurrent text (
### Multi-team HTTP launchsection):Required change: Replace
(5s timeout)with:No other changes needed on this page.
Pages to grep for stale references (sanity sweep)
Before submitting the PR, grep the whole
docs/tree for any of:5s timeout5.0s timeouttimeout=5.0(in prose, not code)ready_event.waitand update wording where appropriate.
Style / formatting requirements (per AGENTS.md)
ready_eventor_AgentServerRegistryis.docs/concepts/(that folder is human-only).<Note>,<AccordionGroup>, etc.) consistent with the rest of each page.PRAISONAI_SERVER_READY_TIMEOUT, default5.0, type float, no equivalent constructor / kwarg exists.docs.json"Concepts" group entries.timeoutkeyword argument on.launch()— it doesn't exist.Suggested user-flow diagram (optional, only if it improves clarity)
If you add a diagram to
agent-api-launch.mdx, follow the AGENTS.md color scheme:sequenceDiagram participant User participant Launch as .launch() participant Server as FastAPI server User->>Launch: agent.launch(port=8000) Launch->>Server: start in background thread Note over Launch,Server: waits up to<br/>PRAISONAI_SERVER_READY_TIMEOUT (5s default) alt ready in time Server-->>Launch: ready Launch-->>User: returns True else timed out Launch-->>User: returns True + WARNING logged Server-->>User: server may still come up shortly after endAcceptance criteria for the follow-up PR
docs/deploy/servers/agents.mdxno longer hard-codes "5s timeout"; env var is documented.docs/features/agent-api-launch.mdxNote block updated, troubleshooting accordion added, env var table added.docs/features/thread-safety.mdx### Multi-team HTTP launchupdated.docs/concepts/.docs.jsonleft untouched (no new nav entries needed).mainfrom a feature branch.References
praisonaiagents/agents/agents.py→_AgentServerRegistry.start_server_if_neededpraisonaiagents/tests/unit/agents/test_server_registry_timeout.py