Skip to content

Commit

Permalink
update docs and clean a little
Browse files Browse the repository at this point in the history
  • Loading branch information
the-praxs committed Nov 22, 2024
1 parent 94b59a2 commit 80bdedb
Showing 1 changed file with 22 additions and 3 deletions.
25 changes: 22 additions & 3 deletions docs/v1/concepts/sessions.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,9 @@ Optionally, sessions may include:

_Note: Overrides any current tags_

#### `get_analytics`
**Returns** (dict): A dictionary containing various analytics metrics for the session.


## Starting a Session
When you call `agentops.init()`, a session is automatically started.
Expand All @@ -62,7 +65,7 @@ Both `agentops.init()` and `agentops.start_session()` work as a factory pattern

## Ending a Session
If a process ends without any call to agentops, it will show in the dashboard as `Indeterminate`.
To end with a state, call either `agentops.end_session(...)` [(reference)](/v1/usage/sdk-reference/#end-session) if only one session is in use. Otherwise use `session.end_session(...)`
To end with a state, call either `agentops.end_session(...)` [(reference)](/v1/usage/sdk-reference/#end-session) if only one session is in use. Otherwise use `session.end_session(...)`.

## Inherited Sessions
When working with multiple agents running in different processes, it's possible to initialize AgentOps or start a session
Expand All @@ -71,14 +74,16 @@ with an existing session_id.
`agentops.init(inherited_session_id=<id>)`
`agentops.start_session(inherited_session_id=<id>)`

You can retrieve the current `session_id` by assigning the returned value from `init()` or `start_session()`
You can retrieve the current `session_id` by assigning the returned value from `init()` or `start_session()`.

<CodeGroup>
```python python
```python
import agentops
session = agentops.init()
# pass session.session_id to the other process
```

```python
# -- other process --
session_id = retrieve_session_id() # <-- your function
agentops.init(inherited_session_id=<id>)
Expand All @@ -87,6 +92,20 @@ agentops.init(inherited_session_id=<id>)

Both processes will now contribute data to the same session.

## Session Analytics
You can retrieve the analytics for a session by calling `session.get_analytics()`.

<CodeGroup>
```python
import agentops
session = agentops.init()
session.record(ActionEvent("llms"))
session.record(ActionEvent("tools"))
analytics = session.get_analytics()
print(analytics)
```
</CodeGroup>

## The AgentOps SDK Client
_More info for the curious_

Expand Down

0 comments on commit 80bdedb

Please sign in to comment.