-
Notifications
You must be signed in to change notification settings - Fork 34
Manage agent conversational sessions and cursors #2259
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
base: master
Are you sure you want to change the base?
Manage agent conversational sessions and cursors #2259
Conversation
Co-authored-by: kelvin.sundli <[email protected]>
Cursor Agent can help with this pull request. Just |
Co-authored-by: kelvin.sundli <[email protected]>
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #2259 +/- ##
==========================================
+ Coverage 90.84% 90.85% +0.01%
==========================================
Files 167 167
Lines 24785 24865 +80
==========================================
+ Hits 22516 22592 +76
- Misses 2269 2273 +4
🚀 New features to boost your workflow:
|
Co-authored-by: kelvin.sundli <[email protected]>
@cursor Hey! I still see some issues in the linting and static code checks: Run pre-commit run --all-files --show-diff-on-failure
Found 6 errors (6 fixed, 0 remaining). ruff format..............................................................Failed
3 files reformatted, 358 files left unchanged debug statements (python)................................................Passed
diff --git a/cognite/client/data_classes/agents/chat.py b/cognite/client/data_classes/agents/chat.py from abc import ABC, abstractmethod from cognite.client.data_classes._base import CogniteObject, CogniteResource, CogniteResourceList
diff --git a/tests/tests_unit/test_api/test_agents_session.py b/tests/tests_unit/test_api/test_agents_session.py
@@ -93,13 +91,8 @@ class TestAgentSession:
@@ -146,11 +136,7 @@ class TestAgentStartSession:
@@ -162,10 +148,7 @@ class TestAgentStartSession:
@@ -176,10 +159,7 @@ class TestAgentStartSession:
@@ -187,10 +167,7 @@ class TestAgentStartSession:
@@ -199,10 +176,7 @@ class TestAgentStartSession: class TestIntegrationWorkflow:
\ No newline at end of file
Error: Process completed with exit code 1. |
…redundancy Co-authored-by: kelvin.sundli <[email protected]>
Description
This PR introduces a higher-level abstraction for interacting with Cognite Agents, simplifying multi-turn conversations by automatically managing the chat cursor.
A new
AgentSession
class is added, which encapsulates the state of a conversation, including theagent_id
and the currentcursor
. This allows users to initiate a session and then callsession.chat()
repeatedly without manually extracting and passing the cursor from previous responses.The
AgentSession
can be started in two ways:client.agents.start_session(agent_id: str, cursor: str | None = None)
.Agent
instance:agent.start_session(cursor: str | None = None)
.This change significantly improves the developer experience for building conversational applications with Cognite Agents.
Checklist:
If a new method has been added it should be referenced in cognite.rst in order to generate docs based on its docstring.