Skip to content

Python: Python hosting: feature request — first-class proactive/outbound delivery with session integration #6959

Description

@mikezupper

[hosting] Feature request: first-class proactive/outbound messaging

Packages: agent-framework-hosting / agent-framework-hosting-telegram 1.0.0a260625 (Python)
Type: feature request (the hosting README lists "background runs" as future work —
this is a concrete use-case + API sketch for it)

Use case

Coaching/assistant agents are proactive by nature: scheduled check-ins, reminders,
review deliveries. Today AgentFrameworkHost channels are strictly reactive — the
Telegram channel's outbound helpers (_send, _send_photo) are private, and there
is no supported way to deliver a message to a known chat/session without an
incoming update.

Current workaround

We persist chat_ids at link time and POST directly to the Bot API from our own
scheduler, sharing the bot token with the hosted channel. It works (replies flow
back through the normal channel session), but it bypasses the host entirely — no
session/history integration, per-channel formatting, or delivery hooks.

API sketch

await host.deliver(
    isolation_key="telegram:12345",   # or a ChannelIdentity
    message="Daily check-in: what's the one thing today?",
    channel="telegram",               # optional; default = key's channel
)

Semantics: renders via the channel's normal formatting/fallback paths, appends to
the isolation key's session so the agent has the context on the next inbound turn,
and returns a delivery result. That last point matters: with the workaround, the
agent doesn't know what it proactively asked unless the app writes it into history
itself (we do).


Found while building a production app on agent-framework (Python, hosted Telegram channel). We run the suggested fix as a local patch — happy to send a PR if the approach looks right.

Metadata

Metadata

Labels

hostingUsage: [Issues, PRs], Target: all hosting related solutionspythonUsage: [Issues, PRs], Target: Python

Projects

Status
Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions