forked from a2aproject/a2a-python
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcontext.py
More file actions
25 lines (15 loc) · 699 Bytes
/
context.py
File metadata and controls
25 lines (15 loc) · 699 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
"""Defines the ServerCallContext class."""
import collections.abc
import typing
from pydantic import BaseModel, ConfigDict, Field
from a2a.auth.user import UnauthenticatedUser, User
State = collections.abc.MutableMapping[str, typing.Any]
class ServerCallContext(BaseModel):
"""A context passed when calling a server method.
This class allows storing arbitrary user data in the state attribute.
"""
model_config = ConfigDict(arbitrary_types_allowed=True)
state: State = Field(default={})
user: User = Field(default=UnauthenticatedUser())
requested_extensions: set[str] = Field(default_factory=set)
activated_extensions: set[str] = Field(default_factory=set)