Skip to content
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

sdk-py: added Cron search functionality #804

Merged
merged 28 commits into from
Jun 28, 2024
Merged
Changes from 2 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
11 changes: 11 additions & 0 deletions libs/sdk-py/langgraph_sdk/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -687,6 +687,17 @@
async def delete(self, cron_id: str) -> None:
"""Delete a cron."""
await self.http.delete(f"/runs/crons/{cron_id}")

async def list(
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you call this search

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

self, assistant_id: Optional[str], thread_id: Optional[str] = None
) -> ThreadState:
"""Get a list of all the cron jobs."""
if thread_id:
return await self.http.get(f"/threads/{thread_id}/runs/crons")
elif assistant_id:
return await self.http.get(f"/assistants/{assistant_id}/runs/crons")
else:
return await self.http.get(f"runs/crons")

Check failure on line 700 in libs/sdk-py/langgraph_sdk/client.py

View workflow job for this annotation

GitHub Actions / cd libs/sdk-py / lint #3.9

Ruff (F541)

langgraph_sdk/client.py:700:40: F541 f-string without any placeholders

Check failure on line 700 in libs/sdk-py/langgraph_sdk/client.py

View workflow job for this annotation

GitHub Actions / cd libs/sdk-py / lint #3.11

Ruff (F541)

langgraph_sdk/client.py:700:40: F541 f-string without any placeholders
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

assistant_id should be required for cron also (similar to run)



def _get_api_key(api_key: Optional[str] = None) -> Optional[str]:
Expand Down
Loading