Add trace links to Telegram tool result messages

t-272.5·WorkTask·
·
·
Parent:t-272·Created2 months ago·Updated2 months ago

Dependencies

Description

Edit

When Ava uses a tool, include a clickable link in the response to view the full trace.

Context

After tool execution, Ava sends a message summarizing the result. We need to append a trace link so users can see full details.

Current Flow

1. Tool executes, returns result 2. Result formatted as message text 3. Message sent to Telegram

New Flow

1. Tool executes, returns result + trace ID (from t-272.4) 2. Result formatted as message text 3. Append trace link to message 4. Message sent to Telegram

Link Format

Use Telegram MarkdownV2 link syntax: [view trace](https://ava.bensima.com/trace/abc123)

Example message: "I ran the Python code. Output: 42

[view trace](https://ava.bensima.com/trace/trace-550e8400)"

Configuration

Add environment variable: AVA_WEB_URL

  • Example: https://ava.bensima.com
  • Used to construct trace URLs
  • If not set, don't include trace links (graceful degradation)

Files to Modify

Omni/Agent/Telegram.hs

Where tool results are formatted into response messages.

Look for:

  • How tool results are currently formatted
  • Where the response message is constructed
  • Add trace link after the tool result summary

Telegram Formatting Notes

  • Use MarkdownV2 escaping for special chars in URL
  • Link text should be short: "view trace" or "details"
  • Put link on its own line for readability

Alternative: Inline Keyboard Button

Instead of text link, could use Telegram inline keyboard:

InlineKeyboardButton { text = "View Trace" , url = Just "https://ava.bensima.com/trace/abc123" }

This shows a button below the message. More prominent but may be too noisy for every tool call.

Start with text link, can upgrade later.

Testing

  • Send message that triggers tool use
  • Verify response includes trace link
  • Click link, verify it opens trace viewer

Timeline (1)

🔄[human]Open → Done2 months ago