Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@
EventStreamNotFoundError,
streams,
)
from azure.ai.agentserver.core.tasks import set_resilient_tasks_enabled
from azure.ai.agentserver.invocations import InvocationAgentServerHost

try:
Expand All @@ -82,6 +83,12 @@

app = InvocationAgentServerHost()

# Opt into resilient-task startup recovery. This sample declares a durable
# task, so the framework would enable recovery automatically; we set the switch
# explicitly to make the intent clear and to keep recovery working even if the
# task is ever registered lazily (after startup).
set_resilient_tasks_enabled(True)
Comment thread
Shivakishore14 marked this conversation as resolved.


async def _sse_from_stream(
stream: EventStream, invocation_id: str, *, initial_status: str = "queued"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
from starlette.requests import Request
from starlette.responses import JSONResponse, Response

from azure.ai.agentserver.core.tasks import TaskConflictError
from azure.ai.agentserver.core.tasks import TaskConflictError, set_resilient_tasks_enabled
from azure.ai.agentserver.invocations import InvocationAgentServerHost

try:
Expand All @@ -46,6 +46,12 @@

app = InvocationAgentServerHost()

# Opt into resilient-task startup recovery. This sample declares a durable
# task, so the framework would enable recovery automatically; we set the switch
# explicitly to make the intent clear and to keep recovery working even if the
# task is ever registered lazily (after startup).
set_resilient_tasks_enabled(True)


@app.invoke_handler
async def handle_invoke(request: Request) -> Response:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@
EventStreamNotFoundError,
streams,
)
from azure.ai.agentserver.core.tasks import set_resilient_tasks_enabled
from azure.ai.agentserver.invocations import InvocationAgentServerHost

try:
Expand All @@ -101,6 +102,12 @@

app = InvocationAgentServerHost()

# Opt into resilient-task startup recovery. This sample declares a durable
# task, so the framework would enable recovery automatically; we set the switch
# explicitly to make the intent clear and to keep recovery working even if the
# task is ever registered lazily (after startup).
set_resilient_tasks_enabled(True)


# --- SSE rendering ---------------------------------------------------------

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,17 @@
ResponsesAgentServerHost,
ResponsesServerOptions,
)
from azure.ai.agentserver.core.tasks import set_resilient_tasks_enabled
Comment thread
Nathandrake229 marked this conversation as resolved.

options = ResponsesServerOptions(resilient_background=True)
app = ResponsesAgentServerHost(options=options)

# Explicitly opt into resilient-task startup recovery, for parity with the
# invocations resilient samples. The Responses framework already registers its
# internal durable tasks at host construction (so recovery runs regardless);
# this call just makes the opt-in intent explicit.
set_resilient_tasks_enabled(True)

_SIMULATE_SHUTDOWN_MS = int(os.environ.get("SIMULATE_SHUTDOWN_MS", "0"))

# Phases run in order. Each emits one message output item and is made
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,13 +66,20 @@
ResponsesAgentServerHost,
ResponsesServerOptions,
)
from azure.ai.agentserver.core.tasks import set_resilient_tasks_enabled
Comment thread
Nathandrake229 marked this conversation as resolved.

options = ResponsesServerOptions(
resilient_background=True,
steerable_conversations=True,
)
app = ResponsesAgentServerHost(options=options)

# Explicitly opt into resilient-task startup recovery, for parity with the
# invocations resilient samples. The Responses framework already registers its
# internal durable tasks at host construction (so recovery runs regardless);
# this call just makes the opt-in intent explicit.
set_resilient_tasks_enabled(True)

_SIMULATE_SHUTDOWN_MS = int(os.environ.get("SIMULATE_SHUTDOWN_MS", "0"))


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@
ResponsesAgentServerHost,
ResponsesServerOptions,
)
from azure.ai.agentserver.core.tasks import set_resilient_tasks_enabled
Comment thread
Nathandrake229 marked this conversation as resolved.


# ─── Graph state ────────────────────────────────────────────────────────────
Expand Down Expand Up @@ -198,6 +199,12 @@ async def _get_graph() -> Any:
)
app = ResponsesAgentServerHost(options=options)

# Explicitly opt into resilient-task startup recovery, for parity with the
# invocations resilient samples. The Responses framework already registers its
# internal durable tasks at host construction (so recovery runs regardless);
# this call just makes the opt-in intent explicit.
set_resilient_tasks_enabled(True)

# Metadata key: the LangGraph checkpoint id whose completed work matches the
# response items persisted so far. Recorded in ``internal_metadata`` (persisted
# atomically WITH the items on every ``stream.checkpoint()``, stripped on
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,20 @@
ResponsesServerOptions,
TextResponse,
)
from azure.ai.agentserver.core.tasks import set_resilient_tasks_enabled
Comment thread
Nathandrake229 marked this conversation as resolved.

options = ResponsesServerOptions(
resilient_background=True,
steerable_conversations=False,
)
app = ResponsesAgentServerHost(options=options)

# Explicitly opt into resilient-task startup recovery, for parity with the
# invocations resilient samples. The Responses framework already registers its
# internal durable tasks at host construction (so recovery runs regardless);
# this call just makes the opt-in intent explicit.
set_resilient_tasks_enabled(True)


@app.response_handler
async def handler(
Expand Down
Loading