Skip to content

Add signed file URL resolver #1425

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 1 commit into
base: dev
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all 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
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@
</h3>
</div>

# **Julep AI Changelog for 12 May 2025** ✨

- **Minor Feature**: Added `julep://` file URL resolution in workflows ✨

# **Julep AI Changelog for 9 May 2025** ✨

- **Minor Docs**: Added links to cookbooks for Quick, Community, and Industry pages.
Expand Down
11 changes: 11 additions & 0 deletions agents-api/agents_api/clients/async_s3.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,3 +85,14 @@ async def add_object_with_hash(body: bytes, replace: bool = False) -> str:
await add_object(key, body, replace=replace)

return key


@beartype
async def generate_presigned_url(key: str, expires: int = 3600) -> str:
"""Generate a temporary signed URL for a stored object."""
client = await setup()
return await client.generate_presigned_url(
"get_object",
Params={"Bucket": blob_store_bucket, "Key": key},
ExpiresIn=expires,
)
11 changes: 11 additions & 0 deletions agents-api/agents_api/clients/sync_s3.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,3 +93,14 @@ def add_object_with_hash(body: bytes, replace: bool = False) -> str:
add_object(key, body, replace=replace)

return key


@beartype
def generate_presigned_url(key: str, expires: int = 3600) -> str:
"""Generate a temporary signed URL for a stored object."""
client = setup()
return client.generate_presigned_url(
"get_object",
Params={"Bucket": blob_store_bucket, "Key": key},
ExpiresIn=expires,
)
12 changes: 12 additions & 0 deletions agents-api/agents_api/common/utils/evaluator.py
Original file line number Diff line number Diff line change
Expand Up @@ -315,6 +315,17 @@ def html_to_markdown(html_text: str) -> str:
return markdownify.markdownify(html_text)


# AIDEV-NOTE: Exposes Julep file URLs during expression evaluation
def resolve_url(url: str, expires: int = 3600) -> str:
"""Return a signed URL if the input uses the julep scheme."""
if url.startswith("julep://"):
file_id = url.split("julep://", 1)[1]
from ...clients import sync_s3

return sync_s3.generate_presigned_url(file_id, expires)
return url


# Restricted set of allowed functions
ALLOWED_FUNCTIONS = {
# Basic Python builtins
Expand Down Expand Up @@ -354,6 +365,7 @@ def html_to_markdown(html_text: str) -> str:
"humanize_text_alpha": humanize_text,
"markdown_to_html": markdown_to_html,
"html_to_markdown": html_to_markdown,
"resolve_url": resolve_url,
}


Expand Down
16 changes: 15 additions & 1 deletion documentation/concepts/files.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -218,8 +218,22 @@ const execution = await client.tasks.executions.create({
</Card>
</CardGroup>

## Accessing Files in Workflows

Files can be referenced inside task steps using the `julep://` scheme. When an
expression contains a URL like `julep://<file_id>`, Julep automatically resolves
it to a temporary signed URL that is valid for one hour by default.

```yaml
main:
- evaluate:
url: julep://{file_id}
```

This allows workflows to access file contents without exposing permanent links.

## Next Steps

- [Projects](/concepts/projects) - Learn about organizing resources with projects
- [Agents](/concepts/agents) - Learn how agents can work with files
- [Tasks](/concepts/tasks) - Learn how to use files in task workflows
- [Tasks](/concepts/tasks) - Learn how to use files in task workflows
Loading