-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Closed
Labels
Feature requestNew feature requestNew feature request
Description
Description
Add an optional identifier field to FileUrl and its subclasses (ImageUrl, VideoUrl, AudioUrl, DocumentUrl) to enable stable file tracking across conversations, similar to the existing implementation for BinaryContent (PR #2231).
When tools return file URLs, especially presigned URLs with expiration times, the URL itself changes over time even though it represents the same underlying file. This makes it difficult to track files across multiple tool calls in a conversation.
@agent.tool
async def get_document(ctx: RunContext[MyDeps], doc_id: str) -> DocumentUrl:
presigned_url = await generate_doc_url(doc_id, expires_in=3600)
# Return with stable identifier so the document can be tracked by it's own id
# even when the URL changes
return DocumentUrl(
url=presigned_url,
identifier=doc_id # Stable identifier
)
Note: I have already PR this feature for your review #2636 . I understand feature request hasn't been approved yet, so please feel free to close this PR if the approach doesn't align with the project's direction.
References
BinaryContent identifier PR #2231
Metadata
Metadata
Assignees
Labels
Feature requestNew feature requestNew feature request