Skip to content

angee.workflows_agents.steps

Workflow step implementation backed by the agents inference catalogue.

AgentStepImpl is the one-shot activity counterpart to workflow gates: it renders one prompt from a minimal Django-template context (subject, run, step), sends one non-streaming chat request through the selected inference provider backend, journals a bounded request/response summary on the step-run, and debits token usage onto the run budget ledger.

AGENT_STEP_JOURNAL_MAX_BYTES

Maximum UTF-8 JSON bytes stored in one agent step-run output journal.

AGENT_STEP_TRUNCATION_MARKER

Marker appended when an agent request/response journal is shortened.

SESSION_PARKED_UNTIL

Far-future durable wait used because StepResult.wait requires a due time.

SESSION_UPDATE_FLUSH_SECONDS

Minimum interval between streamed turn-row saves.

AgentStepImpl

python
class AgentStepImpl(StepImpl)

One-shot workflow activity that calls an agents inference backend.

validate_config

python
@classmethod
def validate_config(cls, config: Any) -> None

Validate one-shot agent step config.

run

python
def run(step_run: Any, *, now: datetime) -> StepResult

Execute one one-shot inference request and return a routing outcome.

AgentSessionStepImpl

python
class AgentSessionStepImpl(StepImpl)

Multi-turn agent session whose bounded turns run on workflow workers.

Idle sessions park at :data:SESSION_PARKED_UNTIL and wake only through workflows.engine.deliver. The update sink flushes ACP payloads at a bounded cadence while the runtime refreshes the step heartbeat independently every minute. Worker death mid-turn still fails the whole run in v1; durable mid-turn replay is intentionally deferred.

run

python
def run(step_run: Any, *, now: datetime) -> StepResult

Run the oldest active/pending turn or park an idle session.

_TurnUpdateSink

python
@dataclass(slots=True)
class _TurnUpdateSink()

Bounded ACP update flusher.

__call__

python
def __call__(update: dict[str, Any]) -> None

Buffer one ACP payload and flush when the cadence bound elapsed.

flush

python
def flush() -> None

Append buffered updates to the persisted turn.

Released under the AGPL-3.0 License.